|
1 | 1 | ---
|
2 | 2 | id: faq-styling
|
3 |
| -title: Styling and CSS |
| 3 | +title: التنسيق واستخدام CSS |
4 | 4 | permalink: docs/faq-styling.html
|
5 | 5 | layout: docs
|
6 | 6 | category: FAQ
|
7 | 7 | ---
|
| 8 | + |
| 9 | +### كيف أُضيف أصناف CSS إلى المكوّنات؟ {#how-do-i-add-css-classes-to-components} |
8 | 10 |
|
9 |
| -### How do I add CSS classes to components? {#how-do-i-add-css-classes-to-components} |
10 |
| - |
11 |
| -Pass a string as the `className` prop: |
| 11 | +مرِّر سلسلة نصيّة إلى خاصيّة اسم الصنف `className` : |
12 | 12 |
|
13 | 13 | ```jsx
|
14 | 14 | render() {
|
15 |
| - return <span className="menu navigation-menu">Menu</span> |
| 15 | + return <span className="menu navigation-menu">القائمة</span> |
16 | 16 | }
|
17 | 17 | ```
|
18 | 18 |
|
19 |
| -It is common for CSS classes to depend on the component props or state: |
| 19 | +من الشائع أن تعتمد أصناف CSS على خاصيّات أو حالة المكوّنات : |
20 | 20 |
|
21 | 21 | ```jsx
|
22 | 22 | render() {
|
23 | 23 | let className = 'menu';
|
24 | 24 | if (this.props.isActive) {
|
25 | 25 | className += ' menu-active';
|
26 | 26 | }
|
27 |
| - return <span className={className}>Menu</span> |
| 27 | + return <span className={className}>القائمة</span> |
28 | 28 | }
|
29 | 29 | ```
|
30 | 30 |
|
31 |
| ->Tip |
| 31 | +>ملاحظة |
32 | 32 | >
|
33 |
| ->If you often find yourself writing code like this, [classnames](https://www.npmjs.com/package/classnames#usage-with-reactjs) package can simplify it. |
| 33 | +>إن وجدت نفسك تكتب شيفرة مثل هذه، فتستطيع الحزمة, [classnames](https://www.npmjs.com/package/classnames#usage-with-reactjs) تبسيطها لك. |
34 | 34 |
|
35 |
| -### Can I use inline styles? {#can-i-use-inline-styles} |
| 35 | +### هل أستطيع استخدام التنسيقات السطرية (inline)؟ {#can-i-use-inline-styles} |
36 | 36 |
|
37 |
| -Yes, see the docs on styling [here](/docs/dom-elements.html#style). |
| 37 | +نعم، انظر إلى هذا التوثيق حول التنسيق [من هنا](/docs/dom-elements.html#style). |
38 | 38 |
|
39 |
| -### Are inline styles bad? {#are-inline-styles-bad} |
| 39 | +### هل التنسيقات السطرية سيئة؟ {#are-inline-styles-bad} |
40 | 40 |
|
41 |
| -CSS classes are generally better for performance than inline styles. |
| 41 | +تكون أصناف CSS أفضل بشكل عام للأداء من التنسيقات السطرية. |
42 | 42 |
|
43 |
| -### What is CSS-in-JS? {#what-is-css-in-js} |
| 43 | +### ماذا يعني المصطلح CSS-in-JS? {#what-is-css-in-js} |
44 | 44 |
|
45 |
| -"CSS-in-JS" refers to a pattern where CSS is composed using JavaScript instead of defined in external files. Read a comparison of CSS-in-JS libraries [here](https://github.com/MicheleBertoli/css-in-js). |
| 45 | +يُشير المصطلح CSS-in-JS إلى النمط الذي تُركَّب فيه CSS باستخدام JavaScript بدلًا من تعريفها في الملفّات الخارجيّة. اقرأ [من هنا ](https://github.com/MicheleBertoli/css-in-js) مقارنة بين مكتبات CSS-in-JS. |
46 | 46 |
|
47 |
| -_Note that this functionality is not a part of React, but provided by third-party libraries._ React does not have an opinion about how styles are defined; if in doubt, a good starting point is to define your styles in a separate `*.css` file as usual and refer to them using [`className`](/docs/dom-elements.html#classname). |
| 47 | +لاحظ أنّ هذه الوظيفة ليست جزءًا من React ولكن تُزوّدنا بها مكتبات الطرف الثالث. ليس هناك رأي محدّد لمكتبة React حول كيفيّة تعريف التنسيقات. إن كنت مترددًا فأفضل نقطة للبدء هي تعريف تنسيقاتك في ملف *.css منفصل كالعادة والإشارة إليها باستخدام الخاصيّة [`className`](/docs/dom-elements.html#classname). |
48 | 48 |
|
49 |
| -### Can I do animations in React? {#can-i-do-animations-in-react} |
| 49 | +### هل بإمكاني إجراء تحريك في React؟ {#can-i-do-animations-in-react} |
50 | 50 |
|
51 |
| -React can be used to power animations. See [React Transition Group](https://reactcommunity.org/react-transition-group/) and [React Motion](https://github.com/chenglou/react-motion), for example. |
| 51 | +يُمكِن استخدام React لدعم التحريك. انظر إلى مكتبة [React Transition Group](https://reactcommunity.org/react-transition-group/) ومكتبة [React Motion](https://github.com/chenglou/react-motion), على سبيل المثال. |
0 commit comments