Skip to content

Commit 28b97c2

Browse files
committed
Revert " done translate web-components.md to ar .."
This reverts commit 08bb09d.
1 parent 0fe52e5 commit 28b97c2

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

content/docs/web-components.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,46 @@
11
---
22
id: web-components
3-
title: مكونات الويب
3+
title: Web Components
44
permalink: docs/web-components.html
55
redirect_from:
66
- "docs/webcomponents.html"
77
---
88

9-
إنّ مكوّنات React و[مكوّنات الويب](https://developer.mozilla.org/en-US/docs/Web/Web_Components) مبنية لحل مشاكل مختلفة. حيث تُزوِّدنا مكوّنات الويب بتغليف قوي لمكوّنات قابلة لإعادة الاستخدام، بينما تُزوِّدنا مكوّنات React بمكتبة تصريحات تُبقي DOM على تزامن مع بياناتنا. يكون هذا الهدفان متكاملين، وكمُطوّر لك حرية استخدام React في مكوّنات الويب لديك، أو استخدام مكوّنات الويب في React أو كليهما معًا.
9+
React and [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) are built to solve different problems. Web Components provide strong encapsulation for reusable components, while React provides a declarative library that keeps the DOM in sync with your data. The two goals are complementary. As a developer, you are free to use React in your Web Components, or to use Web Components in React, or both.
1010

11-
معظم من يستخدم React لا يستخدم مكوّنات الويب، ولكن قد ترغب في ذلك خاصة إذا كنت تستخدم مكوّنات لواجهة المستخدم من طرف ثالث والتي تكون مكتوبة باستخدام مكوّنات الويب.
11+
Most people who use React don't use Web Components, but you may want to, especially if you are using third-party UI components that are written using Web Components.
1212

13-
14-
## استخدام مكوّنات الويب في React {#using-web-components-in-react}
13+
## Using Web Components in React {#using-web-components-in-react}
1514

1615
```javascript
1716
class HelloMessage extends React.Component {
1817
render() {
19-
return <div>أهلًا <x-search>{this.props.name}</x-search>!</div>;
18+
return <div>Hello <x-search>{this.props.name}</x-search>!</div>;
2019
}
2120
}
2221
```
2322

24-
> ملاحظة:
23+
> Note:
2524
>
26-
>تعرض مكوّنات الويب عادة واجهة برمجة تطبيقات (API) إلزاميّة. على سبيل المثال قد يُعرِّض مكوّن الويب `video` الدالتين `play()`‎ و `pause()`، وللوصول إلى واجهة برمجة التطبيقات الإلزامية لمكوّنات الويب ستحتاج إلى استخدام مرجع للتفاعل مع عقدة DOM مباشرةً. إن كنت تستخدم مكوّنات ويب من طرف ثالث فالحل الأمثل هو كتابة مكوّن React يسلك سلوك غلاف لمكوّنات الويب لديك.
25+
> Web Components often expose an imperative API. For instance, a `video` Web Component might expose `play()` and `pause()` functions. To access the imperative APIs of a Web Component, you will need to use a ref to interact with the DOM node directly. If you are using third-party Web Components, the best solution is to write a React component that behaves as a wrapper for your Web Component.
2726
>
28-
> الأحداث الصادرة من قبل مكوّن الويب قد لا تنتشر بشكل صحيح عبر شجرة تصيير React.
29-
> ستحتاج إلى إرفاق معالج أحداث يدويًّا للتعامل مع هذه الأحداث ضمن مكوّنات React لديك.
27+
> Events emitted by a Web Component may not properly propagate through a React render tree.
28+
> You will need to manually attach event handlers to handle these events within your React components.
3029
31-
إحدى الأمور التي من الشائع الخطأ بها هي استخدام مكوّنات الويب للخاصيّة "class" بدلًا من "className":
30+
One common confusion is that Web Components use "class" instead of "className".
3231

3332
```javascript
3433
function BrickFlipbox() {
3534
return (
3635
<brick-flipbox class="demo">
37-
<div>الواجهة الأمامية</div>
38-
<div>الواجهة الخلفية</div>
36+
<div>front</div>
37+
<div>back</div>
3938
</brick-flipbox>
4039
);
4140
}
4241
```
4342

44-
## استخدام React في مكوّنات الويب لديك {#using-react-in-your-web-components}
43+
## Using React in your Web Components {#using-react-in-your-web-components}
4544

4645
```javascript
4746
class XSearch extends HTMLElement {
@@ -57,7 +56,7 @@ class XSearch extends HTMLElement {
5756
customElements.define('x-search', XSearch);
5857
```
5958

60-
>ملاحظة:
59+
>Note:
6160
>
62-
> **لن** تعمل هذه الشيفرة إن نقلت الأصناف باستخدام Babel. انظر إلى هذه المشكلة [من هنا](https://github.com/w3c/webcomponents/issues/587).
63-
> يجب عليك تضمين [custom-elements-es5-adapter](https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs) قبل تحميل مكوّنات الويب لإصلاح هذه المشكلة.
61+
>This code **will not** work if you transform classes with Babel. See [this issue](https://github.com/w3c/webcomponents/issues/587) for the discussion.
62+
>Include the [custom-elements-es5-adapter](https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs) before you load your web components to fix this issue.

0 commit comments

Comments
 (0)