web/PickerItem: add support for gifs in picker

This commit is contained in:
wukko 2024-07-26 21:34:18 +06:00
parent e0bc0553ca
commit 7427788efd
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
3 changed files with 7 additions and 3 deletions

View file

@ -1,4 +1,5 @@
{
"picker.item.photo": "photo thumbnail",
"picker.item.video": "video thumbnail"
"picker.item.video": "video thumbnail",
"picker.item.gif": "gif thumbnail"
}

View file

@ -8,6 +8,7 @@
import IconMovie from "@tabler/icons-svelte/IconMovie.svelte";
import IconPhoto from "@tabler/icons-svelte/IconPhoto.svelte";
import IconGif from "@tabler/icons-svelte/IconGif.svelte";
export let item: DialogPickerItem;
export let number: number;
@ -21,6 +22,8 @@
<div class="picker-type">
{#if itemType === "video"}
<IconMovie />
{:else if itemType === "gif"}
<IconGif />
{:else}
<IconPhoto />
{/if}
@ -31,7 +34,7 @@
src={item.thumb ?? item.url}
class:loading={!imageLoaded}
class:video-thumbnail={itemType === "video"}
class:video-thumbnail={["video", "gif"].includes(itemType)}
on:load={() => imageLoaded = true}
alt="{$t(`a11y.dialog.picker.item.${itemType}`)} {number}"

View file

@ -10,7 +10,7 @@ export type DialogButton = {
export type SmallDialogIcons = "warn-red";
export type DialogPickerItem = {
type?: 'photo' | 'video',
type?: 'photo' | 'video' | 'gif',
url: string,
thumb?: string,
}