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

Commit

Permalink
Semantic adjustments (#4186)
Browse files Browse the repository at this point in the history
* feat(cor-510): semantic strong tags instead of bold

* feat(cor-511): remove heading from links

* fix: removed unused import
  • Loading branch information
hasan-ozaynaci authored Apr 15, 2022
1 parent 55183ca commit d3c4aa3
Show file tree
Hide file tree
Showing 49 changed files with 184 additions and 227 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Color, KeysOfType } from '@corona-dashboard/common';
import css from '@styled-system/css';
import styled from 'styled-components';
import { InlineText, Text } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { replaceVariablesInText } from '~/utils/replace-variables-in-text';
import { Box } from '../base';
import { AgeDemographicChartText, AgeDemographicDefaultValue } from './types';
Expand Down Expand Up @@ -33,25 +33,25 @@ export function AgeDemographicTooltipContent<
return (
<>
<Box px={3} py={2}>
<Text variant="h3" fontWeight="bold">
<BoldText variant="h3">
{replaceVariablesInText(text.age_group_range_tooltip, {
ageGroupRange: formatAgeGroupRange(value.age_group_range),
})}
</Text>
</BoldText>
</Box>
<Legend>
<LegendItem color={rightColor}>
<InlineText fontWeight="bold">
<BoldText>
{formatValue(value[rightMetricProperty] as unknown as number)}
</InlineText>{' '}
</BoldText>{' '}
{replaceVariablesInText(text.right_tooltip, {
ageGroupRange: formatAgeGroupRange(value.age_group_range),
})}
</LegendItem>
<LegendItem color={leftColor}>
<InlineText fontWeight="bold">
<BoldText>
{formatValue(value[leftMetricProperty] as unknown as number)}
</InlineText>{' '}
</BoldText>{' '}
{replaceVariablesInText(text.left_tooltip, {
ageGroupRange: formatAgeGroupRange(value.age_group_range),
})}
Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/components/article-teaser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Article, Block, ImageBlock } from '~/types/cms';
import { Link } from '~/utils/link';
import { BackgroundImage } from './background-image';
import { Box } from './base';
import { Anchor, Heading, InlineText, Text } from './typography';
import { Anchor, Heading, Text, BoldText } from './typography';

export type ArticleSummary = Pick<
Article,
Expand Down Expand Up @@ -41,10 +41,10 @@ export function ArticleTeaser(props: ArticleTeaserProps) {
</Heading>
<Text>{summary}</Text>

<InlineText aria-hidden="true" fontWeight="bold" color="link">
<BoldText aria-hidden="true" color="link">
{commonTexts.common.read_more}
<Arrow />
</InlineText>
</BoldText>
</StyledArticleTeaser>
</Link>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { css } from '@styled-system/css';
import { ReactNode } from 'react';
import { isDefined, isPresent } from 'ts-is-present';
import { Box } from '~/components/base';
import { Text } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { getThresholdValue } from '~/utils/get-threshold-value';

interface TooltipSubjectProps {
Expand All @@ -30,7 +30,7 @@ export function TooltipSubject({

return (
<Box spacing={1}>
{subject && <Text fontWeight="bold">{subject}</Text>}
{subject && <BoldText>{subject}</BoldText>}
<Box
m={0}
spacingHorizontal={2}
Expand Down
36 changes: 17 additions & 19 deletions packages/app/src/components/content-teaser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BackgroundImage } from '~/components/background-image';
import { Box } from '~/components/base';
import { HeadingLinkWithIcon } from '~/components/link-with-icon';
import { PublicationDate } from '~/components/publication-date';
import { Heading, Text } from '~/components/typography';
import { Text } from '~/components/typography';
import { SiteText } from '~/locale';
import { ImageBlock } from '~/types/cms';
import { isAbsoluteUrl } from '~/utils/is-absolute-url';
Expand Down Expand Up @@ -61,24 +61,22 @@ export function ContentTeaser({
category
)}
</Text>
<Heading level={variant === 'normal' ? 4 : 5} as="h2" color="blue">
<HeadingLinkWithIcon
href={
isAbsoluteUrl(slug)
? slug
: isWeeklyHighlight
? `/weekberichten/${slug}`
: isArticle
? `/artikelen/${slug}`
: slug
}
icon={<ArrowIconRight />}
iconPlacement="right"
underline
>
{title}
</HeadingLinkWithIcon>
</Heading>
<HeadingLinkWithIcon
href={
isAbsoluteUrl(slug)
? slug
: isWeeklyHighlight
? `/weekberichten/${slug}`
: isArticle
? `/artikelen/${slug}`
: slug
}
icon={<ArrowIconRight />}
iconPlacement="right"
underline
>
{title}
</HeadingLinkWithIcon>
</Box>
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { get } from 'lodash';
import { isDefined } from 'ts-is-present';
import { InlineDifference } from '~/components/difference-indicator';
import { InlineText } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { replaceComponentsInText } from '~/utils/replace-components-in-text';
import { Content, DataFile, DataKeys } from '..';
Expand Down Expand Up @@ -35,9 +35,7 @@ export function Difference<T extends DataKeys, K = DataFile<T>>(
<InlineDifference isAmount={isAmount} value={differenceValue} />
),
differenceAverage: (
<InlineText fontWeight="bold">
{formatNumber(differenceValue.old_value)}
</InlineText>
<BoldText>{formatNumber(differenceValue.old_value)}</BoldText>
),
...(additionalData || {}),
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DifferenceDecimal, DifferenceInteger } from '@corona-dashboard/common';
import { get } from 'lodash';
import { isDefined } from 'ts-is-present';
import { RelativeDate } from '~/components/relative-date';
import { InlineText } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { assert } from '~/utils/assert';
import { replaceComponentsInText } from '~/utils/replace-components-in-text';
Expand Down Expand Up @@ -60,9 +60,9 @@ export function Metric<T extends DataKeys, K = DataFile<T>>({
/>
),
propertyValue: (
<InlineText fontWeight="bold">
<BoldText>
{`${formatNumber(propertyValue)}${isPercentage ? '%' : ''}`}
</InlineText>
</BoldText>
),
...(additionalData || {}),
})}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DifferenceDecimal, DifferenceInteger } from '@corona-dashboard/common';
import { Down, Up } from '@corona-dashboard/icons';
import { InlineText } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { Container, IconContainer } from './containers';

Expand All @@ -17,9 +17,7 @@ export function InlineDifference({
if (value.difference > 0)
return (
<Container>
<InlineText fontWeight="bold">
{isAmount ? text.trend_meer : text.trend_hoger}
</InlineText>
<BoldText>{isAmount ? text.trend_meer : text.trend_hoger}</BoldText>
<IconContainer color="red">
<Up />
</IconContainer>
Expand All @@ -28,9 +26,7 @@ export function InlineDifference({
if (value.difference < 0)
return (
<Container>
<InlineText fontWeight="bold">
{isAmount ? text.trend_minder : text.trend_lager}
</InlineText>
<BoldText>{isAmount ? text.trend_minder : text.trend_lager}</BoldText>
<IconContainer color="data.primary">
<Down />
</IconContainer>
Expand All @@ -39,7 +35,7 @@ export function InlineDifference({

return (
<Container>
<InlineText fontWeight="bold">{text.trend_gelijk}</InlineText>
<BoldText>{text.trend_gelijk}</BoldText>
</Container>
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import css from '@styled-system/css';
import { DifferenceDecimal, DifferenceInteger } from '@corona-dashboard/common';
import { Down, Gelijk, Up } from '@corona-dashboard/icons';
import { InlineText } from '~/components/typography';
import css from '@styled-system/css';
import { BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { Container, IconContainer } from './containers';
import { Markdown } from '~/components/markdown';
Expand Down Expand Up @@ -66,9 +66,7 @@ export function TileAverageDifference({
<Markdown
renderersOverrides={{
paragraph: 'span',
strong: (props) => (
<InlineText fontWeight="bold">{props.children}</InlineText>
),
strong: (props) => <BoldText>{props.children}</BoldText>,
}}
content={replaceVariablesInText(content, {
amount: `${formattedDifference}${isPercentage ? '%' : ''}`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import css from '@styled-system/css';
import { DifferenceDecimal, DifferenceInteger } from '@corona-dashboard/common';
import { Down, Gelijk, Up } from '@corona-dashboard/icons';
import css from '@styled-system/css';
import { Markdown } from '~/components/markdown';
import { InlineText } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { replaceVariablesInText } from '~/utils/replace-variables-in-text';
import { Container, IconContainer } from './containers';
Expand Down Expand Up @@ -65,7 +65,7 @@ export function TileDifference({
renderersOverrides={{
paragraph: 'span',
strong: (props) => (
<InlineText fontWeight="bold">{props.children}</InlineText>
<BoldText>{props.children}</BoldText>
),
}}
content={replaceVariablesInText(
Expand Down
6 changes: 2 additions & 4 deletions packages/app/src/components/interactive-legend.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import css from '@styled-system/css';
import styled from 'styled-components';
import { isDefined } from 'ts-is-present';
import { Text } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { Box } from './base';

Expand Down Expand Up @@ -34,9 +34,7 @@ export function InteractiveLegend<T = string>({

return (
<Box>
<Text variant="label1" fontWeight="bold">
{helpText}
</Text>
<BoldText variant="label1">{helpText}</BoldText>
<Legend>
<List>
{selectOptions.map((item) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/link-with-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export function HeadingLinkWithIcon({
const isSingleWord = words.length === 1;

return (
<Box as="span" display="inline-block" position="relative">
<Box display="inline-block" position="relative">
<Link href={href} passHref locale={false}>
<Anchor color="inherit" hoverColor="blue">
<Anchor variant="h5" color="blue" hoverColor="blue">
<Box
paddingRight={isSingleWord ? `calc(0.5rem + 18px)` : ''}
css={css({
Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/components/notification-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box, Spacer } from '~/components/base';
import { Markdown } from '~/components/markdown';
import { MaxWidth } from '~/components/max-width';
import { useCollapsible } from '~/utils/use-collapsible';
import { InlineText } from './typography';
import { InlineText, BoldText } from './typography';

interface NotificationBannerProps {
title: string;
Expand Down Expand Up @@ -52,19 +52,19 @@ export function NotificationBanner({
mt: 1,
})}
>
<InlineText fontWeight="bold">
<BoldText>
{titleWithoutLastWord}{' '}
<Box display="inline-flex" position="relative">
<InlineText>
{lastWord}
{collapsible.chevron}
</InlineText>
</Box>
</InlineText>
</BoldText>
</Box>
)
) : (
<InlineText fontWeight="bold">{title}</InlineText>
<BoldText>{title}</BoldText>
)}

{hasDescription &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import css from '@styled-system/css';
import styled from 'styled-components';
import { Box } from '~/components/base';
import { ExternalLink } from '~/components/external-link';
import { Anchor, InlineText, Text } from '~/components/typography';
import { Anchor, InlineText, BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { spacingStyle } from '~/style/functions/spacing';
import { space } from '~/style/theme';
Expand All @@ -26,9 +26,7 @@ export function PageLinks({ links }: pageLinksProps) {

return (
<Box spacing={2}>
<Text fontWeight="bold">
{commonTexts.informatie_header.handige_links}
</Text>
<BoldText>{commonTexts.informatie_header.handige_links}</BoldText>
<OrderedList>
{links.map((link, index) => (
<ListItem key={index}>
Expand Down
7 changes: 3 additions & 4 deletions packages/app/src/components/pie-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Box, Spacer } from '~/components/base';
import { ErrorBoundary } from '~/components/error-boundary';
import { LinkWithIcon } from '~/components/link-with-icon';
import { Markdown } from '~/components/markdown';
import { InlineText } from '~/components/typography';
import { BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { WithTooltip } from '~/lib/tooltip';
import { replaceVariablesInText } from '~/utils/replace-variables-in-text';
Expand Down Expand Up @@ -215,14 +215,13 @@ export function PieChart<T>({

<Box spacing={2}>
{title && (
<InlineText
fontWeight="bold"
<BoldText
css={css({
display: 'block',
})}
>
{title}
</InlineText>
</BoldText>
)}
<Box
spacing={2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MouseEvent, TouchEvent } from 'react';
import { isDefined } from 'ts-is-present';
import { Box } from '~/components/base';
import { IconButton } from '~/components/icon-button';
import { Anchor, InlineText, Text } from '~/components/typography';
import { Anchor, InlineText, Text, BoldText } from '~/components/typography';
import { useIntl } from '~/intl';
import { useIsTouchDevice } from '~/utils/use-is-touch-device';
import { TimelineEventConfig } from '../logic';
Expand Down Expand Up @@ -80,9 +80,7 @@ export function TimelineTooltipContent({
</Text>
)}

<Text variant="label1" fontWeight="bold">
{config.title}
</Text>
<BoldText variant="label1">{config.title}</BoldText>
<Text variant="label1">{config.description}</Text>
</Box>

Expand Down
Loading

0 comments on commit d3c4aa3

Please sign in to comment.