Skip to content

Commit 1f8806f

Browse files
committed
style: update shoppable panel styles with responsive font sizes and improved layout properties
1 parent b0a45b4 commit 1f8806f

2 files changed

Lines changed: 49 additions & 68 deletions

File tree

packages/video-player/javascript/modules/shoppable/shoppable-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
import { AugmentedSourceOptions } from 'javascript/interfaces/AugementedSourceOptions';
99
import { CleanupRegistry } from '../../utils';
1010
import ShoppablePanelItem from './shoppable-item';
11+
1112
export class ShoppableManager {
1213
private player_: Player;
1314
private shoppable_: ShoppableProps;

packages/video-player/javascript/modules/shoppable/shoppable.css

Lines changed: 48 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
background: rgba(255, 255, 255, 0.5);
4545
-ms-overflow-style: none;
4646
scrollbar-width: none;
47+
container-type: inline-size;
4748
}
4849

4950
.vjs-shoppable-panel::-webkit-scrollbar {
@@ -160,7 +161,7 @@
160161
background: rgba(0, 0, 0, 1);
161162
color: #fff;
162163
padding: 8px;
163-
font-size: 14px;
164+
font-size: 10px;
164165
text-align: center;
165166
white-space: normal;
166167
overflow: hidden;
@@ -172,19 +173,55 @@
172173
justify-content: center;
173174
}
174175

176+
@container (min-width: 120px) {
177+
.vjs-shoppable-item-info {
178+
font-size: 12px;
179+
}
180+
}
181+
182+
@container (min-width: 140px) {
183+
.vjs-shoppable-item-info {
184+
font-size: 14px;
185+
}
186+
}
187+
175188
.vjs-shoppable-postplay-carousel .vjs-shoppable-item-info {
176-
font-size: 14px;
189+
font-size: 10px;
177190
font-weight: 500;
178191
line-height: 1.3;
179192
background: rgba(0, 0, 0, 1);
180-
height: 3.5em;
181-
display: flex;
182-
align-items: center;
183-
justify-content: center;
193+
padding: 6px;
194+
padding-bottom: 0px;
195+
display: -webkit-box;
196+
-webkit-line-clamp: 2;
197+
line-clamp: 2;
198+
-webkit-box-orient: vertical;
199+
overflow: hidden;
200+
text-overflow: ellipsis;
201+
min-height: unset;
202+
margin-bottom: 8px;
203+
}
204+
205+
@container (min-width: 600px) {
206+
.vjs-shoppable-postplay-carousel .vjs-shoppable-item-info {
207+
font-size: 12px;
208+
padding: 7px;
209+
padding-bottom: 0px;
210+
margin-bottom: 8px;
211+
}
212+
}
213+
214+
@container (min-width: 700px) {
215+
.vjs-shoppable-postplay-carousel .vjs-shoppable-item-info {
216+
font-size: 14px;
217+
padding: 8px;
218+
padding-bottom: 0px;
219+
margin-bottom: 8px;
220+
}
184221
}
185222

186223
.vjs-shoppable-postplay-carousel .vjs-shoppable-item {
187-
width: 200px;
224+
width: clamp(100px, 25%, 200px);
188225
flex-shrink: 0;
189226
border: 1px solid rgba(255, 255, 255, 0.4);
190227
}
@@ -295,23 +332,23 @@
295332
flex-direction: column;
296333
align-items: center;
297334
justify-content: center;
298-
padding: 20px;
335+
padding: clamp(12px, 1.5%, 24px);
299336
box-sizing: border-box;
337+
container-type: inline-size;
338+
row-gap: clamp(12px, 1.5%, 24px);
300339
}
301340

302341
.vjs-shoppable-postplay-title {
303342
color: #fff;
304343
font-size: 24px;
305-
margin-bottom: 24px;
306344
font-weight: bold;
307345
}
308346

309347
.vjs-shoppable-postplay-carousel {
310348
display: flex;
311-
gap: 20px;
349+
gap: clamp(12px, 1.5%, 24px);
312350
overflow-x: auto;
313351
max-width: 100%;
314-
padding-bottom: 20px;
315352
cursor: grab;
316353
user-select: none;
317354
-ms-overflow-style: none;
@@ -326,64 +363,7 @@
326363
cursor: grabbing;
327364
}
328365

329-
.vjs-shoppable-postplay-card {
330-
position: relative;
331-
flex-shrink: 0;
332-
text-align: center;
333-
color: #fff;
334-
font-size: 14px;
335-
cursor: pointer;
336-
transition: transform 0.2s ease-in-out;
337-
display: flex;
338-
align-items: center;
339-
flex-direction: column;
340-
}
341-
342-
.vjs-shoppable-postplay-card:hover {
343-
transform: scale(1.05);
344-
}
345-
346-
.vjs-shoppable-postplay-card img {
347-
width: 160px;
348-
height: 160px;
349-
object-fit: cover;
350-
border-radius: 12px;
351-
margin-bottom: 8px;
352-
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
353-
}
354-
355-
.vjs-shoppable-postplay-card-title {
356-
max-width: 160px;
357-
font-weight: 500;
358-
line-height: 1.3;
359-
}
360-
361-
.vjs-shoppable-postplay-card-overlay {
362-
position: absolute;
363-
top: 0;
364-
left: 0;
365-
width: 160px;
366-
height: 160px;
367-
background: rgba(0, 0, 0, 0.6);
368-
color: #fff;
369-
display: flex;
370-
align-items: center;
371-
justify-content: center;
372-
text-align: center;
373-
padding: 10px;
374-
box-sizing: border-box;
375-
border-radius: 12px;
376-
opacity: 0;
377-
transition: opacity 0.2s ease-in-out;
378-
pointer-events: none;
379-
}
380-
381-
.vjs-shoppable-postplay-card:hover .vjs-shoppable-postplay-card-overlay {
382-
opacity: 1;
383-
}
384-
385366
.vjs-shoppable-replay-btn {
386-
margin-top: 30px;
387367
padding: 12px 24px;
388368
background-color: rgba(255, 255, 255, 0.9);
389369
color: #111;

0 commit comments

Comments
 (0)