Skip to content

Commit

Permalink
[Students] Add better styles to study rights table
Browse files Browse the repository at this point in the history
  • Loading branch information
valtterikantanen committed Jan 2, 2025
1 parent 23b1a02 commit 42409d5
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FilterAlt as FilterAltIcon, NorthEast as NorthEastIcon } from '@mui/icons-material'
import { TableBody, TableCell, TableHead, TableRow, Tooltip, IconButton, Stack } from '@mui/material'
import { blue } from '@mui/material/colors'
import { orderBy } from 'lodash'
import moment from 'moment'
import { Link } from 'react-router'
Expand Down Expand Up @@ -120,7 +121,13 @@ export const StudyrightsTable = ({ handleStudyPlanChange, student, selectedStudy
<TableCell>Completed</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableBody
sx={{
'& .MuiTableRow-root:hover': {
backgroundColor: 'inherit',
},
}}
>
{studyRightRows.map(studyRight => {
const numberOfProgrammes = studyRight.programmes.length
const rowIsFilterable = studyRight.studyPlanId != null
Expand All @@ -129,20 +136,14 @@ export const StudyrightsTable = ({ handleStudyPlanChange, student, selectedStudy
const isFirstRow = index === 0
const isLastRow = index === numberOfProgrammes - 1

let borderWidth = '1px'
if (isFirstRow && numberOfProgrammes > 1) {
borderWidth = '1px 1px 0 1px'
} else if (isLastRow && numberOfProgrammes > 1) {
borderWidth = '0 1px 1px 1px'
}

return (
<TableRow
key={`${studyRight.key}-${code}`}
onClick={() => (rowIsFilterable ? handleStudyPlanChange(studyRight.studyPlanId) : null)}
style={{
cursor: rowIsFilterable ? 'pointer' : 'not-allowed',
borderWidth,
borderWidth: `0 1px ${isLastRow ? '1px' : '0'} 1px`, // Bottom border only for the last programme in the study right
backgroundColor: studyRight.studyPlanId === selectedStudyPlanId ? blue[50] : 'inherit',
}}
>
{isFirstRow && (
Expand Down

0 comments on commit 42409d5

Please sign in to comment.