aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/media.svelte
diff options
context:
space:
mode:
authorIndrajith K L2024-02-05 04:15:02 +0530
committerIndrajith K L2024-02-05 04:15:02 +0530
commitf05a472585b2506da21aed71f0252b2d4c04a221 (patch)
tree4f65a3801f29250a049f3cc5cd2ac9c0a41d78f9 /src/lib/components/media.svelte
downloadreact-hooks-training-f05a472585b2506da21aed71f0252b2d4c04a221.tar.gz
react-hooks-training-f05a472585b2506da21aed71f0252b2d4c04a221.tar.bz2
react-hooks-training-f05a472585b2506da21aed71f0252b2d4c04a221.zip
React Slides
* Adds useState * State * useEffect * Side Effects
Diffstat (limited to 'src/lib/components/media.svelte')
-rw-r--r--src/lib/components/media.svelte22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lib/components/media.svelte b/src/lib/components/media.svelte
new file mode 100644
index 0000000..ffa2633
--- /dev/null
+++ b/src/lib/components/media.svelte
@@ -0,0 +1,22 @@
+<script lang="ts">
+ type Bool = boolean | null
+ type Element = 'video' | 'img' | 'iframe'
+
+ export let type: Element
+ export let src: string
+ export let autoplay: Bool = null
+ export let preload: Bool = null
+
+ delete $$restProps.class
+</script>
+
+<svelte:element
+ this={type}
+ data-src={src}
+ data-autoplay={autoplay}
+ data-prelod={preload}
+ class={$$props.class || ''}
+ {...$$restProps}
+>
+ <slot />
+</svelte:element>