Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { allModes } from '../../../.storybook/modes';
import preview from '../../../.storybook/preview';
import { OnwardLink as OnwardLinkComponent } from './OnwardLink';

const meta = preview.meta({
title: 'Components/Election Trackers/Onward Link',
component: OnwardLinkComponent,
parameters: {
chromatic: {
modes: {
'vertical mobileMedium': allModes['vertical mobileMedium'],
},
},
},
});

export const OnwardLink = meta.story({
args: {
link: new URL('https://www.theguardian.com'),
text: 'Full results',
},
});
33 changes: 33 additions & 0 deletions dotcom-rendering/src/components/ElectionTrackers/OnwardLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { css } from '@emotion/react';
import { space } from '@guardian/source/foundations';
import {
LinkButton,
SvgArrowRightStraight,
} from '@guardian/source/react-components';
import { palette } from '../../palette';

type Props = {
link: URL;
text: string;
};

/**
* An instance of a Source `LinkButton` for linking to a full results page from
* an election tracker.
*/
export const OnwardLink = (props: Props) => (
<LinkButton
icon={<SvgArrowRightStraight />}
iconSide="right"
theme={{
backgroundPrimary: palette('--election-tracker-button-background'),
textPrimary: palette('--election-tracker-button-text'),
}}
cssOverrides={css({
marginTop: space[4],
})}
href={props.link.href}
>
{props.text}
</LinkButton>
);
8 changes: 8 additions & 0 deletions dotcom-rendering/src/paletteDeclarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7157,6 +7157,14 @@ const paletteColours = {
light: () => sourcePalette.neutral[86],
dark: () => sourcePalette.neutral[20],
},
'--election-tracker-button-background': {
light: () => sourcePalette.neutral[7],
dark: () => sourcePalette.neutral[100],
},
'--election-tracker-button-text': {
light: () => sourcePalette.neutral[100],
dark: () => sourcePalette.neutral[7],
},
'--email-signup-button-background': {
light: emailSignupButtonBackgroundLight,
dark: emailSignupButtonBackgroundDark,
Expand Down
Loading