-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathTimetable.tsx
57 lines (50 loc) · 1.26 KB
/
Timetable.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import React, { memo } from 'react';
import MediaQuery from 'react-responsive';
import { Container } from 'react-bootstrap';
import { FaSun } from 'react-icons/fa';
import TimetableHeader from './TimetableHeader';
import TimetableBody from './TimetableBody';
import styles from '../../css/Timetable.module.scss';
const MobileTimetable = memo(() => (
<Container className={styles.timetableContainer}>
<FaSun className={styles.morningIcon} size="2x" color="yellow" />
<table className={styles.timetableA}>
<TimetableHeader isMobile />
<TimetableBody
isMobile
/>
</table>
<FaSun className={styles.eveningIcon} size="2x" />
<table className={styles.timetableB}>
<TimetableHeader isMobile isAfternoon />
<TimetableBody
isMobile
isAfternoon
/>
</table>
</Container>
));
const DesktopTimetable = memo(() => (
<Container className={styles.timetableContainer} fluid>
<table className={styles.timetable}>
<TimetableHeader />
<TimetableBody />
</table>
</Container>
));
const Timetable = memo(() => (
// Media Query for phones
<MediaQuery minDeviceWidth={768}>
{(matches) => {
if (matches) {
return (
<DesktopTimetable />
);
}
return (
<MobileTimetable />
);
}}
</MediaQuery>
));
export default Timetable;