Skip to content

Introduce decidePalette to DCR #2378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 26, 2021
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type CAPIDesign = DesignType | "Immersive" | "SpecialReport" | "GuardianLabs";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type DesignTypesObj = { [key in DesignType]: any };

type Palette = {[key: string]: any};

type Edition = 'UK' | 'US' | 'INT' | 'AU';

type SharePlatform =
Expand Down
113 changes: 113 additions & 0 deletions src/web/components/ArticleHeadline.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React from 'react';
import { css } from 'emotion';

import { Display } from '@guardian/types/Format';

import { decidePalette } from '../lib/decidePalette';

import { Section } from './Section';
import { ArticleHeadline } from './ArticleHeadline';
import { Flex } from './Flex';
Expand All @@ -28,6 +31,11 @@ export const ArticleStory = () => (
display={Display.Standard}
designType="Article"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Article',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -48,6 +56,11 @@ export const oldHeadline = () => (
display={Display.Standard}
designType="Article"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Article',
pillar: 'news',
})}
tags={[
// Age warnings only show for old articles when the tone/news tag is present
{
Expand Down Expand Up @@ -75,6 +88,11 @@ export const Feature = () => (
display={Display.Standard}
designType="Feature"
pillar="lifestyle"
palette={decidePalette({
display: Display.Standard,
designType: 'Feature',
pillar: 'lifestyle',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -100,6 +118,11 @@ export const ShowcaseInterview = () => (
display={Display.Showcase}
designType="Interview"
pillar="culture"
palette={decidePalette({
display: Display.Showcase,
designType: 'Interview',
pillar: 'culture',
})}
tags={[]}
isShowcase={true}
byline="Byline text"
Expand Down Expand Up @@ -135,6 +158,11 @@ export const ShowcaseInterviewNobyline = () => (
display={Display.Showcase}
designType="Interview"
pillar="culture"
palette={decidePalette({
display: Display.Showcase,
designType: 'Interview',
pillar: 'culture',
})}
tags={[]}
isShowcase={true}
byline=""
Expand Down Expand Up @@ -167,6 +195,11 @@ export const Interview = () => (
display={Display.Standard}
designType="Interview"
pillar="culture"
palette={decidePalette({
display: Display.Standard,
designType: 'Interview',
pillar: 'culture',
})}
tags={[]}
byline="Byline text"
/>
Expand Down Expand Up @@ -200,6 +233,11 @@ export const InterviewNoByline = () => (
display={Display.Standard}
designType="Interview"
pillar="culture"
palette={decidePalette({
display: Display.Standard,
designType: 'Interview',
pillar: 'culture',
})}
tags={[]}
byline=""
/>
Expand Down Expand Up @@ -235,6 +273,11 @@ export const Comment = () => (
display={Display.Standard}
designType="Comment"
pillar="opinion"
palette={decidePalette({
display: Display.Showcase,
designType: 'Comment',
pillar: 'opinion',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -255,6 +298,11 @@ export const Analysis = () => (
display={Display.Standard}
designType="Analysis"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Analysis',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -275,6 +323,11 @@ export const Media = () => (
display={Display.Standard}
designType="Media"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Media',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -295,6 +348,11 @@ export const Review = () => (
display={Display.Standard}
designType="Review"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Review',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -315,6 +373,11 @@ export const AdvertisementFeature = () => (
display={Display.Standard}
designType="AdvertisementFeature"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'AdvertisementFeature',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -335,6 +398,11 @@ export const PhotoEssay = () => (
display={Display.Standard}
designType="PhotoEssay"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'PhotoEssay',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -355,6 +423,11 @@ export const Quiz = () => (
display={Display.Standard}
designType="Quiz"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Quiz',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -375,6 +448,11 @@ export const Recipe = () => (
display={Display.Standard}
designType="Recipe"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Recipe',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -395,6 +473,11 @@ export const Immersive = () => (
display={Display.Immersive}
designType="Article"
pillar="news"
palette={decidePalette({
display: Display.Immersive,
designType: 'Article',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -415,6 +498,11 @@ export const ImmersiveNoMainMedia = () => (
display={Display.Immersive}
designType="Article"
pillar="news"
palette={decidePalette({
display: Display.Immersive,
designType: 'Article',
pillar: 'news',
})}
tags={[]}
noMainMedia={true}
/>
Expand All @@ -440,6 +528,11 @@ export const ImmersiveComment = () => (
display={Display.Immersive}
designType="Comment"
pillar="news"
palette={decidePalette({
display: Display.Immersive,
designType: 'Comment',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -460,6 +553,11 @@ export const GuardianView = () => (
display={Display.Standard}
designType="GuardianView"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'GuardianView',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -480,6 +578,11 @@ export const MatchReport = () => (
display={Display.Standard}
designType="MatchReport"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'MatchReport',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -500,6 +603,11 @@ export const SpecialReport = () => (
display={Display.Standard}
designType="Article"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Article',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand All @@ -520,6 +628,11 @@ export const Live = () => (
display={Display.Standard}
designType="Live"
pillar="news"
palette={decidePalette({
display: Display.Standard,
designType: 'Live',
pillar: 'news',
})}
tags={[]}
/>
</ArticleContainer>
Expand Down
Loading