your personal website on atproto - mirror
blento.app
1<script lang="ts">
2 import type { CreationModalComponentProps } from '../types';
3 import GiphySearchModal from './GiphySearchModal.svelte';
4
5 let { item = $bindable(), oncreate, oncancel }: CreationModalComponentProps = $props();
6
7 let isOpen = $state(true);
8
9 function handleGifSelect(gif: {
10 id: string;
11 title: string;
12 images: { original: { mp4: string } };
13 }) {
14 item.cardData.url = gif.images.original.mp4;
15 item.cardData.alt = gif.title;
16 isOpen = false;
17 oncreate();
18 }
19
20 function handleCancel() {
21 isOpen = false;
22 oncancel();
23 }
24</script>
25
26<GiphySearchModal bind:open={isOpen} onselect={handleGifSelect} oncancel={handleCancel} />