-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combined new navbar with timetable. Route: /combined
- Loading branch information
1 parent
f40e276
commit a0c6402
Showing
5 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React, { useContext, useState } from "react"; | ||
import OldNavBar from "../Components/NavBar/OldNavBar"; | ||
import OldTimetable from "../Components/Timetable/OldTimetable"; | ||
import { styled } from "@mui/material/styles"; | ||
import { useImmer } from "use-immer"; | ||
import { Box } from "@mui/material"; | ||
|
||
import { TimetableResponse } from "../../backend/api/routes/responseTypes"; | ||
import { DrawerHeader, DrawerRight } from "../Components/Sidebar/Drawer"; | ||
import { NavBar } from "../Components"; | ||
import { TimetableDataContext } from "../context/TimetableDataContext"; | ||
|
||
const drawerwidth = 300; | ||
|
||
const Main = styled("main", { shouldForwardProp: (prop) => prop !== "drawerState" })<{ | ||
drawerState?: boolean; | ||
drawerwidth: number; | ||
}>(({ theme, drawerState, drawerwidth }) => ({ | ||
flexGrow: 1, | ||
padding: theme.spacing(3), | ||
transition: theme.transitions.create("margin", { | ||
easing: theme.transitions.easing.sharp, | ||
duration: theme.transitions.duration.leavingScreen, | ||
}), | ||
marginRight: -drawerwidth, | ||
...(drawerState && { | ||
transition: theme.transitions.create("margin", { | ||
easing: theme.transitions.easing.easeOut, | ||
duration: theme.transitions.duration.enteringScreen, | ||
}), | ||
marginRight: 0, | ||
}), | ||
/** | ||
* This is necessary to enable the selection of content. In the DOM, the stacking order is determined | ||
* by the order of appearance. Following this rule, elements appearing later in the markup will overlay | ||
* those that appear earlier. Since the Drawer comes after the Main content, this adjustment ensures | ||
* proper interaction with the underlying content. | ||
*/ | ||
position: "relative", | ||
})); | ||
|
||
export default function TimetableCombined() { | ||
const [drawerState, setDrawerState] = useState(false); | ||
const [selectedSlotIndex, setSelectedSlotIndex] = useState<number | null>(null); | ||
const { timetable, setTimetable } = useContext(TimetableDataContext); | ||
const handleDrawerOpen = () => { | ||
setDrawerState(true); | ||
}; | ||
|
||
const handleDrawerClose = () => { | ||
setDrawerState(false); | ||
}; | ||
|
||
return ( | ||
<> | ||
<Box sx={{ display: "flex" }}> | ||
<NavBar /> | ||
|
||
<Main drawerState={drawerState} drawerwidth={drawerwidth}> | ||
<DrawerHeader /> | ||
<OldTimetable | ||
timetableData={timetable.available ? timetable.timetableData : null} | ||
handleDrawerOpen={handleDrawerOpen} | ||
setSelectedSlotIndex={setSelectedSlotIndex} | ||
/> | ||
</Main> | ||
<DrawerRight | ||
setTimetable={setTimetable} | ||
drawerwidth={drawerwidth} | ||
handleDrawerClose={handleDrawerClose} | ||
setSelectedSlotIndex={setSelectedSlotIndex} | ||
drawerState={drawerState} | ||
selectedSlotIndex={selectedSlotIndex} | ||
timetableData={timetable.available ? timetable.timetableData : null} | ||
/> | ||
</Box> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters