From 429a9ae9fbe70b9ad431001890f92100c7debd50 Mon Sep 17 00:00:00 2001 From: William Tran Date: Mon, 24 May 2021 21:33:17 -0400 Subject: [PATCH] Refactor ReadAll content --- components/OrganizedContent.tsx | 34 ++++++++++----------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/components/OrganizedContent.tsx b/components/OrganizedContent.tsx index bfffb466..7a0e8f1a 100644 --- a/components/OrganizedContent.tsx +++ b/components/OrganizedContent.tsx @@ -35,23 +35,20 @@ export const OrganizedContent: React.FC = ({ }) => { const isReadAll = headings[currentIndex].name === "Read All"; const isMobile = false; + const readAllContent = headings + .filter((heading: { name: string }) => heading.name !== "Read All") + .map((heading) => ( +
+

{heading.name}

+ {heading.content} +
+ )); if (isMobile) { return (
{isReadAll ? ( -
- {headings - .filter( - (heading: { name: string }) => heading.name !== "Read All" - ) - .map((heading) => ( -
-

{heading.name}

- {heading.content} -
- ))} -
+
{readAllContent}
) : (

{headings[currentIndex].name} @@ -67,18 +64,7 @@ export const OrganizedContent: React.FC = ({