Skip to content
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

Media Cards: Special palette variations for podcast waveform #13119

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
7 changes: 4 additions & 3 deletions dotcom-rendering/src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1290,21 +1290,22 @@ export const WithSpecialPaletteVariations = () => {
isLabs
? {
display: ArticleDisplay.Standard,
design: ArticleDesign.Gallery,
design: ArticleDesign.Audio,
theme: ArticleSpecial.Labs,
}
: {
display: ArticleDisplay.Standard,
design: ArticleDesign.Gallery,
design: ArticleDesign.Audio,
theme: Pillar.Lifestyle,
}
}
headlineText="Audio"
kickerText="Kicker"
trailText=""
imagePositionOnDesktop="top"
imagePositionOnMobile="left"
imageSize="medium"
mainMedia={mainGallery}
mainMedia={{ ...mainAudio, duration: 90 }}
containerPalette={containerPalette}
/>
</LI>
Expand Down
8 changes: 4 additions & 4 deletions dotcom-rendering/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ export const Card = ({
cardHasImage={!!image}
/>
) : null}
{!!mainMedia && mainMedia.type !== 'Video' && !showPill && (
{!showPill && !!mainMedia && mainMedia.type !== 'Video' && (
<MediaMeta
mediaType={mainMedia.type}
hasKicker={!!kickerText}
Expand Down Expand Up @@ -1014,9 +1014,9 @@ export const Card = ({
cardHasImage={!!image}
/>
) : null}
{!!mainMedia &&
mainMedia.type !== 'Video' &&
!showPill && (
{!showPill &&
!!mainMedia &&
mainMedia.type !== 'Video' && (
<MediaMeta
mediaType={mainMedia.type}
hasKicker={!!kickerText}
Expand Down
48 changes: 48 additions & 0 deletions dotcom-rendering/src/components/ContainerOverrides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,50 @@ const cardMediaIconLight: ContainerFunction = (containerPalette) =>
const cardMediaIconDark: ContainerFunction = (containerPalette) =>
cardBackgroundDark(containerPalette);

const cardMediaWaveformLight: ContainerFunction = (containerPalette) => {
switch (containerPalette) {
case 'InvestigationPalette':
case 'SombrePalette':
case 'SombreAltPalette':
return sourcePalette.neutral[46];
case 'LongRunningPalette':
case 'EventPalette':
case 'MediaPalette':
case 'PodcastPalette':
case 'Branded':
return sourcePalette.neutral[86];
case 'LongRunningAltPalette':
return sourcePalette.neutral[73];
case 'BreakingPalette':
return sourcePalette.news[300];
case 'EventAltPalette':
return sourcePalette.culture[600];
case 'SpecialReportAltPalette':
return sourcePalette.specialReportAlt[800];
}
};

const cardMediaWaveformDark: ContainerFunction = (containerPalette) => {
switch (containerPalette) {
case 'InvestigationPalette':
case 'LongRunningAltPalette':
case 'SombrePalette':
case 'SombreAltPalette':
case 'EventPalette':
case 'SpecialReportAltPalette':
case 'MediaPalette':
case 'PodcastPalette':
case 'Branded':
return sourcePalette.neutral[38];
case 'LongRunningPalette':
return sourcePalette.brand[400];
case 'BreakingPalette':
return sourcePalette.news[300];
case 'EventAltPalette':
return sourcePalette.culture[300];
}
};

const sectionBackgroundLight: ContainerFunction = (containerPalette) => {
switch (containerPalette) {
case 'InvestigationPalette':
Expand Down Expand Up @@ -1087,6 +1131,10 @@ const containerColours = {
light: cardMediaIconLight,
dark: cardMediaIconDark,
},
'--card-media-waveform': {
light: cardMediaWaveformLight,
dark: cardMediaWaveformDark,
},
'--card-sublinks-background': {
light: cardSublinksBackgroundLight,
dark: cardSublinksBackgroundDark,
Expand Down
Loading