|
| 1 | +# التقويم الكبير لرياكت |
| 2 | + |
| 3 | +تم بناء مكون تقويم الفعاليات هذا لرياكت وتصميمه للمتصفحات الحديثة (والتي لا تحظى بدعم كامل من قبل المتصفحات القديمة، خصوصًا متصفح الانترنت)، ويستخدم Flexbox بدلاً من الطريقة التقليدية باستخدام الجداول. |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | + <img src="../assets/rbc-demo.gif" alt="Big Calendar Demo Image" /> |
| 7 | +</p> |
| 8 | + |
| 9 | +[**عرض التجربة والمستندات**](https://jquense.github.io/react-big-calendar/examples/index.html) |
| 10 | + |
| 11 | +مستوحى من [Full Calendar](http://fullcalendar.io/). |
| 12 | + |
| 13 | +## الاستخدام والإعداد |
| 14 | + |
| 15 | +`yarn add react-big-calendar` أو `npm install --save react-big-calendar` |
| 16 | + |
| 17 | +قم بتضمين `react-big-calendar/lib/css/react-big-calendar.css` للأنماط، وتأكد من أن عنصر حاوية التقويم لديك |
| 18 | +له ارتفاع، أو لن يظهر التقويم. لتوفير تصميم مخصص خاص بك، انظر إلى [التصميم المخصص](#custom-styling). |
| 19 | + |
| 20 | +## البدء |
| 21 | + |
| 22 | +- [react-big-calendar](https://github.com/arecvlohe/rbc-starter) |
| 23 | +- [react-big-calendar مع السحب والإفلات](https://github.com/arecvlohe/rbc-with-dnd-starter) |
| 24 | +- [react-big-calendar مع TypeScript و React hooks مدمج مع Vite](https://github.com/christopher-caldwell/react-big-calendar-demo) |
| 25 | + |
| 26 | +## تشغيل الأمثلة محلياً |
| 27 | + |
| 28 | +```sh |
| 29 | +$ git clone [email protected]:jquense/react-big-calendar.git |
| 30 | +$ cd react-big-calendar |
| 31 | +$ yarn |
| 32 | +$ yarn storybook |
| 33 | +``` |
| 34 | + |
| 35 | +- افتح [localhost:3000/examples/index.html](http://localhost:3000/examples/index.html). |
| 36 | + |
| 37 | +### التعريب وتنسيق التاريخ |
| 38 | + |
| 39 | +يشمل `react-big-calendar` أربع خيارات لمعالجة تنسيق التاريخ والتعريب الثقافي، اعتمادًا |
| 40 | +على تفضيلك لمكتبات DateTime. يمكنك استخدام إما [Moment.js](https://momentjs.com/)، [Globalize.js](https://github.com/jquery/globalize)، [date-fns](https://date-fns.org/)، [Day.js](https://day.js.org) localizers. |
| 41 | + |
| 42 | +بغض النظر عن اختيارك، يجب أن تختار **بالتأكيد** معربًا لاستخدام هذه المكتبة: |
| 43 | + |
| 44 | +#### Moment.js |
| 45 | + |
| 46 | +```js |
| 47 | +import { Calendar, momentLocalizer } from 'react-big-calendar' |
| 48 | +import moment from 'moment' |
| 49 | + |
| 50 | +const localizer = momentLocalizer(moment) |
| 51 | + |
| 52 | +const MyCalendar = (props) => ( |
| 53 | + <div> |
| 54 | + <Calendar |
| 55 | + localizer={localizer} |
| 56 | + events={myEventsList} |
| 57 | + startAccessor="start" |
| 58 | + endAccessor="end" |
| 59 | + style={{ height: 500 }} |
| 60 | + /> |
| 61 | + </div> |
| 62 | +) |
| 63 | +``` |
| 64 | + |
| 65 | +#### Globalize.js v0.1.1 |
| 66 | + |
| 67 | +```js |
| 68 | +import { Calendar, globalizeLocalizer } from 'react-big-calendar' |
| 69 | +import globalize from 'globalize' |
| 70 | + |
| 71 | +const localizer = globalizeLocalizer(globalize) |
| 72 | + |
| 73 | +const MyCalendar = (props) => ( |
| 74 | + <div> |
| 75 | + <Calendar |
| 76 | + localizer={localizer} |
| 77 | + events={myEventsList} |
| 78 | + startAccessor="start" |
| 79 | + endAccessor="end" |
| 80 | + style={{ height: 500 }} |
| 81 | + /> |
| 82 | + </div> |
| 83 | +) |
| 84 | +``` |
| 85 | + |
| 86 | +#### date-fns v2 |
| 87 | + |
| 88 | +```js |
| 89 | +import { Calendar, dateFnsLocalizer } from 'react-big-calendar' |
| 90 | +import format from 'date-fns/format' |
| 91 | +import parse from 'date-fns/parse' |
| 92 | +import startOfWeek from 'date-fns/startOfWeek' |
| 93 | +import getDay from 'date-fns/getDay' |
| 94 | +import enUS from 'date-fns/locale/en-US' |
| 95 | + |
| 96 | +const locales = { |
| 97 | + 'en-US': enUS, |
| 98 | +} |
| 99 | + |
| 100 | +const localizer = dateFnsLocalizer({ |
| 101 | + format, |
| 102 | + parse, |
| 103 | + startOfWeek, |
| 104 | + getDay, |
| 105 | + locales, |
| 106 | +}) |
| 107 | + |
| 108 | +const MyCalendar = (props) => ( |
| 109 | + <div> |
| 110 | + <Calendar |
| 111 | + localizer={localizer} |
| 112 | + events={myEventsList} |
| 113 | + startAccessor="start" |
| 114 | + endAccessor="end" |
| 115 | + style={{ height: 500 }} |
| 116 | + /> |
| 117 | + </div> |
| 118 | +) |
| 119 | +``` |
| 120 | + |
| 121 | +#### Day.js |
| 122 | + |
| 123 | +يرجى ملاحظة أن dayjsLocalizer يوسع Day.js بالإضافات التالية: |
| 124 | + |
| 125 | +- [IsBetween](https://day.js.org/docs/en/plugin/is-between) |
| 126 | +- [IsSameOrAfter](https://day.js.org/docs/en/plugin/is-same-or-after) |
| 127 | +- [IsSameOrBefore](https://day.js.org/docs/en/plugin/is-same-or-before) |
| 128 | +- [LocaleData](https://day.js.org/docs/en/plugin/locale-data) |
| 129 | +- [LocalizedFormat](https://day.js.org/docs/en/plugin/localized-format) |
| 130 | +- [MinMax](https://day.js.org/docs/en/plugin/min-max) |
| 131 | +- [UTC](https://day.js.org/docs/en/plugin/utc) |
| 132 | + |
| 133 | +```js |
| 134 | +import { Calendar, dayjsLocalizer } from 'react-big-calendar' |
| 135 | +import dayjs from 'dayjs' |
| 136 | + |
| 137 | +const localizer = dayjsLocalizer(dayjs) |
| 138 | + |
| 139 | +const MyCalendar = (props) => ( |
| 140 | + <div> |
| 141 | + <Calendar |
| 142 | + localizer={localizer} |
| 143 | + events={myEventsList} |
| 144 | + startAccessor="start" |
| 145 | + endAccessor="end" |
| 146 | + style={{ height: 500 }} |
| 147 | + /> |
| 148 | + </div> |
| 149 | +) |
| 150 | +``` |
| 151 | + |
| 152 | +## التصميم المخصص |
| 153 | + |
| 154 | +بشكل افتراضي، يمكنك تضمين ملفات CSS المترجمة والبدء في العمل. ولكن في بعض الأحيان، قد ترغب في تخصيص |
| 155 | +التقويم الكبير ليتناسب مع تصميم التطبيق الخاص بك. لهذا السبب، تم تضمين ملفات SASS مع التقويم الكبير. |
| 156 | + |
| 157 | +``` |
| 158 | + @import 'react-big-calendar/lib/sass/styles'; |
| 159 | + @import 'react-big-calendar/lib/addons/dragAndDrop/styles'; // if using DnD |
| 160 | +``` |
| 161 | + |
| 162 | +توفر مكتبة SASS ملف `variables` يحتوي على متغيرات الألوان والأبعاد التي يمكنك تحديثها لتتناسب مع تطبيقك. _ملحوظة:_ يمكن أن يؤدي تغيير و/أو تجاوز الأنماط إلى حدوث مشكلات في التقديم مع تقويمك الكبير. قم بإجراء اختبارات دقيقة لكل تغيير وفقًا لذلك. |
| 163 | + |
| 164 | +## انضم إلى المجتمع |
| 165 | + |
| 166 | +ساعدنا في تحسين التقويم الكبير! انضم إلينا على [Slack](https://join.slack.com/t/bigcalendar/shared_invite/zt-2fapdf4pj-oEF51KD2XgHKudkXEhk2lQ). |
| 167 | +(تنتهي روابط الدعوة إلى Slack. إذا لم تتمكن من الانضمام، فقط قدم تقريرًا عن المشكلة وسنحصل على رابط جديد.) |
0 commit comments