Skip to content
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
17 changes: 8 additions & 9 deletions src/components/SearchPageAskAi/TutorialVideoAnswer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ function VideoPreview({video}) {
return <div className={styles.preview}>
<button className={styles.toggle} type="button" aria-expanded={open} aria-controls={playerId}
onClick={() => {setFailed(false); setOpen(!open);}}>
<span className={styles.thumbnail} aria-hidden="true">
<img src={poster} alt="" loading="lazy" />
<span className={styles.icon}>
<svg width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
{open ? <path d="m6 14 6-6 6 6" fill="none" stroke="currentColor" strokeWidth="2.5" /> :
<path d="M8 4.5v15l12-7.5z" fill="currentColor" />}
</svg>
</span>
</span>
<span className={styles.label}>
<strong>{video.title}</strong>
<span>{`${action} · ${duration}`}</span>
</span>
{!open && <span className={styles.poster} aria-hidden="true">
<img src={poster} alt="" width={video.width} height={video.height} loading="lazy" />
<span className={styles.icon}>
<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path d="M8 4.5v15l12-7.5z" fill="currentColor" />
</svg>
</span>
</span>}
</button>
<div id={playerId} hidden={!open}>
{open && <>
Expand Down
34 changes: 14 additions & 20 deletions src/components/SearchPageAskAi/TutorialVideoAnswer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
}

.toggle {
display: flex;
align-items: center;
gap: .75rem;
display: block;
width: 100%;
padding: .5rem;
padding: 0;
overflow: hidden;
background: transparent;
color: inherit;
border: 1px solid var(--ifm-color-emphasis-300);
Expand All @@ -22,20 +21,18 @@
background: var(--ifm-hover-overlay);
}

.thumbnail {
.poster {
position: relative;
flex: 0 0 5rem;
aspect-ratio: 8 / 5;
overflow: hidden;
border-radius: .25rem;
display: block;
background: var(--ifm-color-emphasis-200);
}

.thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
.poster img, .preview video {
display: block;
width: 100%;
height: auto;
max-height: 70vh;
object-fit: contain;
}

.icon {
Expand All @@ -44,8 +41,9 @@
margin: auto;
display: grid;
place-items: center;
width: 1.75rem;
height: 1.75rem;
width: 3rem;
height: 3rem;
border: 1px solid rgb(255 255 255 / 75%);
border-radius: 50%;
color: white;
background: rgb(0 0 0 / 78%);
Expand All @@ -54,7 +52,7 @@
.label {
display: grid;
gap: .125rem;
min-width: 0;
padding: .5rem .75rem;
line-height: 1.35;
overflow-wrap: anywhere;
}
Expand All @@ -72,10 +70,6 @@
}

.preview video {
display: block;
width: 100%;
height: auto;
max-height: 52vh;
margin-block-start: .375rem;
border-radius: .375rem;
background: black;
Expand Down