Skip to content

Commit 50d6770

Browse files
committed
[your-first-component] translate overview, components
1 parent df5fc55 commit 50d6770

1 file changed

Lines changed: 29 additions & 32 deletions

File tree

src/content/learn/your-first-component.md

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
---
2-
title: Your First Component
2+
title: مكوّنك الأول
33
---
44

55
<Intro>
66

7-
*Components* are one of the core concepts of React. They are the foundation upon which you build user interfaces (UI), which makes them the perfect place to start your React journey!
7+
*المكونات* هي إحدى المفاهيم الرئيسية في React. هي الأساس الذي تبني عليها واجهات المستخدم. مما يجعلها المكان الصحيح لبدأ رحلتك مع React.
88

99
</Intro>
1010

1111
<YouWillLearn>
1212

13-
* What a component is
14-
* What role components play in a React application
15-
* How to write your first React component
13+
* ما هو المكوّن
14+
* ما الدور الذي تلعبه المكوّنات في تطبيق React
15+
* كيف تكتب أول مكوّن React
1616

1717
</YouWillLearn>
1818

19-
## Components: UI building blocks {/*components-ui-building-blocks*/}
19+
## المكونات: حجر بناء واجهة المستخدم {/*components-ui-building-blocks*/}
2020

21-
On the Web, HTML lets us create rich structured documents with its built-in set of tags like `<h1>` and `<li>`:
21+
في الويب، تمكننا HTML من إنشاء وثائق مهيكلة غنية باستخدام مجموعة الوسوم المدمجة مثل `<h1>` و `<li>`:
2222

2323
```html
2424
<article>
25-
<h1>My First Component</h1>
25+
<h1>مكوّني الأول</h1>
2626
<ol>
27-
<li>Components: UI Building Blocks</li>
28-
<li>Defining a Component</li>
29-
<li>Using a Component</li>
27+
<li>المكوّنات: حجر بناء واجهة المستخدم</li>
28+
<li>تعريف مكوّن</li>
29+
<li>إستخدام مكوّن</li>
3030
</ol>
3131
</article>
3232
```
3333

34-
This markup represents this article `<article>`, its heading `<h1>`, and an (abbreviated) table of contents as an ordered list `<ol>`. Markup like this, combined with CSS for style, and JavaScript for interactivity, lies behind every sidebar, avatar, modal, dropdown—every piece of UI you see on the Web.
34+
يمثل هذا الترميز المرئي هذه المقالة `<article>`, عنوانها `<h1>`, وفهرس محتويات مختصر في شكل قائمة مرتبة `<ol>`. ترميز مرئي كهذا, مدمج مع CSS من أجل الأنماط التصميمية, و JavaScript من أجل التفاعلية, يكمن وراء كل شريط جانبي, صورة رمزية, نافذة, قائمة منسدلة - كل قطعة من واجهة مستخدم تراها في الويب.
3535

36-
React lets you combine your markup, CSS, and JavaScript into custom "components", **reusable UI elements for your app.** The table of contents code you saw above could be turned into a `<TableOfContents />` component you could render on every page. Under the hood, it still uses the same HTML tags like `<article>`, `<h1>`, etc.
36+
تمكنك React من دمج الترميز المرئي, وCSS, وJavaScript في "مكونات" مخصصة, **عناصر واجهة المستخدم قابلة لإعادة الاستخدام لتطبيقك**. يمكن تحويل كود فهرس المحتوى الذي رأيته أعلاه الى مكوّن `<TableOfContents />` الذي يمكن تصييره في كل صفحة. لا يزال يستخدم هذا المكوّن تحت الخطاء وسوم مثل `<article>`, `<h1>`, إلخ.
3737

38-
Just like with HTML tags, you can compose, order and nest components to design whole pages. For example, the documentation page you're reading is made out of React components:
38+
تمامًا مثل الوسوم HTML، يمكنك تجميع وترتيب وتضمين المكوّنات لتصميم صفحات كاملة. على سبيل المثال، صفحة المستندات التي تقرأها مصنوعة من مكوّنات React.
3939

4040
```js
4141
<PageLayout>
4242
<NavigationHeader>
4343
<SearchBar />
44-
<Link to="/docs">Docs</Link>
44+
<Link to="/docs">المستندات</Link>
4545
</NavigationHeader>
4646
<Sidebar />
4747
<PageContent>
@@ -51,11 +51,11 @@ Just like with HTML tags, you can compose, order and nest components to design w
5151
</PageLayout>
5252
```
5353

54-
As your project grows, you will notice that many of your designs can be composed by reusing components you already wrote, speeding up your development. Our table of contents above could be added to any screen with `<TableOfContents />`! You can even jumpstart your project with the thousands of components shared by the React open source community like [Chakra UI](https://chakra-ui.com/) and [Material UI.](https://material-ui.com/)
54+
مع نمو مشروعك, ستلاحظ انه يمكن تجميع العديد من تصاميمك بواسطة إعادة استخدام مكوّنات كتبتها مسبقا, مما يسرع عملية التطوير. يمكن إضافة فهرس المحتويات أعلاه الى أي شاشة عن طريق `<TableOfContents />`! يمكنك أيضا الإنطلاق بسرعة في مشروعك باستخدام آلاف المكوّنات المشتركة من قبل مجتمع React مفتوحة المصدر مثل [Chakra UI](https://chakra-ui.com/) و [Material UI.](https://material-ui.com/).
5555

56-
## Defining a component {/*defining-a-component*/}
56+
## تعريف مكوّن {/*defining-a-component*/}
5757

58-
Traditionally when creating web pages, web developers marked up their content and then added interaction by sprinkling on some JavaScript. This worked great when interaction was a nice-to-have on the web. Now it is expected for many sites and all apps. React puts interactivity first while still using the same technology: **a React component is a JavaScript function that you can _sprinkle with markup_.** Here's what that looks like (you can edit the example below):
58+
تقليديًا، عند إنشاء صفحات الويب، يقوم مطورو الويب بترميز المحتوى الخاص بهم ومن ثم يضيفون التفاعل عن طريق إضافة بعض JavaScript. نجح هذا بشكل رائع عندما كان التفاعل مجرد ميزة اضافية جيدة على الويب. الآن يُتوقع وجود التفاعل في العديد من المواقع وجميع التطبيقات. تضع React التفاعلية في المقام الأول مع الاستمرار في استخدام نفس التقنية: **مكوّن React هو دالة JavaScript يمكنك أن تُضف إليها ترميز مرئي.** هنا مثال لذلك (يمكنك تحرير المثال أدناه):
5959

6060
<Sandpack>
6161

@@ -64,7 +64,7 @@ export default function Profile() {
6464
return (
6565
<img
6666
src="https://i.imgur.com/MK3eW3Am.jpg"
67-
alt="Katherine Johnson"
67+
alt="كاثرين جونسون"
6868
/>
6969
)
7070
}
@@ -76,30 +76,30 @@ img { height: 200px; }
7676

7777
</Sandpack>
7878

79-
And here's how to build a component:
79+
وهنا كيفية بناء مكوّن::
8080

81-
### Step 1: Export the component {/*step-1-export-the-component*/}
81+
### خطوة 1: تصدير المكوّن {/*step-1-export-the-component*/}
8282

83-
The `export default` prefix is a [standard JavaScript syntax](https://developer.mozilla.org/docs/web/javascript/reference/statements/export) (not specific to React). It lets you mark the main function in a file so that you can later import it from other files. (More on importing in [Importing and Exporting Components](/learn/importing-and-exporting-components)!)
83+
البادئة `export default` هي جزء من [صيغة JavaScript القياسية](https://developer.mozilla.org/docs/web/javascript/reference/statements/export) (ليست محددة لـ React). تتيح لك وضع علامة على الدالة الرئيسية في ملف بحيث يمكنك استيرادها لاحقًا من ملفات أخرى. (للمزيد عن الاستيراد، راجع موضوع [استيراد وتصدير المكوّنات](/learn/importing-and-exporting-components)!)
8484

85-
### Step 2: Define the function {/*step-2-define-the-function*/}
85+
### خطوة 2: تعريف الدالة {/*step-2-define-the-function*/}
8686

87-
With `function Profile() { }` you define a JavaScript function with the name `Profile`.
87+
باستخدام الدالة `Profile() { }` ، تقوم بتعريف دالة JavaScript بإسم "Profile".
8888

8989
<Pitfall>
9090

91-
React components are regular JavaScript functions, but **their names must start with a capital letter** or they won't work!
91+
مكوّنات React هي عبارة عن دوال JavaScript عادية، ولكن يجب أن يبدأ اسماءها بحرف كبير، وإلا فلن تعمل بشكل صحيح!
9292

9393
</Pitfall>
9494

95-
### Step 3: Add markup {/*step-3-add-markup*/}
95+
### الخطوة 3: اضف الترميز المرئي {/*step-3-add-markup*/}
9696

97-
The component returns an `<img />` tag with `src` and `alt` attributes. `<img />` is written like HTML, but it is actually JavaScript under the hood! This syntax is called [JSX](/learn/writing-markup-with-jsx), and it lets you embed markup inside JavaScript.
97+
يقوم المكوّن بإرجاع عنصر `<img />` مع خواص `src` و `alt`. يتم كتابة `<img />` بنفس طريقة كتابة HTML، ولكنه في الواقع JavaScript تحت الغطاء! يُطلق على هذه الصيغة [JSX](/learn/writing-markup-with-jsx)، وتتيح لك تضمين ترميز مرئي داخل JavaScript.
9898

99-
Return statements can be written all on one line, as in this component:
99+
يمكن كتابة عبارات الإرجاع في سطر واحد، كما في هذا المكوّن:
100100

101101
```js
102-
return <img src="https://i.imgur.com/MK3eW3As.jpg" alt="Katherine Johnson" />;
102+
return <img src="https://i.imgur.com/MK3eW3As.jpg" alt="كاثرين جونسون" />;
103103
```
104104

105105
But if your markup isn't all on the same line as the `return` keyword, you must wrap it in a pair of parentheses:
@@ -234,8 +234,6 @@ You've just gotten your first taste of React! Let's recap some key points.
234234

235235
</Recap>
236236

237-
238-
239237
<Challenges>
240238

241239
#### Export the component {/*export-the-component*/}
@@ -300,7 +298,6 @@ You may get an "Unexpected token" error while trying to fix this. In that case,
300298

301299
</Hint>
302300

303-
304301
<Sandpack>
305302

306303
```js

0 commit comments

Comments
 (0)