From e8a3d05c936aed4a2cf2c8a861efd322709cd32e Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard19 Date: Wed, 31 Aug 2022 09:38:00 +0200 Subject: [PATCH] fix: underline adjustments and code optimisations - Fix underline issue for FireFox browser - Reusable component and cleanup for external link icon --- packages/app/src/components/anchor-tile.tsx | 22 +++++++---------- .../components/page-links.tsx | 9 +++---- packages/app/src/components/typography.tsx | 6 ++++- .../app/src/pages/landelijk/coronamelder.tsx | 24 +++++++------------ 4 files changed, 25 insertions(+), 36 deletions(-) diff --git a/packages/app/src/components/anchor-tile.tsx b/packages/app/src/components/anchor-tile.tsx index 9fc3afc0e7..110367d79a 100644 --- a/packages/app/src/components/anchor-tile.tsx +++ b/packages/app/src/components/anchor-tile.tsx @@ -3,6 +3,7 @@ import { External as ExternalLinkIcon } from '@corona-dashboard/icons'; import css from '@styled-system/css'; import styled from 'styled-components'; import { Anchor, Heading } from '~/components/typography'; +import { Box } from '~/components/base'; import { asResponsiveArray } from '~/style/utils'; import { Link } from '~/utils/link'; import { ExternalLink } from './external-link'; @@ -33,12 +34,12 @@ export function AnchorTile({ {external ? ( - - + + - + {label} - + ) : ( @@ -52,10 +53,10 @@ export function AnchorTile({ ); } -const ExternalLinkIconContainer = styled.div( +export const IconWrapper = styled.span( css({ - display: 'flex', - alignItems: 'center', + mr: 2, + svg: { width: 24, height: 11, display: 'block', maxWidth: 'initial' }, }) ); @@ -82,13 +83,6 @@ const StyledAnchor = styled(Anchor)( }) ); -const IconContainer = styled.span( - css({ - mr: 2, - svg: { width: 24, height: 11, display: 'block', maxWidth: 'initial' }, - }) -); - const LinkContainer = styled.div( css({ flexShrink: 1, diff --git a/packages/app/src/components/page-information-block/components/page-links.tsx b/packages/app/src/components/page-information-block/components/page-links.tsx index 52e906c837..b3be6f39f6 100644 --- a/packages/app/src/components/page-information-block/components/page-links.tsx +++ b/packages/app/src/components/page-information-block/components/page-links.tsx @@ -65,7 +65,7 @@ function TitleWithIcon({ title, icon }: { title: string; icon?: JSX.Element }) { {lastWord} - {icon} + {icon} @@ -91,12 +91,9 @@ const ListItem = styled.li( }) ); -const IconContainer = styled.span( +const IconWrapper = styled.span( css({ - position: 'absolute', - right: -13, - top: 0, - + ml: 1, svg: { width: 11, height: 11, diff --git a/packages/app/src/components/typography.tsx b/packages/app/src/components/typography.tsx index 4b28282436..9171b31a8e 100644 --- a/packages/app/src/components/typography.tsx +++ b/packages/app/src/components/typography.tsx @@ -63,7 +63,11 @@ export const Anchor = styled.a( props.underline && css({ textDecoration: props.underline === 'hover' ? 'none' : 'underline', - '&:hover, &:focus': { textDecoration: 'underline' }, + '&:hover, &:focus': { + span: { + textDecoration: 'underline', + }, + }, }), (props) => props.hoverColor && diff --git a/packages/app/src/pages/landelijk/coronamelder.tsx b/packages/app/src/pages/landelijk/coronamelder.tsx index d7b382e91b..04a4b8445c 100644 --- a/packages/app/src/pages/landelijk/coronamelder.tsx +++ b/packages/app/src/pages/landelijk/coronamelder.tsx @@ -1,8 +1,7 @@ import { colors, TimeframeOptionsList } from '@corona-dashboard/common'; -import { External, Phone } from '@corona-dashboard/icons'; +import { External as ExternalLinkIcon, Phone } from '@corona-dashboard/icons'; import { css } from '@styled-system/css'; import { isEmpty } from 'lodash'; -import styled from 'styled-components'; import { WarningTile } from '~/components'; import { ChartTile } from '~/components/chart-tile'; import { KpiTile } from '~/components/kpi-tile'; @@ -14,6 +13,8 @@ import { TileList } from '~/components/tile-list'; import { TimeSeriesChart } from '~/components/time-series-chart'; import { TwoKpiSection } from '~/components/two-kpi-section'; import { Heading, Text, BoldText } from '~/components/typography'; +import { Box } from '~/components/base'; +import { IconWrapper } from '~/components/anchor-tile'; import { Layout } from '~/domain/layout/layout'; import { NlLayout } from '~/domain/layout/nl-layout'; import { useIntl } from '~/intl'; @@ -134,10 +135,12 @@ const CoronamelderPage = (props: StaticProps) => { {corona_melder_app.rapport.description} - - - + + + + + {corona_melder_app.rapport.link.text} @@ -189,12 +192,3 @@ const CoronamelderPage = (props: StaticProps) => { }; export default CoronamelderPage; - -const IconContainer = styled.span( - css({ - marginRight: 3, - color: 'gray', - height: 25, - width: 25, - }) -);