dotcom-rendering
dotcom-rendering copied to clipboard
Encapsulate logic for dark card backgrounds in libs
What does this change?
Follow-up PR for https://github.com/guardian/dotcom-rendering/pull/11772
- Moves the logic for whether a card has a "dark" background into a central
libs
location rather than living directly in thedecideLogo
directory - Renames long, complicated
isUnsupportedFormatForCardWithoutBackground
incardHelpers.ts
to simplyisMediaCard
since this is what it really represents. - Adds more tests to
cardHelpers
file since the introduction ofcontainerPalette
into the decision of whether the card has a "dark" background or not - Renames
decideLogo
in two places to better indicate what they are designed for (articles and cards) with todo comment to hint at future improvement
Why?
Avoids duplication of logic and centralises it so that other areas in the codebase can rely on consistent decision making.