Skip to content

Commit b07ca71

Browse files
committed
Cleans up video section
1 parent 6a8a0a4 commit b07ca71

File tree

3 files changed

+72
-18
lines changed

3 files changed

+72
-18
lines changed

sidebars.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,9 @@ const sidebars: SidebarsConfig = {
168168
id: 'credits/overview'
169169
},
170170
{
171-
type: 'category',
171+
type: 'doc',
172172
label: 'Tutorial Videos',
173-
items: [
174-
{
175-
type: 'doc',
176-
id: 'tutorial-videos',
177-
label: 'All Videos',
178-
},
179-
...tutorialVideos.videos.map((video) => ({
180-
type: 'link' as const,
181-
label: truncateTitle(video.title),
182-
href: `https://www.youtube.com/watch?v=${video.id}`,
183-
description: video.title.length > 40 ? video.title : undefined,
184-
})),
185-
],
173+
id: 'tutorial-videos'
186174
},
187175
{
188176
type: 'category',

src/components/VideoGrid.tsx

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useRef } from 'react';
22
import videos from '@site/docs/tutorial-videos.json';
33

44
interface Video {
@@ -7,10 +7,71 @@ interface Video {
77
}
88

99
export default function VideoGrid(): JSX.Element {
10+
const videoRefs = useRef<{ [key: string]: HTMLDivElement | null }>({});
11+
12+
const scrollToVideo = (videoId: string) => {
13+
const element = videoRefs.current[videoId];
14+
if (element) {
15+
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
16+
}
17+
};
18+
1019
return (
11-
<div className="video-grid">
12-
{videos.videos.map((video: Video) => (
13-
<div key={video.id} className="video-item">
20+
<div>
21+
{/* Table of Contents */}
22+
<div className="video-toc" style={{
23+
marginBottom: '2rem',
24+
padding: '1.5rem',
25+
backgroundColor: 'var(--ifm-background-surface-color)',
26+
borderRadius: '8px',
27+
border: '1px solid var(--ifm-color-emphasis-200)',
28+
}}>
29+
<h3 style={{ marginTop: 0, marginBottom: '1rem' }}>Videos</h3>
30+
<ol style={{
31+
listStylePosition: 'inside',
32+
paddingLeft: 0,
33+
marginBottom: 0,
34+
}}>
35+
{videos.videos.map((video: Video) => (
36+
<li key={`toc-${video.id}`} style={{
37+
marginBottom: '0.5rem',
38+
cursor: 'pointer',
39+
color: 'var(--ifm-color-primary)',
40+
}}>
41+
<a
42+
onClick={(e) => {
43+
e.preventDefault();
44+
scrollToVideo(video.id);
45+
}}
46+
style={{
47+
cursor: 'pointer',
48+
textDecoration: 'none',
49+
color: 'inherit',
50+
}}
51+
onMouseEnter={(e) => {
52+
e.currentTarget.style.textDecoration = 'underline';
53+
}}
54+
onMouseLeave={(e) => {
55+
e.currentTarget.style.textDecoration = 'none';
56+
}}
57+
>
58+
{video.title}
59+
</a>
60+
</li>
61+
))}
62+
</ol>
63+
</div>
64+
65+
{/* Video Grid */}
66+
<div className="video-grid">
67+
{videos.videos.map((video: Video) => (
68+
<div
69+
key={video.id}
70+
className="video-item"
71+
ref={(el) => {
72+
videoRefs.current[video.id] = el;
73+
}}
74+
>
1475
<div
1576
className="video-container"
1677
onClick={(e) => {
@@ -59,6 +120,7 @@ export default function VideoGrid(): JSX.Element {
59120
</div>
60121
</div>
61122
))}
123+
</div>
62124
</div>
63125
);
64126
}

src/css/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ div[style*="min-height:100vh"] {
328328
backdrop-filter: blur(16px);
329329
}
330330

331+
.video-container img {
332+
margin: 0 !important;
333+
}
334+
331335
.video-container iframe {
332336
position: absolute;
333337
top: 0;

0 commit comments

Comments
 (0)