File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed
Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 11import type { DCRContainerPalette } from '../types/front' ;
2- import { containerPaletteHasDarkBackground } from './cardHelpers' ;
2+ import { hasDarkBackground } from './cardHelpers' ;
33
4- describe ( 'cardHasDarkBackground ' , ( ) => {
4+ describe ( 'hasDarkBackground ' , ( ) => {
55 const testCases = [
66 {
77 containerPalette : undefined ,
@@ -35,9 +35,7 @@ describe('cardHasDarkBackground', () => {
3535 it . each ( testCases ) (
3636 'returns $expectedResult for $format format, $containerPalette containerPalette' ,
3737 ( { containerPalette, expectedResult } ) => {
38- expect ( containerPaletteHasDarkBackground ( containerPalette ) ) . toBe (
39- expectedResult ,
40- ) ;
38+ expect ( hasDarkBackground ( containerPalette ) ) . toBe ( expectedResult ) ;
4139 } ,
4240 ) ;
4341} ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,14 @@ export const isMediaCard = (format: ArticleFormat): boolean => {
1414 }
1515} ;
1616
17- export const containerPaletteHasDarkBackground = (
17+ /**
18+ * Determines whether the application of a container palette override
19+ * results in a dark background for the container and cards inside it
20+ *
21+ * This is primarily used to decide whether to force usage of the logo
22+ * for dark mode when it would otherwise be configured as light mode
23+ */
24+ export const hasDarkBackground = (
1825 containerPalette ?: DCRContainerPalette ,
1926) : boolean => {
2027 switch ( containerPalette ) {
Original file line number Diff line number Diff line change 11import type { Branding } from '../types/branding' ;
22import type { DCRContainerPalette } from '../types/front' ;
3- import { containerPaletteHasDarkBackground } from './cardHelpers' ;
3+ import { hasDarkBackground } from './cardHelpers' ;
44
55export const decideBrandingLogo = (
66 branding : Branding ,
77 containerPalette ?: DCRContainerPalette ,
88) : Branding [ 'logo' ] => {
9- return containerPaletteHasDarkBackground ( containerPalette ) &&
10- branding . logoForDarkBackground
9+ return hasDarkBackground ( containerPalette ) && branding . logoForDarkBackground
1110 ? branding . logoForDarkBackground
1211 : branding . logo ;
1312} ;
You can’t perform that action at this time.
0 commit comments