diff --git a/src/pages/course-planner-detail.tsx b/src/pages/course-planner-detail.tsx index 8c706961..b4e677af 100644 --- a/src/pages/course-planner-detail.tsx +++ b/src/pages/course-planner-detail.tsx @@ -1,3 +1,4 @@ +import React, { useState } from 'react'; import Header from '@/components/Header'; import { logEvent } from '@/utils/googleAnalytics'; import ArrowDropUpIcon from '@mui/icons-material/ArrowDropUp'; @@ -21,6 +22,10 @@ const CoursePlannerDetail = () => { const theme = useTheme(); const { t } = useTranslation(); + // State to manage the expanded state of the accordions + const [expanded, setExpanded] = useState(false); + const [allExpanded, setAllExpanded] = useState(false); // New state to track all accordions + const handleBackEvent = () => { window.history.back(); logEvent({ @@ -29,6 +34,23 @@ const CoursePlannerDetail = () => { label: 'Back Button Clicked', }); }; + + const handleAccordionChange = + (panel: string) => (event: React.SyntheticEvent, isExpanded: boolean) => { + if (!allExpanded) { + setExpanded(isExpanded ? panel : false); + } + }; + + const toggleAllAccordions = () => { + if (allExpanded) { + setExpanded(false); + } else { + setExpanded('panel1'); + } + setAllExpanded(!allExpanded); + }; + return ( <>
@@ -37,7 +59,7 @@ const CoursePlannerDetail = () => { display: 'flex', justifyContent: 'left', alignItems: 'center', - color: '#4D4639', + color: theme.palette.warning['A200'], padding: '15px 16px 5px', gap: '15px', }} @@ -101,7 +123,7 @@ const CoursePlannerDetail = () => { color: theme.palette.warning['300'], }} > - Mathematics {/* will come form API */} + Mathematics {/* will come from API */} @@ -123,13 +145,15 @@ const CoursePlannerDetail = () => { fontSize: '12px', fontWeight: '500', color: theme.palette.warning['300'], + cursor: 'pointer', }} + onClick={toggleAllAccordions} > - {t('COURSE_PLANNER.COLLAPSE_ALL')} - Collapse All + {allExpanded ? 'Collapse All' : 'Expand All'} @@ -141,7 +165,8 @@ const CoursePlannerDetail = () => { }} > { py: '10px', px: '16px', background: theme.palette.warning['A400'], + pt: 2, }} > { > JAN - + { + + + + + Irrational Numbers + {/* will came from API */} + + + + JAN + + + + + + + 2 {t('COURSE_PLANNER.RESOURCES')} + + + + +