From 5bceff26fd7c2af01e879b4d9b366bb9cf8d0db4 Mon Sep 17 00:00:00 2001 From: Amy Date: Mon, 23 Aug 2021 15:54:56 -0400 Subject: [PATCH] Add constitution and code of conduct pages shapes backgrounds --- components/OrganizedContent/ReadAll.tsx | 17 +++++++++++++++-- components/OrganizedContent/Section.tsx | 17 +++++++++++++++-- pages/about/our-supporters.tsx | 5 +---- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/components/OrganizedContent/ReadAll.tsx b/components/OrganizedContent/ReadAll.tsx index 66863de2..1cf40b37 100644 --- a/components/OrganizedContent/ReadAll.tsx +++ b/components/OrganizedContent/ReadAll.tsx @@ -8,6 +8,12 @@ import { OrganizedContent, } from "@/components/OrganizedContent"; +import { + mobileShapesConfig, + aboutShapesConfig, + GetShapesConfig, +} from "../ShapesBackground"; + import { Header } from "./Header"; export interface SerializedSection { @@ -32,7 +38,7 @@ export interface Options { export function createReadAllPage({ title, image, pagePath, link }: Options) { const Link = link ?? createLink(pagePath); - return function Page({ sections }: Props) { + function Page({ sections }: Props) { const readAllSection = createReadAllSection( sections.map(({ section, content }) => ({ section, @@ -57,5 +63,12 @@ export function createReadAllPage({ title, image, pagePath, link }: Options) { ); - }; + } + + // TODO: differentiate between About pages and Resources pages + Page.getShapesConfig = (() => { + return window.innerWidth <= 768 ? mobileShapesConfig : aboutShapesConfig; + }) as GetShapesConfig; + + return Page; } diff --git a/components/OrganizedContent/Section.tsx b/components/OrganizedContent/Section.tsx index a5779ee8..e32ec1c0 100644 --- a/components/OrganizedContent/Section.tsx +++ b/components/OrganizedContent/Section.tsx @@ -7,6 +7,12 @@ import { OrganizedContent, } from "@/components/OrganizedContent"; +import { + mobileShapesConfig, + aboutShapesConfig, + GetShapesConfig, +} from "../ShapesBackground"; + import { Header } from "./Header"; interface Section { @@ -30,7 +36,7 @@ export interface Options { export function createSectionPage({ title, image, pagePath, link }: Options) { const Link = link ?? createLink(pagePath); - return function Page(this: void, { content, sections, current }: Props) { + function Page(this: void, { content, sections, current }: Props) { return (
); - }; + } + + // TODO: differentiate between About pages and Resources pages + Page.getShapesConfig = (() => { + return window.innerWidth <= 768 ? mobileShapesConfig : aboutShapesConfig; + }) as GetShapesConfig; + + return Page; } diff --git a/pages/about/our-supporters.tsx b/pages/about/our-supporters.tsx index 3451ab1b..196055d0 100644 --- a/pages/about/our-supporters.tsx +++ b/pages/about/our-supporters.tsx @@ -26,8 +26,5 @@ export default function OurSupporters() { } OurSupporters.getShapesConfig = (() => { - if (window.innerWidth <= 768) { - return mobileShapesConfig; - } - return aboutShapesConfig; + return window.innerWidth <= 768 ? mobileShapesConfig : aboutShapesConfig; }) as GetShapesConfig;