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

COR-1022 fixing CLS by removing nested Anchor tag #4385

Merged
merged 3 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/app/src/domain/topical/components/text-with-chevron.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Box } from '~/components/base';
import css from '@styled-system/css';
import styled from 'styled-components';
import { ChevronRight } from '@corona-dashboard/icons';
import { colors } from '@corona-dashboard/common';
import { Text } from '~/components/typography';

type TextWithChevronProps = {
label: string;
};

export const TextWithChevron = ({ label }: TextWithChevronProps) => {
return (
<Box
display="flex"
justifyContent="center"
alignItems="center"
bg={colors.lightBlue}
color={colors.blue}
padding={3}
className="topical-tile-cta"
css={css({
transition: 'background .1s ease-in-out',
Jorrik-Klijnsma-Work marked this conversation as resolved.
Show resolved Hide resolved
})}
>
<Text>{label}</Text>
<IconSmall>
<ChevronRight />
</IconSmall>
</Box>
);
}

const IconSmall = styled.div(
css({
display: 'inline',
textDecoration: 'inherit',
svg: {
width: 11,
height: 10,
},
marginLeft: 1,
})
);
VWSCoronaDashboard24 marked this conversation as resolved.
Show resolved Hide resolved
28 changes: 3 additions & 25 deletions packages/app/src/domain/topical/components/topical-tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { space } from '~/style/theme';
import css from '@styled-system/css';
import styled from 'styled-components';
import { Heading } from '~/components/typography';
import { LinkWithIcon } from '~/components/link-with-icon';
import { TextWithChevron } from './text-with-chevron';
import { asResponsiveArray } from '~/style/utils';
import { colors } from '@corona-dashboard/common';
import DynamicIcon from '~/components/get-icon-by-name';
import { ChevronRight, Down, Up } from '@corona-dashboard/icons';
import { Down, Up } from '@corona-dashboard/icons';
import { Markdown } from '~/components/markdown';
import { TopicalIcon } from '@corona-dashboard/common/src/types';

Expand Down Expand Up @@ -55,8 +55,6 @@ export function TopicalTile({
css={css({
'&:hover .topical-tile-cta': {
bg: colors.blue,
},
'&:hover .topical-tile-cta a': {
textDecoration: 'underline',
color: colors.white,
},
Expand Down Expand Up @@ -113,27 +111,7 @@ export function TopicalTile({
</Box>
</Box>

{cta ? (
<Box
display="flex"
justifyContent={'center'}
bg={colors.lightBlue}
color={colors.blue}
padding={3}
className="topical-tile-cta"
css={css({
transition: 'background .1s ease-in-out',
})}
>
<LinkWithIcon
href={cta.href}
icon={<ChevronRight />}
iconPlacement="right"
>
{cta.label}
</LinkWithIcon>
</Box>
) : null}
{cta && <TextWithChevron label={cta.label}></TextWithChevron>}
</>
</Box>
);
Expand Down