diff --git a/dotcom-rendering/src/components/DecideContainerByTrails.stories.tsx b/dotcom-rendering/src/components/DecideContainerByTrails.stories.tsx new file mode 100644 index 00000000000..b0b49b3a477 --- /dev/null +++ b/dotcom-rendering/src/components/DecideContainerByTrails.stories.tsx @@ -0,0 +1,188 @@ +import { breakpoints } from '@guardian/source-foundations'; +import { trails } from '../../fixtures/manual/trails'; +import { DecideContainerByTrails } from './DecideContainerByTrails'; +import { FrontSection } from './FrontSection'; + +export default { + component: DecideContainerByTrails, + title: 'Components/DecideContainerByTrails', + parameters: { + chromatic: { + viewports: [ + breakpoints.mobile, + breakpoints.tablet, + breakpoints.wide, + ], + }, + }, +}; + +export const OneCardFast = () => { + return ( + + + + ); +}; +OneCardFast.storyName = 'Fast - One card'; + +export const TwoCardFast = () => { + return ( + + + + ); +}; +TwoCardFast.storyName = 'Fast - Two cards'; + +export const ThreeCardFast = () => { + return ( + + + + ); +}; +ThreeCardFast.storyName = 'Fast - Three cards'; + +export const FourCardFast = () => { + return ( + + + + ); +}; +FourCardFast.storyName = 'Fast - Four cards'; + +export const FiveCardFast = () => { + return ( + + + + ); +}; +FiveCardFast.storyName = 'Fast - Five cards'; + +export const SixCardFast = () => { + return ( + + + + ); +}; +SixCardFast.storyName = 'Fast - Six cards'; + +export const SevenCardFast = () => { + return ( + + + + ); +}; +SevenCardFast.storyName = 'Fast - Seven cards'; + +export const EightCardFast = () => { + return ( + + + + ); +}; + +EightCardFast.storyName = 'Fast - Eight cards'; + +export const TwelveCardFast = () => { + return ( + + + + ); +}; +TwelveCardFast.storyName = 'Fast - Twelve cards'; + +export const OneCardSlow = () => { + return ( + + + + ); +}; +OneCardSlow.storyName = 'Slow - One card'; + +export const TwoCardSlow = () => { + return ( + + + + ); +}; +TwoCardSlow.storyName = 'Slow - Two cards'; + +export const ThreeCardSlow = () => { + return ( + + + + ); +}; +ThreeCardSlow.storyName = 'Slow - Three cards'; + +export const FourCardSlow = () => { + return ( + + + + ); +}; +FourCardSlow.storyName = 'Slow - Four cards'; + +export const FiveCardSlow = () => { + return ( + + + + ); +}; +FiveCardSlow.storyName = 'Slow - Five cards'; + +export const SixCardSlow = () => { + return ( + + + + ); +}; +SixCardSlow.storyName = 'Slow - Six cards'; + +export const SevenCardSlow = () => { + return ( + + + + ); +}; +SevenCardSlow.storyName = 'Slow - Seven cards'; + +export const EightCardSlow = () => { + return ( + + + + ); +}; + +EightCardSlow.storyName = 'Slow - Eight cards'; + +export const TwelveCardSlow = () => { + return ( + + + + ); +}; +TwelveCardSlow.storyName = 'Slow - Twelve cards'; diff --git a/dotcom-rendering/src/components/DecideContainerByTrails.tsx b/dotcom-rendering/src/components/DecideContainerByTrails.tsx index 12a3cb1cd78..7ea8691ae52 100644 --- a/dotcom-rendering/src/components/DecideContainerByTrails.tsx +++ b/dotcom-rendering/src/components/DecideContainerByTrails.tsx @@ -1,10 +1,13 @@ import { Card100Media50, + Card100Media75, Card25Media25, Card33Media33, Card50Media50, CardDefault, } from '../lib/cardWrappers'; +import type { Tuple } from '../lib/tuple'; +import { takeFirst } from '../lib/tuple'; import type { DCRFrontCard } from '../types/front'; import { LI } from './Card/components/LI'; import { UL } from './Card/components/UL'; @@ -24,8 +27,17 @@ export const OneCardFast = ({ trail }: { trail: DCRFrontCard }) => { ); }; -export const TwoCardFast = ({ trails }: { trails: DCRFrontCard[] }) => { - if (!trails[0] || !trails[1]) return <>; +export const OneCardSlow = ({ trail }: { trail: DCRFrontCard }) => { + return ( + + ); +}; + +export const TwoCard = ({ trails }: { trails: Tuple }) => { return (