Skip to content

Commit 9f9f40e

Browse files
Rahmonhalian-vilela
authored andcommitted
Translate Portals to pt-BR (#97)
* update portals (translating to PT-BR) * update portals * Fix typos * Atualização de "Uso" para "Utilização" * Correção de erro de digitação * Correção de erro de digitação * Correção da tradução de "modal" * Correção de erro de digitação * Correção de plural * Atualização de "notar" para "observar" * atualização * Update portals.md
1 parent 6a047e2 commit 9f9f40e

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

content/docs/portals.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ title: Portals
44
permalink: docs/portals.html
55
---
66

7-
Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
7+
Portals fornece uma forma elegante de renderizar um elemento filho dentro de um nó DOM que existe fora da hierarquia do componente pai.
88

99
```js
1010
ReactDOM.createPortal(child, container)
1111
```
1212

13-
The first argument (`child`) is any [renderable React child](/docs/react-component.html#render), such as an element, string, or fragment. The second argument (`container`) is a DOM element.
13+
O primeiro argumento (`child`) é qualquer [elemento filho React renderizável](/docs/react-component.html#render), como um elemento, string ou fragmento. O segundo argumento (`container`) é um elemento DOM.
1414

15-
## Usage {#usage}
15+
## Utilização {#usage}
1616

17-
Normally, when you return an element from a component's render method, it's mounted into the DOM as a child of the nearest parent node:
17+
Normalmente, quando retornamos um elemento pelo método render de um componente ele é montado dentro do DOM como um filho do nó pai mais próximo:
1818

1919
```js{4,6}
2020
render() {
21-
// React mounts a new div and renders the children into it
21+
// React monta uma nova div e renderiza o filho dentro dela
2222
return (
2323
<div>
2424
{this.props.children}
@@ -27,34 +27,34 @@ render() {
2727
}
2828
```
2929

30-
However, sometimes it's useful to insert a child into a different location in the DOM:
30+
Entretanto, em algumas situação é útil inserir um elemento filho em um local diferente no DOM:
3131

3232
```js{6}
3333
render() {
34-
// React does *not* create a new div. It renders the children into `domNode`.
35-
// `domNode` is any valid DOM node, regardless of its location in the DOM.
34+
// React *não* cria uma nova div. Ele renderiza os filhos dentro do `domNode`.
35+
// `domNode` é qualquer nó DOM válido, independente da sua localização no DOM.
3636
return ReactDOM.createPortal(
3737
this.props.children,
3838
domNode
3939
);
4040
}
4141
```
42+
Um caso típico do uso de portals é quando um componente pai tem o estilo `overflow: hidden` ou `z-index`, mas você precisa que o filho visualmente "saia" desse contêiner. Por exemplo, caixas de diálogo, hovercards e tooltips.
4243

43-
A typical use case for portals is when a parent component has an `overflow: hidden` or `z-index` style, but you need the child to visually "break out" of its container. For example, dialogs, hovercards, and tooltips.
44-
45-
> Note:
44+
> Nota:
4645
>
47-
> When working with portals, remember that [managing keyboard focus](/docs/accessibility.html#programmatically-managing-focus) becomes very important.
46+
> Quando estiver trabalhando com portals, lembre-se que [tratar o evento focus](/docs/accessibility.html#programmatically-managing-focus) se torna muito importante.
4847
>
49-
> For modal dialogs, ensure that everyone can interact with them by following the [WAI-ARIA Modal Authoring Practices](https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal).
48+
> No caso dos modals, assegure-se que todos possam interagir com eles seguindo as práticas descritas em [WAI-ARIA Modal Authoring Practices](https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal).
5049
51-
[**Try it on CodePen**](https://codepen.io/gaearon/pen/yzMaBd)
50+
[**Experimente no CodePen**](https://codepen.io/gaearon/pen/yzMaBd)
5251

53-
## Event Bubbling Through Portals {#event-bubbling-through-portals}
52+
## Propagação de Eventos Através do Portals {#event-bubbling-through-portals}
5453

55-
Even though a portal can be anywhere in the DOM tree, it behaves like a normal React child in every other way. Features like context work exactly the same regardless of whether the child is a portal, as the portal still exists in the *React tree* regardless of position in the *DOM tree*.
54+
Apesar de um portal poder estar em qualquer lugar na árvore DOM, seu comportamento é como o de qualquer outro elemento React filho. Funcionalidades como contexto funcionam da mesma forma independente se o filho é um portal, pois o portal ainda existe na *árvore React* independentemente da posição que esteja na *árvore DOM*.
5655

57-
This includes event bubbling. An event fired from inside a portal will propagate to ancestors in the containing *React tree*, even if those elements are not ancestors in the *DOM tree*. Assuming the following HTML structure:
56+
Isso inclui a propagação de eventos. Um evento disparado dentro de um portal será propagado para os elementos antecessores da *árvore React*, mesmo que estes não sejam antecessores na *árvore DOM*.
57+
Considere a seguinte estrutura HTML:
5858

5959
```html
6060
<html>
@@ -65,10 +65,10 @@ This includes event bubbling. An event fired from inside a portal will propagate
6565
</html>
6666
```
6767

68-
A `Parent` component in `#app-root` would be able to catch an uncaught, bubbling event from the sibling node `#modal-root`.
68+
Um componente `Pai` em `#app-root` será capaz de capturar a propagação de um evento não tratado vindo do nó irmão `#modal-root`.
6969

7070
```js{28-31,42-49,53,61-63,70-71,74}
71-
// These two containers are siblings in the DOM
71+
// Estes dois contêineres são irmãos no DOM
7272
const appRoot = document.getElementById('app-root');
7373
const modalRoot = document.getElementById('modal-root');
7474
@@ -79,14 +79,14 @@ class Modal extends React.Component {
7979
}
8080
8181
componentDidMount() {
82-
// The portal element is inserted in the DOM tree after
83-
// the Modal's children are mounted, meaning that children
84-
// will be mounted on a detached DOM node. If a child
85-
// component requires to be attached to the DOM tree
86-
// immediately when mounted, for example to measure a
87-
// DOM node, or uses 'autoFocus' in a descendant, add
88-
// state to Modal and only render the children when Modal
89-
// is inserted in the DOM tree.
82+
// O elemento portal é inserido na árvore DOM depois que
83+
// os componentes filhos de `Modal` são montados, o que significa que os filhos
84+
// serão montados em um nó DOM separado. Se um componente
85+
// filho precisa ser colocado na árvore DOM
86+
// imediatamente quando é montado, por exemplo para medir um
87+
// DOM ou usar 'autoFocus' em um descendente, adicione
88+
// state ao Modal e renderize o filho apenas quando o Modal
89+
// estiver inserido na árvore DOM.
9090
modalRoot.appendChild(this.el);
9191
}
9292
@@ -110,9 +110,9 @@ class Parent extends React.Component {
110110
}
111111
112112
handleClick() {
113-
// This will fire when the button in Child is clicked,
114-
// updating Parent's state, even though button
115-
// is not direct descendant in the DOM.
113+
// Isso é disparado quando o botão no filho é clicado,
114+
// atualizando o state do componente Pai, mesmo que o filho
115+
// não seja um descendente direto no DOM.
116116
this.setState(state => ({
117117
clicks: state.clicks + 1
118118
}));
@@ -121,12 +121,12 @@ class Parent extends React.Component {
121121
render() {
122122
return (
123123
<div onClick={this.handleClick}>
124-
<p>Number of clicks: {this.state.clicks}</p>
124+
<p>Número de cliques: {this.state.clicks}</p>
125125
<p>
126-
Open up the browser DevTools
127-
to observe that the button
128-
is not a child of the div
129-
with the onClick handler.
126+
Abra o DevTools do navegador
127+
para observar que o botão
128+
não é um filho da div
129+
com o onClick.
130130
</p>
131131
<Modal>
132132
<Child />
@@ -137,18 +137,18 @@ class Parent extends React.Component {
137137
}
138138
139139
function Child() {
140-
// The click event on this button will bubble up to parent,
141-
// because there is no 'onClick' attribute defined
140+
// O evento de clique nesse botão irá propagar para o ascendente,
141+
// porque o atributo 'onClick' não está definido
142142
return (
143143
<div className="modal">
144-
<button>Click</button>
144+
<button>Clicar</button>
145145
</div>
146146
);
147147
}
148148
149149
ReactDOM.render(<Parent />, appRoot);
150150
```
151151

152-
[**Try it on CodePen**](https://codepen.io/gaearon/pen/jGBWpE)
152+
[**Experimente no CodePen**](https://codepen.io/gaearon/pen/jGBWpE)
153153

154-
Catching an event bubbling up from a portal in a parent component allows the development of more flexible abstractions that are not inherently reliant on portals. For example, if you render a `<Modal />` component, the parent can capture its events regardless of whether it's implemented using portals.
154+
Capturar um evento propagado a partir de um portal em um componente pai permite o desenvolvimento de abstrações mais flexíveis que não dependem diretamente de portals. Por exemplo, se você renderizar um componente `<Modal />`, o componente pai pode captura seus eventos independentemente se são implementados usando portals.

0 commit comments

Comments
 (0)