Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Feature/cor 615 fix two kpi tiles with one column (#4257)
Browse files Browse the repository at this point in the history
* change to grid

* Remove extra KPI tile

* Fix margins and paddings
  • Loading branch information
Jorrik-Klijnsma-Work authored May 19, 2022
1 parent 4d02ed5 commit f506760
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
23 changes: 10 additions & 13 deletions packages/app/src/components/two-kpi-section.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import css from '@styled-system/css';
import React from 'react';
import React, { Children } from 'react';
import { asResponsiveArray } from '~/style/utils';
import { Box } from './base';

Expand All @@ -9,19 +8,17 @@ interface TwoKpiSectionProps {
}

export function TwoKpiSection({ children, spacing }: TwoKpiSectionProps) {
const hasOnlyOneChild = Children.toArray(children).length === 1;

return (
<Box
display="flex"
flexDirection={{ _: 'column', lg: 'row' }}
css={css({
'& > *': {
flex: 1,
},
'& > *:not(:last-child)': {
mr: asResponsiveArray({ _: 0, lg: spacing ?? 5 }),
mb: asResponsiveArray({ _: spacing ?? 4, lg: 0 }),
},
})}
display="grid"
gridTemplateColumns={asResponsiveArray({ _: '1fr', lg: '1fr 1fr' })}
gridColumnGap={asResponsiveArray({ _: 0, lg: spacing ?? '10rem' })}
gridRowGap={asResponsiveArray({ _: '3rem', lg: spacing ?? '8rem' })}
borderTop={hasOnlyOneChild ? 'solid 2px lightGray' : undefined}
pt={hasOnlyOneChild ? 4 : undefined}
pb={hasOnlyOneChild ? asResponsiveArray({ _: 3, sm: 4 }) : undefined}
>
{children}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function VaccinationsShotKpiSection({

return (
<TwoKpiSection>
<KpiTile title={text.title}>
<KpiTile title={text.title} hasNoBorder>
<KpiValue text={formatNumber(value)} />
<Markdown content={text.description} />
{text.warning && <Message variant="warning">{text.warning}</Message>}
Expand All @@ -47,7 +47,6 @@ export function VaccinationsShotKpiSection({
}}
/>
</KpiTile>
<KpiTile />
</TwoKpiSection>
);
}

0 comments on commit f506760

Please sign in to comment.