commit eacd641583bba55fe4cf8197883a7f0308349a81
parent 9927e6c6e7b90ad88523ac21ce5c455283ece926
Author: Yuukin256 <52195426+Yuukin256@users.noreply.github.com>
Date: Sat, 8 Jun 2024 21:46:43 +0900
授業がない時間の背景に色をつけないように変更 (#69)
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/client/features/daily/components/Lessons/Lesson.tsx b/src/client/features/daily/components/Lessons/Lesson.tsx
@@ -1,7 +1,7 @@
import { useDisclosure } from '@mantine/hooks';
import CommentIcon from '@mui/icons-material/CommentOutlined';
import { Button } from '@mui/material';
-import { alpha, styled } from '@mui/material/styles';
+import { alpha, styled, useTheme } from '@mui/material/styles';
import { useAtomValue } from 'jotai';
import useMySubject from 'client/hooks/useMySubject';
@@ -68,6 +68,12 @@ export default function Lesson({ date, period, courses, basis }: Props) {
});
const [note, setNote] = useNote({ gradeClass, date, period });
+ const theme = useTheme();
+ const bgColor =
+ theme.palette.mode === 'light'
+ ? alpha(theme.palette.primary.main, 0.15)
+ : alpha(theme.palette.primary.dark, 0.4);
+
return (
<ListItem>
<Button
@@ -78,10 +84,7 @@ export default function Lesson({ date, period, courses, basis }: Props) {
textAlign: 'left',
fontWeight: 'unset',
color: 'unset',
- backgroundColor:
- theme.palette.mode === 'light'
- ? alpha(theme.palette.primary.main, 0.15)
- : alpha(theme.palette.primary.dark, 0.4),
+ backgroundColor: courses.length ? bgColor : 'inherit',
width: '100%',
textTransform: 'none',
flexDirection: 'row',