Skip to content

Commit 280a9e9

Browse files
committed
[Docs Site] Create YouTubeVideos component
1 parent fd395fe commit 280a9e9

File tree

5 files changed

+142
-0
lines changed

5 files changed

+142
-0
lines changed

package-lock.json

Lines changed: 109 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
"starlight-image-zoom": "0.11.1",
110110
"starlight-links-validator": "0.14.3",
111111
"starlight-package-managers": "0.10.0",
112+
"starlight-showcases": "0.3.0",
112113
"strip-markdown": "6.0.0",
113114
"svgo": "3.3.2",
114115
"tailwindcss": "3.4.17",

src/components/YouTubeVideos.astro

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
import { getCollection } from "astro:content";
3+
import { ShowcaseYouTube } from "starlight-showcases";
4+
5+
const videos = await getCollection("videos", (entry) => {
6+
return entry.data.link.startsWith("https://youtu");
7+
});
8+
9+
const entries = videos.map((video) => ({
10+
href: video.data.link,
11+
title: video.data.id,
12+
description: video.data.description,
13+
}));
14+
---
15+
16+
<ShowcaseYouTube entries={entries} />

src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export { default as WorkersArchitectureDiagram } from "./WorkersArchitectureDiag
6363
export { default as WorkersIsolateDiagram } from "./WorkersIsolateDiagram.astro";
6464
export { default as WorkerStarter } from "./WorkerStarter.astro";
6565
export { default as YouTube } from "./YouTube.astro";
66+
export { default as YouTubeVideos } from "./YouTubeVideos.astro";
6667

6768
// Taken from Astro
6869
export { default as ListCard } from "./astro/ListCard.astro";
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: YouTube Videos
3+
styleGuide:
4+
component: YouTubeVideos
5+
---
6+
7+
```mdx live
8+
import { YouTubeVideos } from "~/components";
9+
10+
<YouTubeVideos />
11+
```
12+
13+
## Associated content types
14+
15+
- [Video](/style-guide/documentation-content-strategy/content-types/video/)

0 commit comments

Comments
 (0)