-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Learning outcomes can now be specified on a `section` using the `learningOutcomes` tag in the `yaml` header. `learningOutcomes` should be a list of strings. These are then rendered in an alert component below the title and before the content. Each learning outcome is prefixed with a 🏆 icon. The list can be minimized by clicking the heading.
- Loading branch information
Showing
3 changed files
with
39 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Section } from "../../lib/material" | ||
import ListItem from "@mui/material/ListItem" | ||
import ListItemText from "@mui/material/ListItemText" | ||
import List from "@mui/material/List" | ||
import Alert from "@mui/material/Alert" | ||
import Typography from "@mui/material/Typography" | ||
import Collapse from "@mui/material/Collapse" | ||
import Tooltip from "@mui/material/Tooltip" | ||
import { HiOutlineTrophy } from "react-icons/hi2"; | ||
import ListItemIcon from "@mui/material/ListItemIcon" | ||
import React from "react" | ||
import { type Theme } from "@mui/system" | ||
|
||
export default function LearningOutcomes ({learningOutcomes}: {learningOutcomes: Section["learningOutcomes"]}) { | ||
const [open, setOpen] = React.useState(true) | ||
if (learningOutcomes.length === 0) | ||
return null | ||
return <Alert severity="success" sx={{marginBottom: (t: Theme) => t.spacing(1)}}> | ||
<Tooltip title={`Click to ${open? "hide" : "show"} learning outcomes`}> | ||
<Typography variant="body2" onClick={() => setOpen(!open)} sx={{cursor: "pointer"}}> | ||
Learning outcomes | ||
</Typography> | ||
</Tooltip> | ||
<Collapse in={open}> | ||
<List> | ||
{learningOutcomes.map((o, i) => <ListItem key={i}> | ||
<ListItemIcon><HiOutlineTrophy /></ListItemIcon> | ||
<ListItemText>{o}</ListItemText> | ||
</ListItem>)} | ||
</List> | ||
</Collapse> | ||
</Alert> | ||
} |
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