From d40aa455de3b28fbf7616167647e46786fb2ad70 Mon Sep 17 00:00:00 2001 From: Chuma McPhoy Date: Fri, 27 Sep 2024 08:49:27 +0200 Subject: [PATCH] feat: content page UI updates --- .../ContentPage/contentPage.module.css | 36 ++++++++++++++++--- components/ContentType/ContentPage/index.tsx | 29 ++++++++------- components/JsonToHtml/jsontohtml.module.css | 25 +++++++++---- components/JsonToHtml/renderOptions.tsx | 11 +++++- components/Sidebar/sidebar.module.css | 2 ++ 5 files changed, 79 insertions(+), 24 deletions(-) diff --git a/components/ContentType/ContentPage/contentPage.module.css b/components/ContentType/ContentPage/contentPage.module.css index 9ba97d7f9..db1de0540 100644 --- a/components/ContentType/ContentPage/contentPage.module.css +++ b/components/ContentType/ContentPage/contentPage.module.css @@ -17,21 +17,37 @@ max-width: var(--max-width-content); margin: 0 auto; } + .headerIntro { display: grid; max-width: var(--max-width-text-block); gap: var(--Spacing-x3); } -.content { - padding: var(--Spacing-x4) var(--Spacing-x2); - display: grid; - justify-items: center; +.heroContainer { + width: 100%; + padding-bottom: var(--Spacing-x4); + padding-top: var(--Spacing-x4); +} + +.heroContainer img { + max-width: var(--max-width-content); + margin: 0 auto; + display: block; +} + +.contentContainer { + display: flex; + flex-direction: column; + padding-top: var(--Spacing-x4); +} + +.mainContent { + width: 100%; } .innerContent { width: 100%; - max-width: var(--max-width-content); } @media (min-width: 768px) { @@ -39,3 +55,13 @@ gap: var(--Spacing-x3); } } + +@media (min-width: 1367px) { + .contentContainer { + display: grid; + grid-template-columns: var(--max-width-text-block) 1fr; + gap: var(--Spacing-x9); + max-width: var(--max-width-content); + margin: 0 auto; + } +} diff --git a/components/ContentType/ContentPage/index.tsx b/components/ContentType/ContentPage/index.tsx index 3e7c59abb..5b9807d2e 100644 --- a/components/ContentType/ContentPage/index.tsx +++ b/components/ContentType/ContentPage/index.tsx @@ -23,8 +23,6 @@ export default async function ContentPage() { return ( <>
- {sidebar?.length ? : null} -
@@ -37,17 +35,24 @@ export default async function ContentPage() {
-
-
- {hero_image ? ( - - ) : null} - {blocks ? : null} + {hero_image && ( +
+
-
+ )} + +
+
+
+ {blocks ? : null} +
+
+ + {sidebar?.length ? : null} +
diff --git a/components/JsonToHtml/jsontohtml.module.css b/components/JsonToHtml/jsontohtml.module.css index 94e27d4b8..d55923c69 100644 --- a/components/JsonToHtml/jsontohtml.module.css +++ b/components/JsonToHtml/jsontohtml.module.css @@ -18,16 +18,12 @@ color: var(--Primary-Light-On-Surface-Accent); } -.li:has(.heart), -.li:has(.check) { - list-style: none; -} - .li { margin-left: var(--Spacing-x3); } -.li:has(.heart):before { +.heart > .li::before, +.li:has(.heart)::before { content: url("/_static/icons/heart.svg"); position: relative; height: 8px; @@ -36,6 +32,14 @@ margin-left: calc(var(--Spacing-x3) * -1); } +.heart > .li, +.check > .li, +.li:has(.check), +.li:has(.heart) { + list-style: none; +} + +.check > .li::before, .li:has(.check)::before { content: url("/_static/icons/check-ring.svg"); position: relative; @@ -59,6 +63,7 @@ max-width: 100%; overflow-x: auto; } + @media screen and (min-width: 768px) { .ol:has(li:nth-last-child(n + 5)), .ul:has(li:nth-last-child(n + 5)) { @@ -66,3 +71,11 @@ grid-auto-flow: column; } } + +@container sidebar (max-width: 390px) { + .ol, + .ul { + display: flex; + flex-direction: column; + } +} diff --git a/components/JsonToHtml/renderOptions.tsx b/components/JsonToHtml/renderOptions.tsx index 77f1b41f5..7f8420bf6 100644 --- a/components/JsonToHtml/renderOptions.tsx +++ b/components/JsonToHtml/renderOptions.tsx @@ -526,6 +526,15 @@ export const renderOptions: RenderOptions = { ) => { const props = extractPossibleAttributes(node.attrs) + if (props.className) { + if (hasAvailableULFormat(props.className)) { + // @ts-ignore: We want to set css modules classNames even if it does not correspond + // to an existing class in the module style sheet. Due to our css modules plugin for + // typescript, we cannot do this without the ts-ignore + props.className = styles[props.className] + } + } + // Set the number of rows dynamically to create even rows for each column. We want the li:s // to flow with the column, so therefore this is needed. let numberOfRows: number | undefined @@ -538,7 +547,7 @@ export const renderOptions: RenderOptions = {