From faa17a3e7969bd3fb442fd915adf8dd8c16398d1 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Mon, 14 Oct 2019 17:54:50 +0300 Subject: [PATCH] Schedule component format --- src/components/Schedule.js | 174 ++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/src/components/Schedule.js b/src/components/Schedule.js index 7eba68a2..fc47aa4a 100644 --- a/src/components/Schedule.js +++ b/src/components/Schedule.js @@ -1,7 +1,7 @@ import React from 'react' -const {getDates} = require('../utils/date') -const {shortName} = require('../models/collective') +const { getDates } = require('../utils/date') +const { shortName } = require('../models/collective') const now = new Date() const dates = getDates(now) @@ -11,111 +11,111 @@ const weekDay = weekDayIndex => dates[weekDayIndex] const short = shortName const todayClass = i => isToday(i) - ? 'current' - : '' + ? 'current' + : '' -const HeadDay = ({i, children}) => ( -
-

{children}

-

{weekDay(i)}

-
+const HeadDay = ({ i, children }) => ( +
+

{children}

+

{weekDay(i)}

+
) const days = [ - 'Понедельник', - 'Вторник', - 'Среда', - 'Четверг', - 'Пятница', - 'Суббота', + 'Понедельник', + 'Вторник', + 'Среда', + 'Четверг', + 'Пятница', + 'Суббота', ] -export const Schedule = ({groups}) => ( -
-
-
-
Гр.
+export const Schedule = ({ groups }) => ( +
+
+
+
Гр.
- {days.map((day, index) => ( - {day} - ))} -
+ {days.map((day, index) => ( + {day} + ))} +
- {groups.map((group, index) => ( - - ))} -
-
+ {groups.map((group, index) => ( + + ))} +
+
) -const GroupRow = ({name, time, week}) => ( -
-
-

{name}

-

{time}

-
+const GroupRow = ({ name, time, week }) => ( +
+
+

{name}

+

{time}

+
- {week.map((day, index) => ( - - ))} -
+ {week.map((day, index) => ( + + ))} +
) -const Group = ({day, dayIndex}) => ( -
- {day.map((lesson, index) => ( - - ))} -
+const Group = ({ day, dayIndex }) => ( +
+ {day.map((lesson, index) => ( + + ))} +
) -const Cell = ({course, teacher, time}) => ( -
- - +const Cell = ({ course, teacher, time }) => ( +
+ + - {time - .map(range => ({range})) - .map((range, index) => ( - - ))} -
+ {time + .map(range => ({ range })) + .map((range, index) => ( + + ))} +
) -const Lesson = ({title, url}) => ( -

- {url - ? ( - - {title} - - ) - : ( - - {title} - - ) - } -

+const Lesson = ({ title, url }) => ( +

+ {url + ? ( + + {title} + + ) + : ( + + {title} + + ) + } +

) -const Teacher = ({name, url}) => ( -

- {url - ? ( - - {short(name)} - - ) - : ( - - {short(name)} - - ) - } -

+const Teacher = ({ name, url }) => ( +

+ {url + ? ( + + {short(name)} + + ) + : ( + + {short(name)} + + ) + } +

) -const TimeRange = ({range}) => ( -

{(range || []).join(' — ')}

+const TimeRange = ({ range }) => ( +

{(range || []).join(' — ')}

)