This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: created new kpi tiles for hospital and care
- Loading branch information
1 parent
1800d59
commit 06e1123
Showing
6 changed files
with
170 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/app/src/domain/hospital/hospitals-tile/hospitals-tile.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Box } from '~/components/base'; | ||
import { KpiTile } from '~/components/kpi-tile'; | ||
import { Metadata, MetadataProps } from '~/components/metadata'; | ||
import { TwoKpiSection } from '~/components/two-kpi-section'; | ||
import { BoldText, Text } from '~/components/typography'; | ||
import styled from 'styled-components'; | ||
import { colors, DifferenceInteger } from '@corona-dashboard/common'; | ||
import theme, { space } from '~/style/theme'; | ||
import { KpiValue } from '~/components/kpi-value'; | ||
import { Markdown } from '~/components/markdown'; | ||
|
||
interface HospitalsTileProps { | ||
title: string; | ||
description: string; | ||
source: { | ||
text: string; | ||
href: string; | ||
}; | ||
dateUnix: number; | ||
tilesData: [TileData, TileData]; | ||
} | ||
|
||
export type TileData = { | ||
title: string; | ||
description: string; | ||
absoluteValue: number | null; | ||
differenceValue: DifferenceInteger; | ||
dataProperty?: string; | ||
}; | ||
|
||
export const HospitalsTile = ({ title, description, source, dateUnix, tilesData }: HospitalsTileProps) => { | ||
const metadata: MetadataProps = { | ||
date: dateUnix, | ||
source: source, | ||
}; | ||
|
||
return ( | ||
<KpiTile title={title} hasNoPaddingBottom> | ||
<Text>{description}</Text> | ||
<TwoKpiSection spacing={5}> | ||
<KpiContent> | ||
{tilesData.map((tile, index) => { | ||
return ( | ||
<Box key={index}> | ||
<BoldText>{tile.title}</BoldText> | ||
<Box paddingTop={space[3]} paddingBottom={space[1]}> | ||
<KpiValue data-cy={tile.dataProperty} absolute={tile.absoluteValue} difference={tile.differenceValue} isAmount /> | ||
</Box> | ||
<Markdown content={tile.description} /> | ||
</Box> | ||
); | ||
})} | ||
</KpiContent> | ||
</TwoKpiSection> | ||
<Metadata {...metadata} isTileFooter /> | ||
</KpiTile> | ||
); | ||
}; | ||
|
||
export const KpiContent = styled(Box)` | ||
border: 1px solid ${colors.gray3}; | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
color: ${colors.black}; | ||
padding: 24px ${space[3]}; | ||
gap: ${space[5]}; | ||
@media ${theme.mediaQueries.sm} { | ||
flex-direction: row; | ||
padding: 24px; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { AdmissionsPerAgeGroup } from './admissions-per-age-group/admissions-per-age-group'; | ||
export { HospitalsTile } from './hospitals-tile/hospitals-tile'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters