diff --git a/components/OrganizedContent.module.css b/components/OrganizedContent.module.css index f0839419..990d5343 100644 --- a/components/OrganizedContent.module.css +++ b/components/OrganizedContent.module.css @@ -3,6 +3,7 @@ } .contentHeading { + font-size: 1.5rem; margin: 1rem 0 1rem 0; color: var(--blue-2); } diff --git a/components/OrganizedContent.tsx b/components/OrganizedContent.tsx index f83f55fa..bfffb466 100644 --- a/components/OrganizedContent.tsx +++ b/components/OrganizedContent.tsx @@ -21,6 +21,12 @@ interface Props { children: ReactNode; } +interface ChildProps { + headings: Heading[]; + currentIndex: number; + link: Link; +} + export const OrganizedContent: React.FC = ({ headings, currentIndex, @@ -28,131 +34,12 @@ export const OrganizedContent: React.FC = ({ link: Link, }) => { const isReadAll = headings[currentIndex].name === "Read All"; - const prevHeading = - currentIndex > 0 && headings[currentIndex - 1].name !== "Read All" - ? headings[currentIndex - 1] - : undefined; - const nextHeading = - currentIndex < headings.length - 1 && !isReadAll - ? headings[currentIndex + 1] - : undefined; - const isMobile = false; - if (!isMobile) { - return ( -
-
- {headings.map((heading, index) => ( -
-
- {index === currentIndex && ( - - )} - {heading.name} -
-
-
- ))} -
- -
- {!isReadAll ? ( -

- {headings[currentIndex].name} -

- ) : ( -
- {headings - .filter( - (heading: { name: string }) => heading.name !== "Read All" - ) - .map((heading) => ( -
-

{heading.name}

- {heading.content} -
- ))} -
- )} - {children} -
- {prevHeading && ( -
- -
- - - -
-
Previous
-
- {prevHeading.name} -
-
-
- -
- )} -
- {nextHeading && ( -
- -
-
-
- Next -
-
- {nextHeading.name} -
-
- - - -
- -
- )} -
-
-
- ); - } else { + if (isMobile) { return (
- {!isReadAll ? ( -

- {headings[currentIndex].name} -

- ) : ( + {isReadAll ? (
{headings .filter( @@ -165,60 +52,139 @@ export const OrganizedContent: React.FC = ({
))}
+ ) : ( +

+ {headings[currentIndex].name} +

)} {children} -
- {prevHeading && ( -
- -
- - - -
-
Previous
-
- {prevHeading.name} -
+
+
+ ); + } else { + return ( +
+
); } }; + +const Nav: React.FC = ({ headings, currentIndex, link: Link }) => { + return ( +
+ {headings.map((heading, index) => ( +
+
+ {index === currentIndex && ( + + )} + {heading.name} +
+
+
+ ))} +
+ ); +}; + +const Footer: React.FC = ({ + headings, + currentIndex, + link: Link, +}) => { + const isReadAll = headings[currentIndex].name === "Read All"; + const prevHeading = + currentIndex > 0 && headings[currentIndex - 1].name !== "Read All" + ? headings[currentIndex - 1] + : undefined; + const nextHeading = + currentIndex < headings.length - 1 && !isReadAll + ? headings[currentIndex + 1] + : undefined; + + return ( +
+ {prevHeading && ( +
+ +
+ + + +
+
Previous
+
{prevHeading.name}
+
+
+ +
+ )} +
+ {nextHeading && ( +
+ +
+
+
+ Next +
+
{nextHeading.name}
+
+ + + +
+ +
+ )} +
+ ); +}; diff --git a/pages/playground.mdx b/pages/playground.mdx index 603f70f0..d642d77e 100644 --- a/pages/playground.mdx +++ b/pages/playground.mdx @@ -70,3 +70,5 @@ display information about the execs: prez, VP, trez, AVP, and syscom overlord. Codey is supposed to say something here... + +--- \ No newline at end of file