From c9f596c27c1b1e4a8d592b9dc36719415925c51d Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard27 Date: Tue, 24 Jan 2023 13:29:35 +0100 Subject: [PATCH 1/3] feat: moved text field, applied styling --- packages/app/src/components/cms/rich-content.tsx | 2 +- .../app/src/domain/topical/components/topical-header.tsx | 6 +++--- packages/app/src/pages/index.tsx | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/app/src/components/cms/rich-content.tsx b/packages/app/src/components/cms/rich-content.tsx index 27055ff1e3..30b75e9e59 100644 --- a/packages/app/src/components/cms/rich-content.tsx +++ b/packages/app/src/components/cms/rich-content.tsx @@ -37,7 +37,7 @@ import { ChevronRight, Download, External as ExternalLinkIcon } from '@corona-da type ElementAlignment = 'start' | 'center' | 'end' | 'stretch'; interface RichContentProps { - blocks: PortableTextEntry[]; + blocks?: PortableTextEntry[]; contentWrapper?: FunctionComponent; imageSizes?: number[][]; elementAlignment?: ElementAlignment; diff --git a/packages/app/src/domain/topical/components/topical-header.tsx b/packages/app/src/domain/topical/components/topical-header.tsx index b4f3744af7..e9ca0600b4 100644 --- a/packages/app/src/domain/topical/components/topical-header.tsx +++ b/packages/app/src/domain/topical/components/topical-header.tsx @@ -5,15 +5,15 @@ import { PortableTextEntry } from '@sanity/block-content-to-react'; import { fontSizes } from '~/style/theme'; interface TopicalHeaderProps { - title: string; - description: PortableTextEntry[]; + title?: string; + description?: PortableTextEntry[]; } export const TopicalHeader = ({ title, description }: TopicalHeaderProps) => { return ( {title} - + diff --git a/packages/app/src/pages/index.tsx b/packages/app/src/pages/index.tsx index 64b9d5bb21..1dface2249 100644 --- a/packages/app/src/pages/index.tsx +++ b/packages/app/src/pages/index.tsx @@ -112,9 +112,12 @@ const Home = (props: StaticProps) => { paddingX={{ _: space[3], sm: space[4] }} maxWidth={TOPICAL_SEVERITY_INDICATOR_TILE_MAX_WIDTH} > - + + + + {currentSeverityLevelTexts && ( From a259d27770b617aead9b8cdc61cc3df9628fc965 Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard27 Date: Thu, 26 Jan 2023 17:14:24 +0100 Subject: [PATCH 2/3] feat: added conditional rendering of elements --- .../domain/topical/components/topical-header.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/app/src/domain/topical/components/topical-header.tsx b/packages/app/src/domain/topical/components/topical-header.tsx index e9ca0600b4..48cf7e1ebd 100644 --- a/packages/app/src/domain/topical/components/topical-header.tsx +++ b/packages/app/src/domain/topical/components/topical-header.tsx @@ -10,12 +10,17 @@ interface TopicalHeaderProps { } export const TopicalHeader = ({ title, description }: TopicalHeaderProps) => { + if (!title && !description) { + return null; + } return ( - {title} - - - + {title && {title}} + {description && ( + + + + )} ); }; From 128ba7a349ddd6d687334b20dcd17b9ea7a4dbe2 Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard27 Date: Tue, 31 Jan 2023 11:11:29 +0100 Subject: [PATCH 3/3] fix: reverted changes --- packages/app/src/components/cms/rich-content.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/components/cms/rich-content.tsx b/packages/app/src/components/cms/rich-content.tsx index 30b75e9e59..27055ff1e3 100644 --- a/packages/app/src/components/cms/rich-content.tsx +++ b/packages/app/src/components/cms/rich-content.tsx @@ -37,7 +37,7 @@ import { ChevronRight, Download, External as ExternalLinkIcon } from '@corona-da type ElementAlignment = 'start' | 'center' | 'end' | 'stretch'; interface RichContentProps { - blocks?: PortableTextEntry[]; + blocks: PortableTextEntry[]; contentWrapper?: FunctionComponent; imageSizes?: number[][]; elementAlignment?: ElementAlignment;