From f8fbc04bbce9847657241092b4f6ecc9e70a550b Mon Sep 17 00:00:00 2001 From: Aditya Thakral Date: Wed, 25 Aug 2021 14:58:58 -0400 Subject: [PATCH] Mobile layout improvements --- components/MiniTechTalkCard.module.css | 2 +- components/TechTalkCard.module.css | 14 ++++++++ pages/resources/tech-talks.module.css | 38 +++++++++++++++++--- pages/resources/tech-talks.tsx | 32 ++++++++++------- pages/resources/tech-talks/[slug].tsx | 50 ++++++++++++++++++++++++++ 5 files changed, 118 insertions(+), 18 deletions(-) create mode 100644 pages/resources/tech-talks/[slug].tsx diff --git a/components/MiniTechTalkCard.module.css b/components/MiniTechTalkCard.module.css index 2120333c..0ba7fa69 100644 --- a/components/MiniTechTalkCard.module.css +++ b/components/MiniTechTalkCard.module.css @@ -10,7 +10,7 @@ .card aside { max-width: calc(142rem / 16); - margin-right: calc(45rem / 16); + margin-right: 1rem; display: flex; justify-content: center; align-items: center; diff --git a/components/TechTalkCard.module.css b/components/TechTalkCard.module.css index 7ae3d71e..c163ac8b 100644 --- a/components/TechTalkCard.module.css +++ b/components/TechTalkCard.module.css @@ -37,4 +37,18 @@ .card { flex-direction: column; } + + .card aside { + margin: 0; + margin-bottom: 1rem; + flex: unset; + } + + .card aside img { + margin: 0; + } + + .content ul { + padding-left: 1rem; + } } diff --git a/pages/resources/tech-talks.module.css b/pages/resources/tech-talks.module.css index 94f17f05..7f73bc22 100644 --- a/pages/resources/tech-talks.module.css +++ b/pages/resources/tech-talks.module.css @@ -1,8 +1,13 @@ +.page { + margin: calc(60rem / 16) 0; +} + .headerContainer { display: flex; flex-direction: row; align-items: flex-end; padding-bottom: 1rem; + margin-bottom: calc(40rem / 16); border-bottom: calc(1rem / 16) solid var(--primary-heading); } @@ -12,7 +17,6 @@ .header h1 { color: var(--primary-heading); - font-size: calc(48rem / 16); margin: 0 1rem 0 0; text-align: left; } @@ -22,7 +26,6 @@ } .image { - width: calc(260rem / 16); height: calc(165rem / 16); object-fit: cover; } @@ -31,6 +34,33 @@ background: var(--secondary-accent-light); } -.miniCards { - margin: calc(60rem / 16) 0; +@media only screen and (max-width: calc(768rem / 16)) { + .page { + margin-top: 0; + margin-bottom: calc(20rem / 16); + } + + .headerContainer { + flex-direction: column-reverse; + margin-bottom: calc(20rem / 16); + } + + .headerContent { + display: none; + } + + .image { + margin: 0 auto; + height: calc(75rem / 16); + } + + .header { + width: 100%; + padding: 0; + } + + .header h1 { + text-align: center; + margin: 0; + } } diff --git a/pages/resources/tech-talks.tsx b/pages/resources/tech-talks.tsx index ca4df01f..9808b6b9 100644 --- a/pages/resources/tech-talks.tsx +++ b/pages/resources/tech-talks.tsx @@ -13,18 +13,8 @@ interface Props { export default function TechTalks({ talks }: Props) { return ( - <> -
-
-

Tech Talks

-

- These are the audio and video recordings of past CSC and other - university-related talks. Our public events can also be found on our - YouTube channel. -

-
- -
+
+
{talks.map((talk) => ( ))}
- +
+ ); +} + +export function Header() { + return ( +
+
+

Tech Talks

+

+ These are the audio and video recordings of past CSC and other + university-related talks. Our public events can also be found on our + YouTube channel. +

+
+ +
); } diff --git a/pages/resources/tech-talks/[slug].tsx b/pages/resources/tech-talks/[slug].tsx new file mode 100644 index 00000000..28423d9c --- /dev/null +++ b/pages/resources/tech-talks/[slug].tsx @@ -0,0 +1,50 @@ +import { ParsedUrlQuery } from "querystring"; + +import { GetStaticPaths, GetStaticProps } from "next"; +import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote"; +import React from "react"; + +import { TechTalkCard } from "@/components/TechTalkCard"; +import { getTechTalk, getTechTalkNames, Metadata } from "@/lib/tech-talks"; + +import { Header } from "../tech-talks"; +import styles from "../tech-talks.module.css"; + +interface Props { + content: MDXRemoteSerializeResult; + metadata: Metadata; +} + +export default function TechTalk({ content, metadata }: Props) { + return ( +
+
+ + + +
+ ); +} + +export const getStaticProps: GetStaticProps = async ( + context +) => { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const talk = await getTechTalk(context.params!.slug); + + return { props: talk }; +}; + +interface Params extends ParsedUrlQuery { + slug: string; +} + +export const getStaticPaths: GetStaticPaths = async () => { + return { + fallback: false, + paths: (await getTechTalkNames()).map((slug) => ({ params: { slug } })), + }; +};