-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
d4554d6
commit 24982ef
Showing
8 changed files
with
326 additions
and
10 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
94 changes: 94 additions & 0 deletions
94
components/Profile/ParentProfile/StudentClasses.module.css
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,94 @@ | ||
.spacer { | ||
height: 30px; | ||
} | ||
|
||
.accordion { | ||
height: 100%; | ||
font-family: "Inter"; | ||
font-style: normal; | ||
font-weight: 700; | ||
font-size: 24px; | ||
line-height: 29px; | ||
padding: 1em 1.5em; | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
color: #000000; | ||
} | ||
|
||
.item { | ||
font-weight: 600; | ||
font-size: 18px; | ||
line-height: 22px; | ||
background: #f3f3f3; | ||
} | ||
|
||
.item + .item { | ||
margin-top: 2em; | ||
border-top: 1px solid rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.button { | ||
cursor: pointer; | ||
padding: 18px; | ||
width: 100%; | ||
text-align: left; | ||
border: none; | ||
outline: none; | ||
border-radius: 8px; | ||
box-shadow: 0px 5px 10px -11px; | ||
} | ||
|
||
.button:hover { | ||
background-color: #ddd; | ||
} | ||
|
||
.button:before { | ||
float: right; | ||
content: "▼"; | ||
height: 10px; | ||
width: 10px; | ||
margin-right: 12px; | ||
} | ||
|
||
.button[aria-expanded="true"]::before, | ||
.button[aria-selected="true"]::before { | ||
margin-top: 12px; | ||
margin-right: 4px; | ||
transform: rotate(180deg); | ||
} | ||
|
||
.panel { | ||
font-size: 15px; | ||
line-height: 18px; | ||
padding: 20px; | ||
animation: fadein 0.35s ease-in; | ||
border-radius: 0px 0px 8px 8px; | ||
} | ||
|
||
.panel a { | ||
color: blue; | ||
} | ||
|
||
/* -------------------------------------------------- */ | ||
/* ---------------- Animation part ------------------ */ | ||
/* -------------------------------------------------- */ | ||
|
||
@keyframes fadein { | ||
0% { | ||
opacity: 0; | ||
} | ||
|
||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
.info { | ||
display: inline-block; | ||
vertical-align: super; | ||
margin-bottom: 25px; | ||
} | ||
|
||
.info:last-child { | ||
margin-bottom: 0px; | ||
} |
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,89 @@ | ||
import { Class } from "../../../models/"; | ||
import { APIContext } from "../../../context/APIContext"; | ||
import styles from "./StudentClasses.module.css"; | ||
import React, { useContext, useEffect, useState } from "react"; | ||
import RRule from "rrule"; | ||
import { DateTime } from "luxon"; | ||
import { | ||
Accordion, | ||
AccordionItem, | ||
AccordionItemHeading, | ||
AccordionItemButton, | ||
AccordionItemPanel, | ||
} from "react-accessible-accordion"; | ||
import AccessTime from "@mui/icons-material/AccessTime"; | ||
import CalendarMonth from "@mui/icons-material/CalendarMonth"; | ||
import School from "@mui/icons-material/School"; | ||
|
||
type StudentClassesProps = { | ||
id: string; | ||
}; | ||
|
||
const StudentClasses: React.FC<StudentClassesProps> = ({ id }) => { | ||
const api = useContext(APIContext); | ||
const [classes, setClasses] = useState<Class[]>([]); | ||
|
||
useEffect(() => { | ||
(async () => { | ||
await getClasses(); | ||
})(); | ||
}, [id]); | ||
|
||
const getClasses = async (): Promise<void> => { | ||
if (id) { | ||
const classesByUser = await api.getClassesByUser(id); | ||
setClasses(classesByUser); | ||
} else { | ||
setClasses([]); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<Accordion className={styles.accordion} allowMultipleExpanded={true} allowZeroExpanded={true}> | ||
Classes | ||
<div className={styles.spacer} /> | ||
{classes.map((Class) => ( | ||
<AccordionItem className={styles.item} key={Class.eventInformationId + id}> | ||
<AccordionItemHeading> | ||
<AccordionItemButton className={styles.button}> | ||
{Class.name}{" "} | ||
{Class.minLevel == Class.maxLevel | ||
? Class.minLevel | ||
: Class.minLevel + "-" + Class.maxLevel} | ||
</AccordionItemButton> | ||
</AccordionItemHeading> | ||
<AccordionItemPanel className={styles.panel}> | ||
<AccessTime />{" "} | ||
<div className={styles.info}> | ||
{DateTime.fromFormat(Class.startTime, "HH:mm:ss.SSSZZ").toFormat("t") + | ||
" - " + | ||
DateTime.fromFormat(Class.endTime, "HH:mm:ss.SSSZZ").toFormat("t")} | ||
</div> | ||
<br /> | ||
<CalendarMonth />{" "} | ||
<div className={styles.info}> | ||
{ | ||
// Capitalize the first letter of the sentence | ||
RRule.fromString(Class.rrstring).toText().charAt(0).toUpperCase() + | ||
RRule.fromString(Class.rrstring).toText().slice(1) + | ||
", start " + | ||
DateTime.fromJSDate(RRule.fromString(Class.rrstring).options.dtstart).toFormat( | ||
"DDD" | ||
) | ||
} | ||
</div> | ||
<br /> | ||
<School />{" "} | ||
<div className={styles.info}> | ||
<a href={"/class/" + Class.eventInformationId}>Class Link</a> | ||
</div> | ||
</AccordionItemPanel> | ||
</AccordionItem> | ||
))} | ||
</Accordion> | ||
</> | ||
); | ||
}; | ||
|
||
export { StudentClasses }; |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.