-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSemester.jsx
More file actions
152 lines (146 loc) · 4.75 KB
/
Semester.jsx
File metadata and controls
152 lines (146 loc) · 4.75 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import { useState } from 'react'
import { makeStyles, withStyles } from '@material-ui/core/styles'
import Accordion from '@material-ui/core/Accordion'
import AccordionDetails from '@material-ui/core/AccordionDetails'
import AccordionSummary from '@material-ui/core/AccordionSummary'
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
import Table from '@material-ui/core/Table'
import TableBody from '@material-ui/core/TableBody'
import TableCell from '@material-ui/core/TableCell'
import TableHead from '@material-ui/core/TableHead'
import TableRow from '@material-ui/core/TableRow'
import Typography from '@material-ui/core/Typography'
import { lightBlue } from '@material-ui/core/colors'
const StyledTableCell = withStyles((theme) => ({
head: {
backgroundColor: theme.palette.secondary.main,
color: theme.palette.common.white
},
root: {
borderBottom: 0
}
}))(TableCell)
const StyledTableRow = withStyles((theme) => ({
root: {
'&:nth-of-type(even)': {
backgroundColor:
theme.palette.type === 'light'
? lightBlue[50]
: theme.palette.primary.light
},
'&:nth-of-type(odd)': {
backgroundColor:
theme.palette.type === 'light'
? lightBlue[100]
: theme.palette.primary.level3
}
}
}))(TableRow)
const useStyles = makeStyles((theme) => ({
icon: {
color: theme.palette.common.white
},
root: {
width: '100%'
},
summary: {
backgroundColor: theme.palette.primary.dark,
color: theme.palette.common.white
}
}))
export default function Semester(props) {
const classes = useStyles()
const { semester } = props
const { rows } = props
const [expanded, setExpanded] = useState(false)
const handleChange = (panel) => (event, newExpanded) => {
setExpanded(newExpanded ? panel : false)
}
return (
<div className={classes.root}>
<Accordion
className={classes.summary}
expanded={expanded === `panel${semester}`}
onChange={handleChange(`panel${semester}`)}
>
<AccordionSummary
aria-controls="panel-content"
expandIcon={<ExpandMoreIcon className={classes.icon} />}
id="panel1d-header"
>
<Typography>
Εξάμηνο
{semester}
</Typography>
</AccordionSummary>
<AccordionDetails
style={{ overflowX: 'auto', overflowY: 'hidden', padding: 0 }}
>
<Table>
<TableHead>
<TableRow>
<StyledTableCell
align="center"
rowSpan="2"
style={{ minWidth: '16px', width: '32px' }}
>
Κωδ.
</StyledTableCell>
<StyledTableCell rowSpan="2" style={{ minWidth: '10rem' }}>
Τίτλος
</StyledTableCell>
<StyledTableCell
align="center"
rowSpan="2"
style={{ minWidth: '16px', width: '32px' }}
>
Είδος
</StyledTableCell>
<StyledTableCell
align="center"
colSpan="2"
style={{
borderBottom: '1px solid rgba(224, 224, 224, 1)',
minWidth: '16px',
width: '32px'
}}
>
Ώρες
</StyledTableCell>
<StyledTableCell
align="center"
rowSpan="2"
style={{ minWidth: '16px', width: '32px' }}
>
Π.Μ.
</StyledTableCell>
</TableRow>
<TableRow>
<StyledTableCell align="center">Θ</StyledTableCell>
<StyledTableCell align="center">Ε</StyledTableCell>
</TableRow>
</TableHead>
<TableBody>
{rows.map((row) => (
<StyledTableRow key={row._id}>
<StyledTableCell align="center">
{row.lessonCode}
</StyledTableCell>
<StyledTableCell align="left">{row.name}</StyledTableCell>
<StyledTableCell align="center">{row.type}</StyledTableCell>
<StyledTableCell align="center">
{row.hoursTheory}
</StyledTableCell>
<StyledTableCell align="center">
{row.hoursLab}
</StyledTableCell>
<StyledTableCell align="center">{row.credit}</StyledTableCell>
</StyledTableRow>
))}
</TableBody>
</Table>
</AccordionDetails>
</Accordion>
</div>
)
}