refactor: add a YouTubeVideo component

This commit is contained in:
Oliver Davies 2023-05-01 21:10:40 +01:00
parent c91a573aaa
commit 2280ef1096
2 changed files with 16 additions and 6 deletions

View file

@ -0,0 +1,14 @@
---
interface Props {
id: string;
}
const videoId = Astro.props.id;
---
<iframe
allowfullscreen
class="w-full aspect-[16/9] border border-gray-500"
frameborder="0"
src={`https://www.youtube.com/embed/${videoId}?rel=0&iv_load_policy=3`}
/>

View file

@ -1,5 +1,6 @@
---
import Markdown from '../Markdown.astro';
import YouTubeVideo from '../YouTubeVideo.astro';
interface Props {
id: string;
@ -15,12 +16,7 @@ const { id, type }: Props = Astro.props;
<h2 class="mb-2">Video</h2>
<div>
<iframe
allowfullscreen
class="w-full aspect-[16/9]"
frameborder="0"
src={`https://www.youtube.com/embed/${id}?rel=0&iv_load_policy=3`}
/>
<YouTubeVideo id={id} />
</div>
</Markdown>
)