Skip to content

Commit

Permalink
add YouTubeLite.svelte, closes #195
Browse files Browse the repository at this point in the history
  • Loading branch information
SG60 committed Oct 4, 2022
1 parent ca96eea commit 2518f5b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"devDependencies": {
"@babel/core": "7.19.3",
"@justinribeiro/lite-youtube": "^1.4.0",
"@storybook/addon-a11y": "6.5.12",
"@storybook/addon-actions": "6.5.12",
"@storybook/addon-essentials": "6.5.12",
Expand Down
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/lib/YouTubeLite.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script type="ts">
export let id: string;
export let title = 'YouTube Video';
onMount(async () => {
await import('@justinribeiro/lite-youtube');
});
import { onMount } from 'svelte';
</script>

<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
<lite-youtube videoid={id} videotitle={title} />
</div>
21 changes: 21 additions & 0 deletions src/stories/YouTubeLite.stories.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script lang="ts">
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
import YouTubeLite from '$lib/YouTubeLite.svelte';
</script>

<Meta
title="Embeds/YouTube Lite"
component={YouTubeLite}
argTypes={{
title: { control: 'text' },
id: { control: 'text' }
}}
/>

<Template let:args><YouTubeLite {...args} /></Template>

<Story
name="standard"
args={{ id: 'dByckr7h1Zk', title: 'Video Title' }}
parameters={{ chromatic: { disableSnapshot: true } }}
/>

0 comments on commit 2518f5b

Please sign in to comment.