From 30102822da576c0319319eac9e9a7d476ea97231 Mon Sep 17 00:00:00 2001 From: Aditya Thakral Date: Mon, 30 Aug 2021 19:20:16 -0400 Subject: [PATCH 1/2] Add title to all pages (#222) Closes #221 Go to https://csclub.uwaterloo.ca/~a3thakra/csc/adi-page-titles and make sure that all pages have a title (you can hover over the tab) Reviewed-on: https://git.csclub.uwaterloo.ca/www/www-new/pulls/222 Reviewed-by: j285he Co-authored-by: Aditya Thakral Co-committed-by: Aditya Thakral --- components/ArchivePage.tsx | 39 +++++++++------- components/OrganizedContent.tsx | 32 +++++++++++--- components/OrganizedContent/ReadAll.tsx | 44 +++++++++++-------- components/OrganizedContent/Section.tsx | 35 +++++++++------ components/Title.tsx | 19 ++++++++ components/playground.tsx | 7 ++- .../constitution/amendments-and-procedures.md | 2 +- content/about/constitution/code-of-conduct.md | 2 +- content/about/constitution/committees.md | 2 +- content/about/constitution/dissolution.md | 2 +- .../about/constitution/duties-of-officers.md | 2 +- .../about/constitution/executive-council.md | 2 +- content/about/constitution/finances.md | 2 +- content/about/constitution/meetings.md | 2 +- content/about/constitution/membership.md | 2 +- content/about/constitution/name.md | 2 +- content/about/constitution/officers.md | 2 +- content/about/constitution/purpose.md | 2 +- .../constitution/use-of-club-resources.md | 2 +- pages/about/code-of-conduct/[section].tsx | 2 +- .../index.tsx} | 7 ++- pages/about/constitution/[section].tsx | 2 +- .../index.tsx} | 8 +++- pages/about/index.tsx | 2 + pages/about/our-supporters.tsx | 2 + pages/about/team.tsx | 2 + pages/events/[year]/[term]/[event].tsx | 27 ++++++++---- pages/events/[year]/[term]/index.tsx | 2 + pages/events/[year]/index.tsx | 2 + pages/events/index.tsx | 2 +- pages/get-involved.tsx | 2 + pages/index.tsx | 2 + pages/news/[year]/[term].tsx | 2 + pages/resources/advice/academic.tsx | 11 +++-- pages/resources/advice/coop.tsx | 10 +++-- pages/resources/advice/misc.tsx | 11 +++-- .../machine-usage-agreement/[section].tsx | 2 +- .../index.tsx} | 0 pages/resources/services/[section].tsx | 2 +- .../{services.tsx => services/index.tsx} | 0 pages/resources/tech-talks/[slug].tsx | 7 ++- .../index.module.css} | 0 .../{tech-talks.tsx => tech-talks/index.tsx} | 4 +- pages/themer.tsx | 4 +- 44 files changed, 215 insertions(+), 102 deletions(-) create mode 100644 components/Title.tsx rename pages/about/{code-of-conduct.tsx => code-of-conduct/index.tsx} (74%) rename pages/about/{constitution.tsx => constitution/index.tsx} (69%) rename pages/resources/{machine-usage-agreement.tsx => machine-usage-agreement/index.tsx} (100%) rename pages/resources/{services.tsx => services/index.tsx} (100%) rename pages/resources/{tech-talks.module.css => tech-talks/index.module.css} (100%) rename pages/resources/{tech-talks.tsx => tech-talks/index.tsx} (91%) diff --git a/components/ArchivePage.tsx b/components/ArchivePage.tsx index bc1e1be7..522578a2 100644 --- a/components/ArchivePage.tsx +++ b/components/ArchivePage.tsx @@ -1,12 +1,14 @@ import React from "react"; -import { Link } from "@/components/Link"; +import { capitalize } from "@/utils"; + +import { Link } from "./Link"; import { ShapesConfig, GetShapesConfig, defaultGetShapesConfig, -} from "@/components/ShapesBackground"; -import { capitalize } from "@/utils"; +} from "./ShapesBackground"; +import { Title } from "./Title"; import styles from "./ArchivePage.module.css"; @@ -20,20 +22,23 @@ export interface Props { export function ArchivePage({ items, type }: Props) { return ( -
-

{capitalize(type)} Archive

-
    - {items.map(({ year, terms }) => - terms.map((term) => ( -
  • - - {capitalize(term)} {year} - -
  • - )) - )} -
-
+ <> + {[capitalize(type), "Archive"]} +
+

{capitalize(type)} Archive

+
    + {items.map(({ year, terms }) => + terms.map((term) => ( +
  • + + {capitalize(term)} {year} + +
  • + )) + )} +
+
+ ); } diff --git a/components/OrganizedContent.tsx b/components/OrganizedContent.tsx index c2f26627..a119b972 100644 --- a/components/OrganizedContent.tsx +++ b/components/OrganizedContent.tsx @@ -26,6 +26,7 @@ interface Props { children: ReactNode; pageTitle: string; link: Link; + numberedSections?: boolean; } export function OrganizedContent({ @@ -34,6 +35,7 @@ export function OrganizedContent({ children, pageTitle, link: Link, + numberedSections = false, }: Props) { const [mobileNavOpen, setMobileNavOpen] = useState(false); const currentIndex = sections.findIndex( @@ -71,6 +73,7 @@ export function OrganizedContent({ currentIndex={currentIndex} link={Link} pageTitle={pageTitle} + numberedSections={numberedSections} mobileNavOpen={mobileNavOpen} setMobileNavOpen={setMobileNavOpen} /> @@ -80,7 +83,11 @@ export function OrganizedContent({ ) : ( <>
-

{section.title}

+

+ {numberedSections + ? `${currentIndex}. ${section.title}` + : section.title} +

{children}