Skip to content

Commit 548bb37

Browse files
committed
Add HomepagePhy changes to new branch
1 parent 1c8294c commit 548bb37

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/app/components/site/phy/HomepagePhy.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import {Button, Col, Container, Row} from "reactstrap";
55
import {NewsCarousel} from "../../elements/NewsCarousel";
66
import {above, SITE_TITLE, useDeviceSize, useUserConsent} from "../../../services";
77
import {HomepageYoutubeCookieHandler} from "../../handlers/InterstitialCookieHandler";
8+
import { ListViewCardProps, ListViewCards } from "../../elements/list-groups/ListView";
9+
import { ShortcutResponse, Subject } from "../../../../IsaacAppTypes";
10+
import { ListViewTagProps } from "../../elements/list-groups/AbstractListViewItem";
811
import { StudentDashboard } from "../../elements/StudentDashboard";
912

1013
export const HomepagePhy = () => {
@@ -13,6 +16,31 @@ export const HomepagePhy = () => {
1316
const user = useAppSelector(selectors.user.orNull);
1417
const deviceSize = useDeviceSize();
1518
const userConsent = useUserConsent();
19+
const subjectList: Subject[] = ["physics","maths","chemistry","biology"];
20+
const subjectTags: { [key in Subject]: ListViewTagProps[] } = {
21+
physics: [{tag: "11-14", url: "physics/11_14"}, {tag: "GCSE", url: "physics/gcse"}, {tag: "A-Level", url: "physics/a_level"}, {tag: "University", url: "physics/university"}],
22+
maths: [{tag: "GCSE", url: "maths/gcse"}, {tag: "A-Level", url: "maths/a_level"}, {tag: "University", url: "maths/university"}],
23+
chemistry: [{tag: "GCSE", url: "chemistry/gcse"}, {tag: "A-Level", url: "chemistry/a_level"}],
24+
biology: [{tag: "A-Level", url: "biology/a_level"}],
25+
};
26+
27+
const getListViewSubjectCard = ({subject}: {subject: Subject}) => {
28+
const item: ShortcutResponse = {
29+
title: subject.charAt(0).toUpperCase() + subject.slice(1),
30+
subtitle: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris faucibus est vulputate augue tristique, sed vehicula turpis pellentesque.",
31+
};
32+
33+
const listViewSubjectCard: ListViewCardProps = {
34+
item: item,
35+
icon: {type: "img", icon: `/assets/phy/icons/redesign/subject-${subject}.svg`},
36+
subject: subject,
37+
tagList: subjectTags[subject],
38+
};
39+
40+
return listViewSubjectCard;
41+
};
42+
43+
const cards = subjectList.map((subject: Subject) => getListViewSubjectCard({subject}));
1644

1745
return <>
1846
{/*<WarningBanner/>*/}
@@ -86,6 +114,13 @@ export const HomepagePhy = () => {
86114
</Container>
87115
</section>
88116

117+
<section id="navigation-cards">
118+
<Container>
119+
<h2>Explore and learn!</h2>
120+
<ListViewCards cards={cards}/>
121+
</Container>
122+
</section>
123+
89124
<section id="news">
90125
<Container>
91126
<div className="h-underline mb-4 mt-4 pt-2 mt-sm-5 pt-sm-0 d-flex align-items-center">

0 commit comments

Comments
 (0)