|
2 | 2 | import { z } from "astro:schema"; |
3 | 3 | import { Badge } from "@astrojs/starlight/components"; |
4 | 4 | import parse from "parse-duration"; |
| 5 | +import Details from "./Details.astro"; |
5 | 6 |
|
6 | 7 | type Props = z.input<typeof props>; |
7 | 8 |
|
@@ -53,42 +54,43 @@ if (thumbnail) { |
53 | 54 |
|
54 | 55 | { |
55 | 56 | chapters && ( |
56 | | - <p> |
57 | | - <strong>Chapters</strong> |
58 | | - <ul class="flex list-none gap-4 overflow-x-scroll pb-4 pl-0"> |
59 | | - {Object.entries(chapters).map(([chapter, time]) => { |
60 | | - const totalSeconds = parse(time, "s"); |
61 | | - |
62 | | - const thumbnail = new URL(thumbnailUrl); |
63 | | - thumbnail.searchParams.set("fit", "crop"); |
64 | | - thumbnail.searchParams.set("time", `${totalSeconds}s`); |
65 | | - |
66 | | - return ( |
67 | | - <li class="mt-0!"> |
68 | | - <button |
69 | | - class="flex h-full w-36 cursor-pointer flex-col rounded-sm border border-gray-200 bg-transparent p-4 dark:border-gray-700" |
70 | | - data-chapter={chapter} |
71 | | - data-time={totalSeconds} |
72 | | - > |
73 | | - <img |
74 | | - src={thumbnail.toString()} |
75 | | - alt={chapter} |
76 | | - width="120" |
77 | | - height="64" |
78 | | - class="border-accent bg-accent/10 rounded-sm border" |
79 | | - /> |
80 | | - <div class="flex h-full flex-col items-center justify-between"> |
81 | | - <strong class="line-clamp-2 text-xs" title={chapter}> |
82 | | - {chapter} |
83 | | - </strong> |
84 | | - <Badge text={time} variant="tip" class="w-fit" /> |
85 | | - </div> |
86 | | - </button> |
87 | | - </li> |
88 | | - ); |
89 | | - })} |
90 | | - </ul> |
91 | | - </p> |
| 57 | + <Details header="Chapters" open={false}> |
| 58 | + <p> |
| 59 | + <ul class="flex list-none gap-4 overflow-x-scroll pb-4 pl-0"> |
| 60 | + {Object.entries(chapters).map(([chapter, time]) => { |
| 61 | + const totalSeconds = parse(time, "s"); |
| 62 | + |
| 63 | + const thumbnail = new URL(thumbnailUrl); |
| 64 | + thumbnail.searchParams.set("fit", "crop"); |
| 65 | + thumbnail.searchParams.set("time", `${totalSeconds}s`); |
| 66 | + |
| 67 | + return ( |
| 68 | + <li class="mt-0!"> |
| 69 | + <button |
| 70 | + class="flex h-full w-36 cursor-pointer flex-col rounded-sm border border-gray-200 bg-transparent p-4 dark:border-gray-700" |
| 71 | + data-chapter={chapter} |
| 72 | + data-time={totalSeconds} |
| 73 | + > |
| 74 | + <img |
| 75 | + src={thumbnail.toString()} |
| 76 | + alt={chapter} |
| 77 | + width="120" |
| 78 | + height="64" |
| 79 | + class="border-accent bg-accent/10 rounded-sm border" |
| 80 | + /> |
| 81 | + <div class="flex h-full flex-col items-center justify-between"> |
| 82 | + <strong class="line-clamp-2 text-xs" title={chapter}> |
| 83 | + {chapter} |
| 84 | + </strong> |
| 85 | + <Badge text={time} variant="tip" class="w-fit" /> |
| 86 | + </div> |
| 87 | + </button> |
| 88 | + </li> |
| 89 | + ); |
| 90 | + })} |
| 91 | + </ul> |
| 92 | + </p> |
| 93 | + </Details> |
92 | 94 | ) |
93 | 95 | } |
94 | 96 |
|
|
0 commit comments