From 8bbe4d5bec8c5a34091856df7ee15c01ca36a287 Mon Sep 17 00:00:00 2001 From: William Tran Date: Mon, 31 May 2021 02:26:27 -0400 Subject: [PATCH] Add .mdx functionality to OrganizedContent --- components/OrganizedContent.tsx | 27 ++-- components/playground.tsx | 118 ++++++------------ .../duties-of-officers.organized-content.mdx | 27 ++++ .../executive-council.organized-content.mdx | 10 ++ .../membership.organized-content.mdx | 10 ++ .../constitution/name.organized-content.mdx | 6 + .../officers.organized-content.mdx | 30 +++++ .../purpose.organized-content.mdx | 10 ++ .../read-all.organized-content.mdx | 6 + next-env.d.ts | 14 +++ 10 files changed, 166 insertions(+), 92 deletions(-) create mode 100644 content/playground/constitution/duties-of-officers.organized-content.mdx create mode 100644 content/playground/constitution/executive-council.organized-content.mdx create mode 100644 content/playground/constitution/membership.organized-content.mdx create mode 100644 content/playground/constitution/name.organized-content.mdx create mode 100644 content/playground/constitution/officers.organized-content.mdx create mode 100644 content/playground/constitution/purpose.organized-content.mdx create mode 100644 content/playground/constitution/read-all.organized-content.mdx diff --git a/components/OrganizedContent.tsx b/components/OrganizedContent.tsx index f98bf3ab..f263aebc 100644 --- a/components/OrganizedContent.tsx +++ b/components/OrganizedContent.tsx @@ -2,7 +2,7 @@ import React, { ReactNode, ComponentType } from "react"; import styles from "./OrganizedContent.module.css"; export interface LinkProps { - className: string; + className?: string; url: string; children: string | ReactNode | (string | ReactNode)[]; } @@ -10,7 +10,7 @@ export interface LinkProps { type Link = ComponentType; interface Heading { - name: string; + title: string; url: string; content: ReactNode; } @@ -34,13 +34,13 @@ export const OrganizedContent = ({ link: Link, children, }: Props) => { - const isReadAll = headings[currentIndex].name === "Read All"; + const isReadAll = headings[currentIndex].title === "Read All"; const readAllContent = headings - .filter((heading: { name: string }) => heading.name !== "Read All") + .filter((heading: { title: string }) => heading.title !== "Read All") .map((heading) => (
-

{heading.name}

+

{heading.title}

{heading.content}
)); @@ -59,7 +59,7 @@ export const OrganizedContent = ({ <>{readAllContent} ) : ( <> -

{headings[currentIndex].name}

+

{headings[currentIndex].title}

{children}