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

[Release] Stage to Main #2482

Merged
merged 1 commit into from
Jun 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion libs/blocks/adobetv/adobetv.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { applyHoverPlay, getVideoAttrs } from '../../utils/decorate.js';
const ROOT_MARGIN = 1000;

const loadAdobeTv = (a) => {
const bgBlocks = ['aside', 'marquee'];
const bgBlocks = ['aside', 'marquee', 'hero-marquee'];
if (a.href.includes('.mp4') && bgBlocks.some((b) => a.closest(`.${b}`))) {
a.classList.add('hide');
const { href, hash } = a;
Expand Down
34 changes: 8 additions & 26 deletions libs/blocks/brick/brick.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { decorateTextOverrides, decorateBlockText, decorateBlockBg, decorateIconStack, decorateButtons } from '../../utils/decorate.js';
import {
decorateBlockBg,
decorateBlockText,
decorateIconStack,
decorateTextOverrides,
decorateButtons,
handleObjectFit,
} from '../../utils/decorate.js';
import { createTag, getConfig, loadStyle } from '../../utils/utils.js';

const blockTypeSizes = {
large: ['xxl', 'm', 'l'],
default: ['xl', 'm', 'l'],
};
const objFitOptions = ['fill', 'contain', 'cover', 'none', 'scale-down'];

function getBlockSize(el) {
const sizes = Object.keys(blockTypeSizes);
Expand All @@ -21,30 +27,6 @@ function handleSupplementalText(foreground) {
if (lastP) lastP.className = 'supplemental-text';
}

function setObjectFitAndPos(text, pic, bgEl) {
const backgroundConfig = text.split(',').map((c) => c.toLowerCase().trim());
const fitOption = objFitOptions.filter((c) => backgroundConfig.includes(c));
const focusOption = backgroundConfig.filter((c) => !fitOption.includes(c));
if (fitOption) [pic.querySelector('img').style.objectFit] = fitOption;
bgEl.innerHTML = '';
bgEl.append(pic);
bgEl.append(document.createTextNode(focusOption.join(',')));
}

function handleObjectFit(bgRow) {
const bgConfig = bgRow.querySelectorAll('div');
[...bgConfig].forEach((r) => {
const pic = r.querySelector('picture');
if (!pic) return;
let text = '';
const pchild = [...r.querySelectorAll('p:not(:empty)')].filter((p) => p.innerHTML.trim() !== '');
if (pchild.length > 2) text = pchild[1]?.textContent.trim();
if (!text && r.textContent) text = r.textContent;
if (!text) return;
setObjectFitAndPos(text, pic, r);
});
}

function handleClickableBrick(el, foreground) {
if (!el.classList.contains('click')) return;
const links = foreground.querySelectorAll('.brick-text a');
Expand Down
Loading
Loading