diff --git a/dotcom-rendering/src/components/FootballMatchHeader/Tabs.stories.tsx b/dotcom-rendering/src/components/FootballMatchHeader/Tabs.stories.tsx new file mode 100644 index 00000000000..7a3a2758847 --- /dev/null +++ b/dotcom-rendering/src/components/FootballMatchHeader/Tabs.stories.tsx @@ -0,0 +1,46 @@ +import type { Meta, StoryObj } from '@storybook/react-webpack5'; +import { gridContainerDecorator } from '../../../.storybook/decorators/gridDecorators'; +import { palette } from '../../palette'; +import { Tabs } from './Tabs'; + +const meta = { + component: Tabs, +} satisfies Meta; + +export default meta; + +type Story = StoryObj; + +export const MatchInfoWhenFixture = { + args: { + selected: 'info', + }, + parameters: { + colourSchemeBackground: { + light: palette('--football-match-header-fixture-result-background'), + dark: palette('--football-match-header-fixture-result-background'), + }, + }, + decorators: [gridContainerDecorator], +} satisfies Story; + +export const LiveWhenLive = { + ...MatchInfoWhenFixture, + args: { + selected: 'live', + infoURL: new URL( + 'https://www.theguardian.com/football/match/2025/nov/26/arsenal-v-bayernmunich', + ), + }, +} satisfies Story; + +export const ReportWhenResult = { + ...MatchInfoWhenFixture, + args: { + selected: 'report', + liveURL: new URL( + 'https://www.theguardian.com/football/live/2025/nov/26/arsenal-v-bayern-munich-champions-league-live', + ), + infoURL: LiveWhenLive.args.infoURL, + }, +} satisfies Story; diff --git a/dotcom-rendering/src/components/FootballMatchHeader/Tabs.tsx b/dotcom-rendering/src/components/FootballMatchHeader/Tabs.tsx new file mode 100644 index 00000000000..f59783d3893 --- /dev/null +++ b/dotcom-rendering/src/components/FootballMatchHeader/Tabs.tsx @@ -0,0 +1,148 @@ +import { css } from '@emotion/react'; +import { + from, + headlineBold15Object, + headlineBold17Object, + space, +} from '@guardian/source/foundations'; +import type { ReactNode } from 'react'; +import { grid } from '../../grid'; +import { palette } from '../../palette'; + +type Props = + | { + selected: 'info'; + reportURL?: URL; + liveURL?: URL; + } + | { + selected: 'live'; + reportURL?: URL; + infoURL: URL; + } + | { + selected: 'report'; + liveURL?: URL; + infoURL: URL; + }; + +export const Tabs = (props: Props) => ( + +); + +const MatchReport = (props: Props) => { + if (props.selected === 'report') { + return Match report; + } + + if (props.reportURL !== undefined) { + return Match report; + } + + return null; +}; + +const LiveFeed = (props: Props) => { + if (props.selected === 'live') { + return Live feed; + } + + if (props.liveURL !== undefined) { + return Live feed; + } + + return null; +}; + +const MatchInfo = (props: Props) => { + if (props.selected === 'info') { + return Match info; + } + + return Match info; +}; + +const Tab = (props: { children: ReactNode; href?: URL }) => ( +
  • + {props.children} +
  • +); + +const TabText = (props: { children: ReactNode; href?: URL }) => { + if (props.href !== undefined) { + return ( + + {props.children} + + ); + } + + return ( + + {props.children} + + ); +}; + +const tabTextStyles = css({ + display: 'block', + paddingBottom: space[2], + borderBottomWidth: space[1], + borderBottomStyle: 'solid', + borderBottomColor: 'transparent', + color: palette('--football-match-header-fixture-result-primary-text'), + textDecoration: 'none', + '&:hover': { + borderBottomColor: palette( + '--football-match-header-fixture-result-selected', + ), + }, + [from.leftCol]: { + paddingRight: space[6], + paddingBottom: space[3], + }, +}); diff --git a/dotcom-rendering/src/paletteDeclarations.ts b/dotcom-rendering/src/paletteDeclarations.ts index c4211185d75..73d810baaec 100644 --- a/dotcom-rendering/src/paletteDeclarations.ts +++ b/dotcom-rendering/src/paletteDeclarations.ts @@ -7047,6 +7047,26 @@ const paletteColours = { light: () => sourcePalette.neutral[97], dark: () => sourcePalette.neutral[10], }, + '--football-match-header-fixture-result-background': { + light: () => sourcePalette.sport[300], + dark: () => sourcePalette.sport[300], + }, + '--football-match-header-fixture-result-border': { + light: () => `${sourcePalette.neutral[100]}33`, + dark: () => `${sourcePalette.neutral[100]}33`, + }, + '--football-match-header-fixture-result-primary-text': { + light: () => sourcePalette.neutral[100], + dark: () => sourcePalette.neutral[100], + }, + '--football-match-header-fixture-result-secondary-text': { + light: () => sourcePalette.sport[700], + dark: () => sourcePalette.sport[700], + }, + '--football-match-header-fixture-result-selected': { + light: () => sourcePalette.sport[600], + dark: () => sourcePalette.sport[600], + }, '--football-match-hover': { light: () => sourcePalette.neutral[93], dark: () => sourcePalette.neutral[38],