Skip to content

Commit d8be482

Browse files
committed
Enlarge tutorial video previews in Ask AI answers
1 parent d4e37db commit d8be482

2 files changed

Lines changed: 22 additions & 29 deletions

File tree

‎src/components/SearchPageAskAi/TutorialVideoAnswer.jsx‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,18 @@ function VideoPreview({video}) {
2020
return <div className={styles.preview}>
2121
<button className={styles.toggle} type="button" aria-expanded={open} aria-controls={playerId}
2222
onClick={() => {setFailed(false); setOpen(!open);}}>
23-
<span className={styles.thumbnail} aria-hidden="true">
24-
<img src={poster} alt="" loading="lazy" />
25-
<span className={styles.icon}>
26-
<svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
27-
{open ? <path d="m6 14 6-6 6 6" fill="none" stroke="currentColor" strokeWidth="2.5" /> :
28-
<path d="M8 4.5v15l12-7.5z" fill="currentColor" />}
29-
</svg>
30-
</span>
31-
</span>
3223
<span className={styles.label}>
3324
<strong>{video.title}</strong>
3425
<span>{`${action} · ${duration}`}</span>
3526
</span>
27+
{!open && <span className={styles.poster} aria-hidden="true">
28+
<img src={poster} alt="" width={video.width} height={video.height} loading="lazy" />
29+
<span className={styles.icon}>
30+
<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
31+
<path d="M8 4.5v15l12-7.5z" fill="currentColor" />
32+
</svg>
33+
</span>
34+
</span>}
3635
</button>
3736
<div id={playerId} hidden={!open}>
3837
{open && <>

‎src/components/SearchPageAskAi/TutorialVideoAnswer.module.css‎

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
}
55

66
.toggle {
7-
display: flex;
8-
align-items: center;
9-
gap: .75rem;
7+
display: block;
108
width: 100%;
11-
padding: .5rem;
9+
padding: 0;
10+
overflow: hidden;
1211
background: transparent;
1312
color: inherit;
1413
border: 1px solid var(--ifm-color-emphasis-300);
@@ -22,20 +21,18 @@
2221
background: var(--ifm-hover-overlay);
2322
}
2423

25-
.thumbnail {
24+
.poster {
2625
position: relative;
27-
flex: 0 0 5rem;
28-
aspect-ratio: 8 / 5;
29-
overflow: hidden;
30-
border-radius: .25rem;
26+
display: block;
3127
background: var(--ifm-color-emphasis-200);
3228
}
3329

34-
.thumbnail img {
35-
width: 100%;
36-
height: 100%;
37-
object-fit: cover;
30+
.poster img, .preview video {
3831
display: block;
32+
width: 100%;
33+
height: auto;
34+
max-height: 70vh;
35+
object-fit: contain;
3936
}
4037

4138
.icon {
@@ -44,8 +41,9 @@
4441
margin: auto;
4542
display: grid;
4643
place-items: center;
47-
width: 1.75rem;
48-
height: 1.75rem;
44+
width: 3rem;
45+
height: 3rem;
46+
border: 1px solid rgb(255 255 255 / 75%);
4947
border-radius: 50%;
5048
color: white;
5149
background: rgb(0 0 0 / 78%);
@@ -54,7 +52,7 @@
5452
.label {
5553
display: grid;
5654
gap: .125rem;
57-
min-width: 0;
55+
padding: .5rem .75rem;
5856
line-height: 1.35;
5957
overflow-wrap: anywhere;
6058
}
@@ -72,10 +70,6 @@
7270
}
7371

7472
.preview video {
75-
display: block;
76-
width: 100%;
77-
height: auto;
78-
max-height: 52vh;
7973
margin-block-start: .375rem;
8074
border-radius: .375rem;
8175
background: black;

0 commit comments

Comments
 (0)