diff --git a/packages/app/src/domain/topical/components/topical-tile/index.ts b/packages/app/src/domain/topical/components/topical-tile/index.ts new file mode 100644 index 0000000000..756e929d08 --- /dev/null +++ b/packages/app/src/domain/topical/components/topical-tile/index.ts @@ -0,0 +1 @@ +export * from './topical-tile'; \ No newline at end of file diff --git a/packages/app/src/domain/topical/components/topical-tile/topical-tile.tsx b/packages/app/src/domain/topical/components/topical-tile/topical-tile.tsx new file mode 100644 index 0000000000..09138b33be --- /dev/null +++ b/packages/app/src/domain/topical/components/topical-tile/topical-tile.tsx @@ -0,0 +1,137 @@ +import { Box } from '~/components/base'; +import css from '@styled-system/css'; +import styled from 'styled-components'; +import { Heading } from '~/components/typography'; +import { LinkWithIcon } from '~/components/link-with-icon'; +import { asResponsiveArray } from '~/style/utils'; +import { colors } from '@corona-dashboard/common'; +import DynamicIcon from '~/components/get-icon-by-name'; +import { Chevron, Down, Up } from '@corona-dashboard/icons'; +import { Markdown } from '~/components/markdown'; +import { TopicalIcon } from '@corona-dashboard/common/src/types'; +import { isDefined } from 'ts-is-present'; + +interface IconWrapperProps { + iconColor: string; +} + +type TrendIcon = { + direction: 'UP' | 'DOWN'; + color: 'GREEN' | 'RED'; +} | null; + +type Cta = { + label: string; + href: string; +} | null; + +interface TopicalTileProps { + title: string; + tileIcon: TopicalIcon; + trendIcon?: TrendIcon; + dynamicDescription: string; + cta?: Cta; +} + +export function TopicalTile({ + title, + tileIcon, + trendIcon, + dynamicDescription, + cta, +}: TopicalTileProps) { + return ( + + + + + + + + + {title} + {isDefined(trendIcon) && trendIcon !== null && ( + + {trendIcon.direction === 'DOWN' && } + {trendIcon.direction === 'UP' && } + + )} + + + + + + + + + + {isDefined(cta) && cta !== null && ( + } + iconPlacement="right" + > + {cta.label} + + )} + + + ); +} + +const IconWrapper = styled.span((x) => + css({ + color: x.iconColor, + display: 'inline-flex', + alignItems: 'center', + width: '20px', + marginLeft: '15px;', + }) +); + +const KpiIcon = styled.span( + css({ + color: colors.white, + backgroundColor: colors.blue, + position: 'absolute', + display: 'block', + width: asResponsiveArray({ _: 40, sm: 50 }), + height: asResponsiveArray({ _: 40, sm: 50 }), + right: 0, + top: 0, + padding: asResponsiveArray(2), + }) +); diff --git a/packages/app/src/pages/nieuw-actueel.tsx b/packages/app/src/pages/nieuw-actueel.tsx index c44612acb5..fcfe68b037 100644 --- a/packages/app/src/pages/nieuw-actueel.tsx +++ b/packages/app/src/pages/nieuw-actueel.tsx @@ -4,8 +4,8 @@ import { Layout } from '~/domain/layout'; import { ArticleList, TopicalSectionHeader } from '~/domain/topical'; import { isPresent } from 'ts-is-present'; import { Search } from '~/domain/topical/components/search'; +import { TopicalTile } from '~/domain/topical/components/topical-tile'; import { Languages, SiteText } from '~/locale'; -import DynamicIcon from '~/components/get-icon-by-name'; import { createGetStaticProps, StaticProps, @@ -17,6 +17,7 @@ import { selectTopicalData, } from '~/static-props/get-data'; import { useDynamicLokalizeTexts } from '~/utils/cms/use-dynamic-lokalize-texts'; +import { colors } from '@corona-dashboard/common'; const selectLokalizeTexts = (siteText: SiteText) => ({ hospitalText: siteText.pages.hospital_page.nl, @@ -55,17 +56,46 @@ const Home = (props: StaticProps) => { return ( - {selectedTopicalData.title} - + + {selectedTopicalData.title} - - - + {selectedTopicalData.themes + .sort((a, b) => a.index - b.index) + .map((theme) => { + return ( + + {theme.themeTiles + .sort((a, b) => a.index - b.index) + .map((themeTile) => { + return ( + + ); + })} + + ); + })}