Skip to content

Commit e0c2c68

Browse files
committed
[Stream] Add optional expandChapters prop
1 parent f8c1dd6 commit e0c2c68

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

src/components/Stream.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ const props = z
1313
thumbnail: z.string().optional(),
1414
chapters: z.record(z.string(), z.string()).optional(),
1515
showMoreVideos: z.boolean().default(false),
16+
expandChapters: z.boolean().default(false),
1617
})
1718
.strict();
1819
19-
const { id, title, thumbnail, chapters, showMoreVideos } = props.parse(
20-
Astro.props,
21-
);
20+
const { id, title, thumbnail, chapters, showMoreVideos, expandChapters } =
21+
props.parse(Astro.props);
2222
2323
const BASE_URL = `https://customer-1mwganm1ma0xgnmj.cloudflarestream.com/`;
2424
@@ -54,7 +54,7 @@ if (thumbnail) {
5454

5555
{
5656
chapters && (
57-
<Details header="Chapters" open={false}>
57+
<Details header="Chapters" open={expandChapters}>
5858
<p>
5959
<ul class="flex list-none gap-4 overflow-x-scroll pb-4 pl-0">
6060
{Object.entries(chapters).map(([chapter, time]) => {

src/content/docs/cache/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Cache content across Cloudflare's global server network.
2020

2121
Cache stores copies of frequently accessed content (such as images, videos, or webpages) in geographically distributed data centers that are located closer to end users than origin servers, reducing server load and improving website performance.
2222

23-
<Stream id="90d8a506e1e3935cff71223f9d785aa6" title="How Cloudflare protects and accelerates your website or app" thumbnail="https://pub-d9bf66e086fb4b639107aa52105b49dd.r2.dev/How%20Cloudflare%20%20protects%20and%20accelerates%20your%20website%20and%20app.png" />
23+
<Stream id="90d8a506e1e3935cff71223f9d785aa6" title="How Cloudflare protects and accelerates your website or app" thumbnail="https://pub-d9bf66e086fb4b639107aa52105b49dd.r2.dev/How%20Cloudflare%20%20protects%20and%20accelerates%20your%20website%20and%20app.png"/>
2424

2525
## Features
2626

src/content/docs/learning-paths/r2-intro/series/r2-4.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Render, Tabs, TabItem, Stream, Card } from "~/components";
1515
<TabItem label="Watch this episode" icon="seti:video">
1616

1717
In this video, you will learn how to use Cloudflare R2's data migration tools to transfer data from other cloud providers such as Amazon S3 and Google Cloud Storage to R2. The video will demonstrate the step-by-step process of setting up and executing a data migration.
18-
18+
1919
<Card>
2020
<Stream
2121
id="2bb9f663c21bab9e8996cb2bc93d7218"

src/content/docs/style-guide/components/details.mdx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,31 @@ styleGuide:
44
component: Details
55
---
66

7+
import { Type, MetaInfo } from "~/components";
8+
79
When you want to provide additional information in context, but you do not want it to clutter up the more important content, use `<Details>` to add a collapsible container.
810

911
```mdx live
10-
import { Details } from "~/components"
12+
import { Details } from "~/components";
1113

12-
<Details header="Open me!">
13-
Hello, world!
14-
</Details>
14+
<Details header="Open me!">Hello, world!</Details>
1515
```
1616

1717
You can specify the default configuration of each instance of the `<Details>` component (that is, whether it is open or closed by default).
1818

1919
```mdx live
20-
import { Details } from "~/components"
20+
import { Details } from "~/components";
2121

22-
<Details header="Close me!" open = {true}>
23-
Long piece of code example.
22+
<Details header="Close me!" open={true}>
23+
Long piece of code example.
2424
</Details>
2525
```
26+
27+
## Properties
28+
29+
- `header` <Type text="string" /> <MetaInfo text="required" />
30+
- `id` <Type text="string" /> <MetaInfo text="optional" />
31+
32+
Adds a specific `id` to the HTML element
33+
34+
- `open` <Type text="boolean" /> <MetaInfo text="optional" />

src/content/docs/style-guide/components/stream.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ Either a timestamp (i.e `2.5s` or `1m35s`) or a URL to an image.
7272

7373
Optional chapters displayed as cards below the video.
7474

75+
### `expandChapters`
76+
77+
**type:** `boolean`
78+
79+
**default:** `false`
80+
81+
If `chapters` is present, is passed through to the `open` property of the [Details component](/style-guide/components/details/).
82+
7583
### `showMoreVideos`
7684

7785
**type:** `boolean`

0 commit comments

Comments
 (0)