From bf0341852cd67489687087981300c2f3b657504b Mon Sep 17 00:00:00 2001 From: Aditya Thakral Date: Mon, 23 Aug 2021 10:19:58 -0400 Subject: [PATCH] More generic code-of-conduct and consititution pages --- pages/about/code-of-conduct.tsx | 12 ++++++------ pages/about/code-of-conduct/[section].tsx | 12 ++++-------- pages/about/constitution.tsx | 12 ++++++------ pages/about/constitution/[section].tsx | 12 ++++-------- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/pages/about/code-of-conduct.tsx b/pages/about/code-of-conduct.tsx index a68d5dc4..3fc88256 100644 --- a/pages/about/code-of-conduct.tsx +++ b/pages/about/code-of-conduct.tsx @@ -3,12 +3,12 @@ import path from "path"; import { createReadAllPage } from "@/components/OrganizedContent/ReadAll"; import { createReadAllGetStaticProps } from "@/components/OrganizedContent/static"; -export const CODE_OF_CONDUCT_PAGE = path.join("about", "code-of-conduct"); - -export default createReadAllPage({ +export const options = { title: "Code of Conduct", image: "images/code-of-conduct.svg", - pagePath: CODE_OF_CONDUCT_PAGE, -}); + pagePath: path.join("about", "code-of-conduct"), +}; -export const getStaticProps = createReadAllGetStaticProps(CODE_OF_CONDUCT_PAGE); +export default createReadAllPage(options); + +export const getStaticProps = createReadAllGetStaticProps(options.pagePath); diff --git a/pages/about/code-of-conduct/[section].tsx b/pages/about/code-of-conduct/[section].tsx index 0aa7c957..7d71be05 100644 --- a/pages/about/code-of-conduct/[section].tsx +++ b/pages/about/code-of-conduct/[section].tsx @@ -4,13 +4,9 @@ import { createSectionGetStaticProps, } from "@/components/OrganizedContent/static"; -import { CODE_OF_CONDUCT_PAGE } from "../code-of-conduct"; +import { options } from "../code-of-conduct"; -export default createSectionPage({ - title: "Code of Conduct", - image: "images/code-of-conduct.svg", - pagePath: CODE_OF_CONDUCT_PAGE, -}); +export default createSectionPage(options); -export const getStaticProps = createSectionGetStaticProps(CODE_OF_CONDUCT_PAGE); -export const getStaticPaths = createSectionGetStaticPaths(CODE_OF_CONDUCT_PAGE); +export const getStaticProps = createSectionGetStaticProps(options.pagePath); +export const getStaticPaths = createSectionGetStaticPaths(options.pagePath); diff --git a/pages/about/constitution.tsx b/pages/about/constitution.tsx index 0e82b62a..cf1d7902 100644 --- a/pages/about/constitution.tsx +++ b/pages/about/constitution.tsx @@ -3,12 +3,12 @@ import path from "path"; import { createReadAllPage } from "@/components/OrganizedContent/ReadAll"; import { createReadAllGetStaticProps } from "@/components/OrganizedContent/static"; -export const CONSTITUTION_PAGE = path.join("about", "constitution"); - -export default createReadAllPage({ +export const options = { title: "Constitution", image: "images/constitution.svg", - pagePath: CONSTITUTION_PAGE, -}); + pagePath: path.join("about", "constitution"), +}; -export const getStaticProps = createReadAllGetStaticProps(CONSTITUTION_PAGE); +export default createReadAllPage(options); + +export const getStaticProps = createReadAllGetStaticProps(options.pagePath); diff --git a/pages/about/constitution/[section].tsx b/pages/about/constitution/[section].tsx index d8c6f3a4..bd7cb7a1 100644 --- a/pages/about/constitution/[section].tsx +++ b/pages/about/constitution/[section].tsx @@ -4,13 +4,9 @@ import { createSectionGetStaticProps, } from "@/components/OrganizedContent/static"; -import { CONSTITUTION_PAGE } from "../constitution"; +import { options } from "../constitution"; -export default createSectionPage({ - title: "Constitution", - image: "images/constitution.svg", - pagePath: CONSTITUTION_PAGE, -}); +export default createSectionPage(options); -export const getStaticProps = createSectionGetStaticProps(CONSTITUTION_PAGE); -export const getStaticPaths = createSectionGetStaticPaths(CONSTITUTION_PAGE); +export const getStaticProps = createSectionGetStaticProps(options.pagePath); +export const getStaticPaths = createSectionGetStaticPaths(options.pagePath);