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 with Text Block #180 #282

Merged
merged 47 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4577394
#180 - Add Media with text styles and bahaviour, fix video playback …
markovukiceviccn Dec 8, 2023
b83abde
#180 - Add block selectors, unwrap specific divs
markovukiceviccn Dec 11, 2023
b1fa764
#180 - Add Media with text block styles
markovukiceviccn Dec 11, 2023
26658ad
Refactor: new classes names for consistent content and developer expe…
taimurCognizant Dec 14, 2023
7bf70ab
fix variant gallery gap
taimurCognizant Dec 14, 2023
e13bf67
fix aspect ratio for video
taimurCognizant Dec 14, 2023
7dbeb8e
fix subtext color with black bg
taimurCognizant Dec 14, 2023
f4457e7
refactor subtext color
taimurCognizant Dec 15, 2023
dfbb898
fix replace gap property
taimurCognizant Dec 15, 2023
c443bb0
refactor scroll behavior
taimurCognizant Dec 15, 2023
c293d89
remove redundant code and update styles for better readibility
taimurCognizant Dec 15, 2023
998adb0
refactor use variable for width
taimurCognizant Dec 15, 2023
9fe4041
fix center content for media-gallery variant
taimurCognizant Dec 15, 2023
5abb250
revert icon css
taimurCognizant Dec 15, 2023
d1c401e
feat expanded wrapper for media-left and media-right variants
taimurCognizant Dec 15, 2023
57d6a47
fix content vertical position
taimurCognizant Dec 15, 2023
c21404a
feat function to add class to child parent
taimurCognizant Dec 15, 2023
2cda6f4
fix the container width of media-tabs to default width
taimurCognizant Dec 15, 2023
b2dfda3
feat expanded container for media-tabs
taimurCognizant Dec 15, 2023
ce0daa0
remove redundant icon css
taimurCognizant Dec 15, 2023
afc380f
update media section with autoplay and video poster option
taimurCognizant Dec 18, 2023
a21da45
fix exclude IFRAME from empty tags list
taimurCognizant Dec 18, 2023
b63226a
update add iframe for youtube video
taimurCognizant Dec 18, 2023
950f8f1
fix play icon size
taimurCognizant Dec 18, 2023
a09b9de
fix pixel issue
taimurCognizant Dec 18, 2023
2393b8a
fix media-gallery cut-off
taimurCognizant Dec 19, 2023
b60fba0
fix global play icon jump issue
taimurCognizant Dec 19, 2023
45feda6
Revert "fix global play icon jump issue"
taimurCognizant Dec 19, 2023
8e91cf8
fix video play icon jump issue
taimurCognizant Dec 19, 2023
c297d6c
fix heading spacing
taimurCognizant Dec 20, 2023
47520f0
fix center the content for full-width variant
taimurCognizant Dec 20, 2023
8d5168e
refactor css cleanup
taimurCognizant Dec 20, 2023
e2136c5
refactor css
taimurCognizant Dec 20, 2023
7630ec2
refactor remove unnecessary css
taimurCognizant Dec 20, 2023
92fac46
fix media-with-tabs spacing and width
taimurCognizant Dec 20, 2023
d8fc664
fix media-with-tabs sub-title font
taimurCognizant Dec 20, 2023
e222be7
fix next image peek for media-gallery variant
taimurCognizant Dec 20, 2023
9dfaaed
feature mute/unmute controls for video
taimurCognizant Dec 20, 2023
fa0500e
fix position of play and mute button for media-with-text
taimurCognizant Dec 21, 2023
a78b52e
refactor media-gallery variant
cogniSyb Jan 3, 2024
d400e3b
fix video size and button alignment
cogniSyb Jan 3, 2024
ebd53e4
fix image aspect ratio
cogniSyb Jan 3, 2024
c15942a
refactor alignment
cogniSyb Jan 3, 2024
ddf03c2
fix gallery image size on mobile
cogniSyb Jan 5, 2024
4791d9b
Mute and pause btn moved to top on tablet
santi-homps Jan 5, 2024
76561af
fix alignment of text
cogniSyb Jan 5, 2024
f8bd9d2
make changes only on media with text component
santi-homps Jan 5, 2024
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
20 changes: 2 additions & 18 deletions blocks/v2-content-card/v2-content-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createOptimizedPicture } from '../../scripts/lib-franklin.js';
import {
adjustPretitle, createElement, removeEmptyTags, variantsClassesToBEM,
} from '../../scripts/common.js';
import { createVideo, isVideoLink } from '../../scripts/video-helper.js';
import { createVideo, getDynamicVideoHeight, isVideoLink } from '../../scripts/video-helper.js';

const variantClasses = ['images-grid', 'images-grid-masonry', 'editorial'];

Expand Down Expand Up @@ -63,23 +63,7 @@ export default async function decorate(block) {
parentElement.style.position = 'relative';
parentElement.append(playbackControls);

// Get the element's height(use requestAnimationFrame to get actual height instead of 0)
requestAnimationFrame(() => {
const height = newVideo.offsetHeight - 60;
playbackControls.style.top = `${height.toString()}px`;
});

// Get the element's height on resize
const getVideoHeight = (entries) => {
// eslint-disable-next-line no-restricted-syntax
for (const entry of entries) {
const height = entry.target.offsetHeight - 60;
playbackControls.style.top = `${height.toString()}px`;
}
};

const resizeObserver = new ResizeObserver(getVideoHeight);
resizeObserver.observe(newVideo);
getDynamicVideoHeight(newVideo, playbackControls);
}

// Add wrapper around the text content
Expand Down
21 changes: 7 additions & 14 deletions blocks/v2-media-with-tabs/v2-media-with-tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,38 +112,28 @@ button.v2-media-with-tabs__tab:focus-visible {
}

.v2-media-with-tabs__header-section {
width: 50%;
max-width: 332px;
}
}

@media screen and (min-width: 1200px) {
.section.v2-media-with-tabs-container .v2-media-with-tabs-wrapper {
width: 100%;
margin: 0;
}

.v2-media-with-tabs {
padding: 0 64px 0 32px;
flex-direction: row;
gap: 48px;
}

.v2-media-with-tabs__images-section {
order: 1;
width: 70%;
width: 100%;
}

.v2-media-with-tabs__texts-section {
order: 2;
width: 30%;
max-width: 309px;
justify-content: center;
}

/* media-right variant: images displayed on the right side */
.v2-media-with-tabs.v2-media-with-tabs--media-right {
padding: 0 32px 0 64px;
}

.v2-media-with-tabs--media-right .v2-media-with-tabs__images-section {
order: 2;
}
Expand All @@ -158,9 +148,11 @@ button.v2-media-with-tabs__tab:focus-visible {
text-wrap: balance;
}

.v2-media-with-tabs__subtitle {
.v2-media-with-tabs__texts-section .v2-media-with-tabs__subtitle {
margin-bottom: 48px;
font-size: var(--f-body-2-font-size);
letter-spacing: var(--f-body-2-letter-spacing);
line-height: var(--f-body-2-line-height);
}

.v2-media-with-tabs__image img {
Expand All @@ -181,6 +173,7 @@ button.v2-media-with-tabs__tab:focus-visible {
.v2-media-with-tabs__header-section {
order: 1;
width: 100%;
max-width: unset;
}

}
12 changes: 9 additions & 3 deletions blocks/v2-media-with-tabs/v2-media-with-tabs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { createElement, unwrapDivs, variantsClassesToBEM } from '../../scripts/common.js';

const variantClasses = ['media-right'];
import {
addClassIfChildHasClass,
createElement,
unwrapDivs,
variantsClassesToBEM,
} from '../../scripts/common.js';

const variantClasses = ['media-right', 'expanded-width'];
const blockName = 'v2-media-with-tabs';

const handleChangeTab = (e) => {
Expand All @@ -25,6 +30,7 @@ const handleChangeTab = (e) => {

export default function decorate(block) {
variantsClassesToBEM(block.classList, variantClasses, blockName);
addClassIfChildHasClass(block, 'expanded-width');

const content = block.querySelectorAll(':scope > div > div');
const [header, list] = content;
Expand Down
Loading