-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSemester.js
More file actions
106 lines (100 loc) · 4.08 KB
/
Semester.js
File metadata and controls
106 lines (100 loc) · 4.08 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
import { useState } from 'react'
import { withStyles, makeStyles } from '@material-ui/core/styles'
import Typography from '@material-ui/core/Typography'
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 ExpansionPanel from '@material-ui/core/ExpansionPanel'
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'
import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
import { lightBlue } from '@material-ui/core/colors'
const StyledTableCell = withStyles(theme => ({
root: {
borderBottom: 0
},
head: {
backgroundColor: theme.palette.secondary.main,
color: theme.palette.common.white
}
}))(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 => ({
root: {
width: '100%'
},
icon: {
color: theme.palette.common.white
},
summary: {
backgroundColor: theme.palette.primary.dark,
color: theme.palette.common.white
}
}))
export default function (props) {
const classes = useStyles()
const semester = props.semester
const rows = props.rows
const [expanded, setExpanded] = useState(false)
const handleChange = panel => (event, newExpanded) => {
setExpanded(newExpanded ? panel : false)
}
return (
<div className={classes.root}>
<ExpansionPanel
className={classes.summary}
expanded={expanded === ('panel' + semester)}
onChange={handleChange('panel' + semester)}
TransitionProps={{ unmountOnExit: true }}
>
<ExpansionPanelSummary
expandIcon={<ExpandMoreIcon className={classes.icon} />}
aria-controls='panel-content'
id='panel1d-header'
>
<Typography>Εξάμηνο {semester}</Typography>
</ExpansionPanelSummary>
<ExpansionPanelDetails style={{ padding: 0, overflowX: 'auto', overflowY: 'hidden' }}>
<Table>
<TableHead>
<TableRow>
<StyledTableCell rowSpan='2' style={{ minWidth: '16px', width: '32px' }} align='center'>Κωδ.</StyledTableCell>
<StyledTableCell rowSpan='2' style={{ minWidth: '10rem' }}>Τίτλος</StyledTableCell>
<StyledTableCell rowSpan='2' style={{ minWidth: '16px', width: '32px' }} align='center'>Είδος</StyledTableCell>
<StyledTableCell colSpan='2' style={{ minWidth: '16px', width: '32px', borderBottom: '1px solid rgba(224, 224, 224, 1)' }} align='center'>Ώρες</StyledTableCell>
<StyledTableCell rowSpan='2' style={{ minWidth: '16px', width: '32px' }} align='center'>Π.Μ.</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>
</ExpansionPanelDetails>
</ExpansionPanel>
</div>
)
}