From 285c375e80561e34c050a5f857a37b882a751d3c Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard19 Date: Tue, 24 May 2022 14:06:42 +0200 Subject: [PATCH] fix: revert changes, replace with empty div and pass optional props --- .../app/src/components/two-kpi-section.tsx | 35 +++++++++++++------ .../vaccine/vaccinations-shot-kpi-section.tsx | 18 ++++++---- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/packages/app/src/components/two-kpi-section.tsx b/packages/app/src/components/two-kpi-section.tsx index 2183ac7e20..1b63a16e75 100644 --- a/packages/app/src/components/two-kpi-section.tsx +++ b/packages/app/src/components/two-kpi-section.tsx @@ -1,24 +1,37 @@ -import React, { Children } from 'react'; +import React from 'react'; +import css from '@styled-system/css'; import { asResponsiveArray } from '~/style/utils'; import { Box } from './base'; interface TwoKpiSectionProps { children: React.ReactNode; spacing?: number; + hasBorder?: boolean; + hasPadding?: boolean; } -export function TwoKpiSection({ children, spacing }: TwoKpiSectionProps) { - const hasOnlyOneChild = Children.toArray(children).length === 1; - +export function TwoKpiSection({ + children, + spacing, + hasBorder = false, + hasPadding = false, +}: TwoKpiSectionProps) { return ( *': { + flex: 1, + }, + '& > *:not(:last-child)': { + mr: asResponsiveArray({ _: 0, lg: spacing ?? 5 }), + mb: asResponsiveArray({ _: spacing ?? 4, lg: 0 }), + }, + })} > {children} diff --git a/packages/app/src/domain/vaccine/vaccinations-shot-kpi-section.tsx b/packages/app/src/domain/vaccine/vaccinations-shot-kpi-section.tsx index 72ee4faefd..48f0a60d6f 100644 --- a/packages/app/src/domain/vaccine/vaccinations-shot-kpi-section.tsx +++ b/packages/app/src/domain/vaccine/vaccinations-shot-kpi-section.tsx @@ -1,10 +1,13 @@ -import { KpiTile } from '~/components/kpi-tile'; -import { KpiValue } from '~/components/kpi-value'; -import { Markdown } from '~/components/markdown'; -import { TwoKpiSection } from '~/components/two-kpi-section'; import { useIntl } from '~/intl'; -import { Metadata } from '~/components/metadata'; -import { Message } from '~/components/message'; +import { + KpiTile, + KpiValue, + Markdown, + TwoKpiSection, + Metadata, + Message, +} from '~/components'; +import { Box } from '~/components/base'; type SourceType = { text: string; @@ -33,7 +36,7 @@ export function VaccinationsShotKpiSection({ const { formatNumber } = useIntl(); return ( - + @@ -47,6 +50,7 @@ export function VaccinationsShotKpiSection({ }} /> + ); }