From eda8393a7ad26d76ca95a1e858d96b4163b26ec7 Mon Sep 17 00:00:00 2001 From: Aditya Thakral Date: Mon, 23 Aug 2021 10:19:29 -0400 Subject: [PATCH] Support description in OrganizedContent Header --- components/OrganizedContent/Header.module.css | 13 ++++++++ components/OrganizedContent/Header.tsx | 21 ++++++++++-- components/OrganizedContent/ReadAll.tsx | 18 +++++++++-- components/OrganizedContent/Section.tsx | 32 ++++++++++--------- 4 files changed, 64 insertions(+), 20 deletions(-) diff --git a/components/OrganizedContent/Header.module.css b/components/OrganizedContent/Header.module.css index ac0377bd..0a715376 100644 --- a/components/OrganizedContent/Header.module.css +++ b/components/OrganizedContent/Header.module.css @@ -19,6 +19,15 @@ text-align: center; } +.imageRight { + flex-direction: row-reverse; +} + +.imageRight .header { + text-align: left; + margin-left: 0; +} + @media only screen and (max-width: calc(768rem / 16)) { .headerContainer { flex-direction: column; @@ -34,4 +43,8 @@ .headerImage { width: calc(100rem / 16); } + + .description { + display: none; + } } diff --git a/components/OrganizedContent/Header.tsx b/components/OrganizedContent/Header.tsx index 38cb9149..780fcf25 100644 --- a/components/OrganizedContent/Header.tsx +++ b/components/OrganizedContent/Header.tsx @@ -8,14 +8,29 @@ export interface Props { title: string; image: string; children: ReactNode; + description?: string; + imagePosition?: "left" | "right"; } -export function Header({ title, image, children }: Props) { +export function Header({ + title, + image, + children, + description, + imagePosition, +}: Props) { return (
-
+
-

{title}

+
+

{title}

+ {description &&

{description}

} +
{children}
diff --git a/components/OrganizedContent/ReadAll.tsx b/components/OrganizedContent/ReadAll.tsx index 66863de2..6a610346 100644 --- a/components/OrganizedContent/ReadAll.tsx +++ b/components/OrganizedContent/ReadAll.tsx @@ -26,10 +26,19 @@ export interface Options { pagePath: string; title: string; image: string; + imagePosition?: "left" | "right"; link?: ComponentType; + description?: string; } -export function createReadAllPage({ title, image, pagePath, link }: Options) { +export function createReadAllPage({ + title, + image, + pagePath, + link, + description, + imagePosition, +}: Options) { const Link = link ?? createLink(pagePath); return function Page({ sections }: Props) { @@ -44,7 +53,12 @@ export function createReadAllPage({ title, image, pagePath, link }: Options) { ); return ( -
+
; -} - -export function createSectionPage({ title, image, pagePath, link }: Options) { +export function createSectionPage({ + title, + image, + pagePath, + link, + description, + imagePosition, +}: Options) { const Link = link ?? createLink(pagePath); return function Page(this: void, { content, sections, current }: Props) { return ( -
+