Skip to content

Commit 67a7681

Browse files
authored
Merge branch 'main' into supportQACountry
2 parents 9fe9fe4 + c61c7a8 commit 67a7681

3 files changed

Lines changed: 100 additions & 3 deletions

File tree

packages/styles/scss/components/carousel/_carousel.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,11 @@
183183
}
184184
}
185185
}
186+
187+
// AEM nav space for last carousel when hr is hidden
188+
body[data-fullwidthtemplate='true']
189+
.table-of-contents
190+
.carousel:last-of-type:not(:has(.#{$prefix}--grid > [horizontal-ruler]))
191+
#{$c4d-prefix}-carousel::part(navigation) {
192+
margin-block-end: $spacing-06;
193+
}

packages/web-components/src/components/content-block-cards/content-block-cards.ts

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
*/
99

1010
import { css, Part } from 'lit';
11+
import { state } from 'lit/decorators.js';
1112
import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
1213
import StableSelectorMixin from '../../globals/mixins/stable-selector';
1314
import C4DContentBlock from '../content-block/content-block';
1415
import styles from './content-block-cards.scss';
1516
import { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';
17+
import MediaQueryMixin, {
18+
MQBreakpoints,
19+
MQDirs,
20+
} from '../../component-mixins/media-query/media-query';
1621

1722
const { prefix, stablePrefix: c4dPrefix } = settings;
1823

@@ -22,7 +27,15 @@ const { prefix, stablePrefix: c4dPrefix } = settings;
2227
* @element c4d-content-block-cards
2328
*/
2429
@customElement(`${c4dPrefix}-content-block-cards`)
25-
class C4DContentBlockCards extends StableSelectorMixin(C4DContentBlock) {
30+
class C4DContentBlockCards extends MediaQueryMixin(
31+
StableSelectorMixin(C4DContentBlock),
32+
{
33+
[MQBreakpoints.MD]: MQDirs.MAX,
34+
}
35+
) {
36+
@state()
37+
private _isMobileOrMedium = this.carbonBreakpoints.md.matches;
38+
2639
/**
2740
* The CSS class list for the container (grid) node.
2841
*/
@@ -35,6 +48,61 @@ class C4DContentBlockCards extends StableSelectorMixin(C4DContentBlock) {
3548
return `${c4dPrefix}--content-block-cards`;
3649
}
3750

51+
protected setSameHeightOnMobile() {
52+
requestAnimationFrame(() => {
53+
let maxHeightHeading = 0;
54+
let maxHeightParagraph = 0;
55+
56+
const blockCards = this.querySelectorAll(`${c4dPrefix}-card-group-item`);
57+
58+
blockCards.forEach((card) => {
59+
const heading = card.querySelector('c4d-card-heading') as HTMLElement;
60+
const para =
61+
card.querySelector('p') ||
62+
card?.shadowRoot?.querySelector('div.cds--card__copy');
63+
64+
let headingHeight = 0;
65+
let paraHeight = 0;
66+
67+
if (heading && para) {
68+
headingHeight = heading?.getBoundingClientRect().height;
69+
paraHeight = para?.getBoundingClientRect().height;
70+
}
71+
72+
maxHeightHeading =
73+
maxHeightHeading > headingHeight ? maxHeightHeading : headingHeight;
74+
75+
maxHeightParagraph =
76+
maxHeightParagraph > paraHeight ? maxHeightParagraph : paraHeight;
77+
});
78+
79+
for (const card of blockCards) {
80+
const heading = card.querySelector('c4d-card-heading');
81+
const para =
82+
card.querySelector('p') ||
83+
card?.shadowRoot?.querySelector('div.cds--card__copy');
84+
if (heading && para) {
85+
heading.setAttribute(
86+
'style',
87+
`height: ${maxHeightHeading}px; display: block;`
88+
);
89+
para.setAttribute(
90+
'style',
91+
`height: ${maxHeightParagraph}px; display: block;`
92+
);
93+
}
94+
}
95+
});
96+
}
97+
98+
firstUpdated() {
99+
window.addEventListener('load', () => {
100+
if (this._isMobileOrMedium) {
101+
this.setSameHeightOnMobile();
102+
}
103+
});
104+
}
105+
38106
connectedCallback() {
39107
super.connectedCallback();
40108

packages/web-components/src/components/video-player/video-player-container.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import ConnectMixin from '../../globals/mixins/connect';
2929
import StableSelectorMixin from '../../globals/mixins/stable-selector';
3030
import C4DVideoPlayerComposite from './video-player-composite';
3131
import { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';
32+
import { LocaleAPI } from '@carbon/ibmdotcom-services/es/services/Locale/index';
3233

3334
const { stablePrefix: c4dPrefix } = settings;
3435

@@ -115,9 +116,18 @@ export const C4DVideoPlayerContainerMixin = <
115116
// Not using TypeScript `private` due to: microsoft/TypeScript#17744
116117
_requestsEmbedVideo: { [videoId: string]: Promise<any> } = {};
117118

119+
/**
120+
* Custom video name
121+
*/
118122
@property({ type: String, attribute: 'customvideoname' })
119123
customVideoName = '';
120124

125+
/**
126+
* Language code
127+
*/
128+
@property()
129+
lc = '';
130+
121131
/**
122132
* Sets the state that the API call for embedding the video for the given video ID is in progress.
123133
*
@@ -193,7 +203,14 @@ export const C4DVideoPlayerContainerMixin = <
193203
* <c4d-video-player-container customVideoName="overwritten media title here">...
194204
*
195205
*/
196-
const mediaTitle = this?.['customVideoName'] || this?.['caption'];
206+
207+
let mediaTitle: string;
208+
209+
if (this.lc.toLowerCase() === 'en') {
210+
mediaTitle = this?.['customVideoName'] || this?.['caption'];
211+
} else {
212+
mediaTitle = ' ';
213+
}
197214

198215
let playerOptions = {};
199216
const autoplayPreference = this._getAutoplayPreference();
@@ -324,7 +341,7 @@ export const C4DVideoPlayerContainerMixin = <
324341
/**
325342
* Calls the data-* attribute transpose function to target `c4d-video-player`'s button element.
326343
*/
327-
firstUpdated() {
344+
async firstUpdated() {
328345
window.requestAnimationFrame(() => {
329346
const button =
330347
this.querySelector('c4d-video-player')?.shadowRoot?.querySelector(
@@ -338,6 +355,10 @@ export const C4DVideoPlayerContainerMixin = <
338355
}
339356
this.transposeAttributes(button, ['href']);
340357
});
358+
359+
//get LC
360+
const { lc } = await LocaleAPI.getLocale();
361+
this.lc = lc;
341362
}
342363

343364
prefersAutoplayStorageKey = `${c4dPrefix}-background-video-prefers-autoplay`;

0 commit comments

Comments
 (0)