Skip to content

Commit 90e03a5

Browse files
authored
Merge pull request #98 from ahmedkaba/portals
Translation of Portals
2 parents 110a841 + 57541ff commit 90e03a5

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

content/docs/portals.md

+40-40
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
---
22
id: portals
3-
title: Portals
3+
title: Portal'lar
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+
Portal'lar, üst bileşenin DOM hiyerarşisinin dışında bulunan bir DOM düğümüne alt eleman render etmek için üstün bir yol sağlar.
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+
İlk argüman (`child`) bir eleman, dize veya fragment gibi [render edilebilir herhangi bir React alt elemanıdır.](/docs/react-component.html#render) İkinci argüman (`container`) bir DOM elemanıdır.
1414

15-
## Usage {#usage}
15+
## Kullanım {#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+
Normal olarak, bir elemanı bir bileşenin render metodundan döndürdüğünüzde, En yakın üst düğümün alt elemanı olarak DOM'a yerleştirilir:
1818

1919
```js{4,6}
2020
render() {
21-
// React mounts a new div and renders the children into it
21+
// React yeni bir div oluşturur ve içine alt elemanları render eder
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+
Bununla birlikte, bazen bir alt elemanı DOM üzerinde farklı bir yere yerleştirmek için kullanışlıdır:
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 yeni bir div *oluşturmaz*. Alt elemanı `domNode` içine render eder.
35+
// `domNode` DOM üzerindeki konumuna bakılmaksızın, herhangi bir geçerli DOM düğümüdür.
3636
return ReactDOM.createPortal(
3737
this.props.children,
3838
domNode
3939
);
4040
}
4141
```
4242

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.
43+
Portal'lar için tipik bir kullanım durumu, bir ana bileşenin `overflow: hidden` veya `z-index` stiline sahip olması, fakat alt elemanı kapsayıcısından görsel olarak "çıkarmanız" gerektiğindedir. Örneğin; dialog'lar, hovercard'lar ve tooltip'ler.
4444

45-
> Note:
45+
> Not:
4646
>
47-
> When working with portals, remember that [managing keyboard focus](/docs/accessibility.html#programmatically-managing-focus) becomes very important.
47+
> Portal'lar ile çalışırken, [klavye odağını yönetmenin](/docs/accessibility.html#programmatically-managing-focus) çok önemli olduğunu unutmayın.
4848
>
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).
49+
> Modal dialog'ları için, [WAI-ARIA Modal Oluşturma Pratiklerine](https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal) uygun şekilde herkesin onlarla etkileşim kurabildiğinden emin olun.
5050
51-
[**Try it on CodePen**](https://codepen.io/gaearon/pen/yzMaBd)
51+
[**CodePen'de Deneyin**](https://codepen.io/gaearon/pen/yzMaBd)
5252

53-
## Event Bubbling Through Portals {#event-bubbling-through-portals}
53+
## Portal'lar Üzerinden Olay Kabarcıklandırma {#event-bubbling-through-portals}
5454

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*.
55+
Bir portal DOM ağacında herhangi bir yerde olsa bile, her şekilde normal bir React alt elemanı gibi davranır. Context gibi özellikler, alt elemanın bir portal olup olmadığına bakılmaksızın tam olarak aynı şekilde çalışır, çünkü portal *DOM ağacındaki* konumundan bağımsız olarak hala *React ağacında* bulunur.
5656

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:
57+
Bu örnek olay kabarcıklandırma içerir. Bir portal'ın içinden tetiklenen bir olay, bu elemanlar *DOM ağacında* üst elemanı olmasa bile, içinde bulunduğu *React ağacındaki* üst elemanlara yayılır. Aşağıdaki HTML yapısını varsayarak:
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+
`#app-root` içinde bulunan bir `Parent` bileşeni, kardeş eleman olan `#modal-root` üzerinden kabarcıklanan yakalanmamış bir olayı yakalayabilecek.
6969

7070
```js{28-31,42-49,53,61-63,70-71,74}
71-
// These two containers are siblings in the DOM
71+
// Bu iki kapsayıcı DOM üzerinde kardeştir (yani yan yana bulunur)
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+
// Portal elemanı, Modal'ın alt elemanları
83+
// oluşturulduktan sonra DOM ağacına eklenir,
84+
// bu alt elemanların ayrı bir DOM düğümünde oluşturulduğu anlamına gelir.
85+
// Bir alt bileşen oluşturulduğunda çabucak DOM ağacına
86+
// bağlanmayı gerektirirse, örneğin DOM düğümünü ölçmek için,
87+
// veya üstten gelen bir 'autoFocus' kullanıyorsa,
88+
// Modal'a state ekleyin ve alt elemanları yalnızca
89+
// DOM ağacına Modal eklendiğinde render edin.
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+
// Bu, Child içinde bulunan butona tıklandığında tetiklenir,
114+
// buton DOM üzerinde doğrudan üste bağlı olmamasına rağmen
115+
// Parent'in state'ini günceller.
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>Tıklama sayısı: {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+
Butonun onClick yöneticisi ile
127+
birlikte div alt elemanı olmadığını
128+
gözlemlemek için tarayıcınızın
129+
geliştrici konsolunu açın.
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+
// Bu butondaki click olayı en üst elemana kabarcıklanır (çıkar),
141+
// çünkü tanımlanmış bir 'onClick' özelliği yok
142142
return (
143143
<div className="modal">
144-
<button>Click</button>
144+
<button>Tıkla</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+
[**CodePen'de Deneyin**](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+
Bir üst bileşende bir portal'dan kabarcıklanan bir olayı yakalamak, doğal olarak portal'lara bağımlı olmayan daha esnek soyutlamaların geliştirilmesine izin verir. Örneğin, bir `<Modal />` bileşeni render ederseniz, üst eleman portal'lar kullanılarak uygulanıp uygulanmadığına bakılmaksızın olaylarını yakalayabilir.

0 commit comments

Comments
 (0)