Skip to content
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
9 changes: 9 additions & 0 deletions blocks/hero/hero.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@
margin-left: -1px;
}

/* producer logo (JS-swapped for the last ribbon cell): sized to the 13px ribbon
text so it reads as an inline wordmark. Brightened to white on the dark cover. */
.hero.hero-cover > div:nth-child(2) > div:first-child .producer-logo {
display: block;
height: 13px;
width: auto;
filter: brightness(0) invert(1);
}

/* title cell: two solid 80px display lines, left-aligned white */
.hero.hero-cover > div:nth-child(2) > div:last-child {
display: flex;
Expand Down
11 changes: 11 additions & 0 deletions blocks/hero/hero.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import applyProducerLogo from '../../scripts/producer-logos.js';

export default function decorate(block) {
// hero-cover: content row (2nd child) holds a metadata ribbon over the title.
// The ribbon's last cell is the producing brand — render it as the PRADA
// wordmark to match the design, regardless of the authored text.
if (!block.classList.contains('hero-cover')) return;
const content = block.children[1];
const ribbon = content?.firstElementChild;
applyProducerLogo(ribbon?.querySelector('p:last-child'), 'prada');
}
9 changes: 5 additions & 4 deletions scripts/producer-logos.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ const LOGOS = {
const normalize = (text) => text.trim().toLowerCase().replace(/\s+/g, ' ');

/**
* If `el`'s text matches a known producer, replace its contents with that
* producer's logo image. Returns true when a logo was applied.
* Replace `el`'s contents with a producer's logo image. By default the producer
* is resolved from `el`'s text; pass `key` to force a specific producer (e.g. a
* fixed brand mark) regardless of the text. Returns true when a logo was applied.
*/
export default function applyProducerLogo(el) {
export default function applyProducerLogo(el, key) {
if (!el) return false;
const logo = LOGOS[normalize(el.textContent)];
const logo = LOGOS[normalize(key ?? el.textContent)];
if (!logo) return false;

const img = document.createElement('img');
Expand Down
Loading