Skip to content

Commit ad0812d

Browse files
committed
show course revision content on home and collection pages
1 parent b7f8536 commit ad0812d

16 files changed

+167
-11
lines changed

components/course-revision/CourseRevisionCard.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const CourseRevisionCard = styled('div', {
99
background: 'linear-gradient(0.25turn, #4287f5, #4386f0);',
1010
boxShadow: 'inset 0px 0px 35px -22px rgba(0,0,0,0.33)',
1111
borderRadius: '1.2rem',
12-
length: '100%',
1312
width: "100%",
1413
transitionProperty: "width, padding, margin, background",
1514
transitionDuration: "400ms",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { styled } from "@stitches/react"
2+
import { CourseRevisionOffering } from "contentlayer/generated"
3+
import Link from "next/link"
4+
import CourseRevisionMiniCard from "./CourseRevisionMiniCard"
5+
6+
type PropTypes = {
7+
allCourseRevisionOfferings: CourseRevisionOffering[]
8+
}
9+
10+
const CourseRevisionsContainer = styled('div', {
11+
width: "100%",
12+
display: 'flex',
13+
flexFlow: "row wrap",
14+
justifyContent: "center",
15+
rowGap: '$1',
16+
columnGap: '$4',
17+
})
18+
19+
const CourseRevisionContainerHomePage = (props: PropTypes) => {
20+
return (<CourseRevisionsContainer>
21+
22+
{
23+
props.allCourseRevisionOfferings?.map((offering) => (
24+
<Link href={`course-revision/${offering.slug}`} passHref key={offering.slug}>
25+
<div style={{
26+
backgroundColor: "#3e73c7",
27+
margin: '0.6rem 0',
28+
borderRadius: '1.2rem',
29+
}}>
30+
<CourseRevisionMiniCard courseOffering={offering} />
31+
</div>
32+
</Link>
33+
))
34+
35+
}</CourseRevisionsContainer>
36+
)
37+
}
38+
39+
export default CourseRevisionContainerHomePage
40+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { styled } from "@stitches/react";
2+
import { Text } from "components/Text";
3+
import { CourseRevisionOffering } from "contentlayer/generated";
4+
5+
6+
type PropTypes = {
7+
courseOffering: CourseRevisionOffering
8+
}
9+
10+
const CourseRevisionMiniCardStyled = styled('div', {
11+
color: "#ebf2ff",
12+
padding: '1.2rem 1.6rem',
13+
display: 'flex',
14+
flexFlow: 'column nowrap',
15+
background: 'linear-gradient(0.25turn, #4287f5, #4386f0);',
16+
boxShadow: 'inset 0px 0px 35px -22px rgba(0,0,0,0.33)',
17+
borderRadius: '1.2rem',
18+
maxWidth: "380px",
19+
transitionProperty: "width, padding, margin, background",
20+
transitionDuration: "400ms",
21+
transitionTimingFunction: "ease",
22+
23+
'&:hover': {
24+
background: 'linear-gradient(0.25turn, #5294ff, #5796fa);',
25+
cursor: 'pointer',
26+
paddingTop: 'calc(1.2rem - 8px)',
27+
marginBottom: "8px",
28+
},
29+
30+
'&:active': {
31+
background: 'linear-gradient(0.25turn, #4287f5, #4386f0);',
32+
}
33+
})
34+
35+
const H1 = styled('h1', {
36+
fontSize: "1.8rem",
37+
marginBottom: "0.2rem",
38+
lineHeight: "1.6rem",
39+
'@media (min-width: 640px)': {
40+
fontSize: "2rem",
41+
marginBottom: "0.2rem",
42+
lineHeight: "2.2rem",
43+
},
44+
})
45+
46+
const CourseRevisionMiniCard = (props: PropTypes) => {
47+
return (
48+
<CourseRevisionMiniCardStyled>
49+
<div style={{ textAlign: "center" }}><H1>{props.courseOffering.course}</H1></div>
50+
<Text size={"info"} style={{ color: "#dce6f5" }}>{props.courseOffering.desc}</Text>
51+
</CourseRevisionMiniCardStyled >
52+
53+
)
54+
}
55+
56+
export default CourseRevisionMiniCard
File renamed without changes.
File renamed without changes.

pages/articles.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Flex } from 'components/Flex'
33
import { Text } from 'components/Text'
44
import { Button } from 'components/Button'
55
import ArticleCard from 'components/ArticleCard'
6-
import { ArticleType, allArticleTypes } from 'contentlayer/generated'
6+
import { ArticleType, allArticleTypes, allCourseRevisionOfferings } from 'contentlayer/generated'
77
import { compareDesc } from 'date-fns'
88
import { NextPage } from 'next'
99
import Head from 'next/head'
@@ -12,6 +12,7 @@ import { styled } from '../stitches.config'
1212
import { MagnifyingGlass } from 'phosphor-react'
1313
import { ArticleRow } from '../components/ArticleRow'
1414
import { ArticlesCarousel } from 'components/ArticlesCarousel'
15+
import CourseRevisionContainerHomePage from 'components/course-revision/CourseRevisionContainerHomePage'
1516

1617
export async function getStaticProps() {
1718
const articles = allArticleTypes.sort((a, b) => {
@@ -22,7 +23,7 @@ export async function getStaticProps() {
2223
)
2324
const flattenedTags = tagLists.flat(1)
2425
const allTags = [...['All Topics'], ...new Set(flattenedTags)]
25-
return { props: { articles, allTags } }
26+
return { props: { articles, allTags, courseOfferingContent: allCourseRevisionOfferings } }
2627
}
2728

2829
const SearchBar = styled('input', {
@@ -42,7 +43,7 @@ const TagsContainer = styled('div', {
4243
})
4344

4445
// I'm tired, I didn't type this properly ok
45-
const Articles: NextPage = ({ articles, allTags }: any) => {
46+
const Articles: NextPage = ({ articles, allTags, courseOfferingContent }: any) => {
4647
const [currentTag, setCurrentTag] = useState('All Topics')
4748
const [currentSearch, setCurrentSearch] = useState('')
4849
const [filteredArticles, setFilteredArticles] = useState(articles)
@@ -110,9 +111,30 @@ const Articles: NextPage = ({ articles, allTags }: any) => {
110111
as="span"
111112
size="title-sm"
112113
css={{ color: '$slate12', paddingTop: '$1' }}>
113-
Learn something new with our collection of articles and videos!
114+
Learn something new with our collection of articles and tutorials
114115
</Text>
115116

117+
<Flex
118+
as="main"
119+
css={{
120+
flexDirection: 'column',
121+
alignItems: 'center',
122+
padding: '0 1rem',
123+
}}>
124+
<Text
125+
size="headline"
126+
css={{ fontWeight: 600, paddingTop: '$8', paddingBottom: '$4' }}>
127+
Course Revision
128+
</Text>
129+
<Text
130+
as="span"
131+
size="title-sm"
132+
css={{ color: '$slate12', paddingTop: '$1', textAlign: "center", width: "70%" }}>
133+
Revise for your upcoming final exams with practice problems written by our Education Team. Solutions provided.
134+
</Text>
135+
<CourseRevisionContainerHomePage allCourseRevisionOfferings={courseOfferingContent} />
136+
</Flex>
137+
116138
<Text
117139
size="headline"
118140
css={{ fontWeight: 600, paddingTop: '$8', paddingBottom: '$3' }}>

pages/course-revision/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const ExercisesPage = ({
2424
return (
2525
<main>
2626
<ArticleLayout>
27+
<h1>Course Revision</h1>
2728
{allCourseRevisionOfferings?.map((offering) => (
2829
<Link href={`course-revision/${offering.slug}`} passHref key={offering.slug}>
2930
<div style={{

pages/index.tsx

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,32 @@ import { Button } from 'components/Button'
33
import { Card } from 'components/Card'
44
import { Flex } from 'components/Flex'
55
import { Text } from 'components/Text'
6-
import { allArticleTypes } from 'contentlayer/generated'
6+
import { allArticleTypes, allCourseRevisionOfferings, ArticleType, CourseRevisionOffering } from 'contentlayer/generated'
77
import { compareAsc, compareDesc } from 'date-fns'
88
import type { NextPage } from 'next'
99
import Head from 'next/head'
1010
import Link from 'next/link'
1111
import Image from 'next/image'
1212
import { DiscordLogo, FacebookLogo, InstagramLogo, ArrowRight } from 'phosphor-react'
1313
import { ArticlesCarousel } from 'components/ArticlesCarousel'
14+
import CourseRevisionCard from 'components/course-revision/CourseRevisionCard'
15+
import { styled } from '@stitches/react'
16+
import CourseRevisionMiniCard from 'components/course-revision/CourseRevisionMiniCard'
17+
import CourseRevisionContainerHomePage from 'components/course-revision/CourseRevisionContainerHomePage'
18+
19+
type PropTypes = {
20+
articles: ArticleType[],
21+
courseOfferingContent: CourseRevisionOffering[],
22+
}
1423

1524
export async function getStaticProps() {
1625
const articles = allArticleTypes.sort((a, b) => {
1726
return compareAsc(new Date(b.date), new Date(a.date))
1827
})
19-
return { props: { articles } }
28+
return { props: { articles, courseOfferingContent: allCourseRevisionOfferings } }
2029
}
2130

22-
const Home: NextPage = ({ articles }: any) => {
31+
const Home: NextPage = ({ articles, courseOfferingContent }: PropTypes) => {
2332
return (
2433
<Box>
2534
<Head>
@@ -47,7 +56,7 @@ const Home: NextPage = ({ articles }: any) => {
4756
<Text
4857
as="span"
4958
size="title-sm"
50-
css={{ color: '$slate12', paddingTop: '$1' }}>
59+
css={{ color: '$slate12', paddingTop: '$1', textAlign: "center", width: "70%" }}>
5160
From articles on new technologies to sample projects, your learning
5261
outside the classroom starts here.
5362
</Text>
@@ -57,6 +66,34 @@ const Home: NextPage = ({ articles }: any) => {
5766
<ArrowRight weight="bold" />
5867
</Button>
5968
</Link>
69+
</Flex>
70+
<Flex
71+
as="main"
72+
css={{
73+
flexDirection: 'column',
74+
alignItems: 'center',
75+
padding: '0 1rem',
76+
}}>
77+
<Text
78+
size="headline"
79+
css={{ fontWeight: 600, paddingTop: '$8', paddingBottom: '$4' }}>
80+
Course Revision
81+
</Text>
82+
<Text
83+
as="span"
84+
size="title-sm"
85+
css={{ color: '$slate12', paddingTop: '$1', textAlign: "center", width: "70%" }}>
86+
Revise for your upcoming final exams with practice problems written by our Education Team. Solutions provided.
87+
</Text>
88+
<CourseRevisionContainerHomePage allCourseRevisionOfferings={courseOfferingContent} />
89+
</Flex>
90+
<Flex
91+
as="main"
92+
css={{
93+
flexDirection: 'column',
94+
alignItems: 'center',
95+
padding: '0 1rem',
96+
}}>
6097
<Text
6198
size="headline"
6299
css={{ fontWeight: 600, paddingTop: '$8', paddingBottom: '$4' }}>
@@ -77,7 +114,7 @@ const Home: NextPage = ({ articles }: any) => {
77114
<Text
78115
as="span"
79116
size="title-sm"
80-
css={{ color: '$slate12', paddingTop: '$1' }}>
117+
css={{ color: '$slate12', paddingTop: '$1', textAlign: "center", width: "70%" }}>
81118
Make friends with like-minded students and stay up-to-date with
82119
events.
83120
</Text>
@@ -210,3 +247,4 @@ const Home: NextPage = ({ articles }: any) => {
210247
}
211248

212249
export default Home
250+

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@
3636
"components/Button.ts",
3737
"components/Logo.tsx",
3838
"pages/articles.js"
39-
],
39+
, "pages/course-revision/[course_offering]" ],
4040
"exclude": ["node_modules"]
4141
}

0 commit comments

Comments
 (0)