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

Commit

Permalink
feat(COR-1954): Substitute clock on pageinfoblock with metadataitem
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-van-eekelen committed Mar 18, 2024
1 parent df554e8 commit 25f1f70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { Box } from '~/components/base';
import { Clock, Database, MeerInformatie } from '@corona-dashboard/icons';
import { colors } from '@corona-dashboard/common';
import { Text } from '~/components/typography';
import React from 'react';
import { MetadataIcon } from '~/components/metadata/components/items/metadata-icon';
import { MetadataItem } from '~/components/metadata/components/items/metadata-item';
import { MetadataProps } from '~/components';
import { useIntl } from '~/intl';
import { MetadataReference } from '~/components/metadata/components/items/metadata-reference';

interface PageInformationBlockMetadataProps extends MetadataProps {
dateText: string | 0 | undefined;
dateText: string | undefined;
}

/**
Expand Down Expand Up @@ -43,12 +41,7 @@ export function PageInformationBlockMetadata({

return (
<Box spacing={2}>
<Box display="flex" alignItems="flex-start" color="gray7">
<MetadataIcon>
<Clock aria-hidden color={colors.gray7} />
</MetadataIcon>
<Text variant="label1">{dateText}</Text>
</Box>
{dateText && <MetadataItem icon={<Clock aria-hidden color={colors.gray7} />} items={[{ text: dateText }]} />}

{dataSources.length > 0 && (
<MetadataItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { MetadataIcon } from '~/components/metadata/components/items/metadata-ic

interface TileFooterMetadataProps extends MetadataProps {
dateString: string | null;
intervalString: string | undefined;
}

/**
Expand Down Expand Up @@ -50,17 +51,11 @@ export function TileFooterMetadata({
referenceLink,
disclaimer,
obtainedAt,
intervalCount,
intervalString,
}: TileFooterMetadataProps) {
const { commonTexts, formatDateFromSeconds } = useIntl();
const metadataText = commonTexts.common.metadata;

const intervalString =
intervalCount &&
replaceVariablesInText(commonTexts.common.metadata.interval, {
count: intervalCount,
});

return (
<Box as="footer" marginTop={space[3]} marginBottom={marginBottom || { _: '0', sm: `-${space[3]}` }} gridArea="metadata">
<Text color="gray7" variant="label1">
Expand Down
10 changes: 8 additions & 2 deletions packages/app/src/components/metadata/metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ export function Metadata({
})
: null;

const dateText = datumsText && dateOfInsertionUnix && dateOrRange && insertDateIntoString(formatDateFromSeconds, datumsText, dateOfInsertionUnix, dateOrRange);
const dateText = datumsText && dateOfInsertionUnix && dateOrRange ? insertDateIntoString(formatDateFromSeconds, datumsText, dateOfInsertionUnix, dateOrRange) : undefined;

const intervalString =
intervalCount &&
replaceVariablesInText(commonTexts.common.metadata.interval, {
count: intervalCount,
});

return (
<>
Expand Down Expand Up @@ -96,7 +102,7 @@ export function Metadata({
referenceLink={referenceLink}
disclaimer={disclaimer}
obtainedAt={obtainedAt}
intervalCount={intervalCount}
intervalString={intervalString}
/>
)}
</>
Expand Down

0 comments on commit 25f1f70

Please sign in to comment.