web/PickerItem: small refactor

This commit is contained in:
dumbmoron 2024-07-23 16:07:12 +00:00
parent 690ae835b4
commit 5e26c1e122
No known key found for this signature in database

View file

@ -14,17 +14,12 @@
let imageLoaded = false; let imageLoaded = false;
let itemType = item.type; $: itemType = item.type ?? "photo";
if (!itemType) {
itemType = "photo"
}
</script> </script>
<button <button
class="picker-item" class="picker-item"
on:click={() => { on:click={() => downloadFile(item.url)}
downloadFile(item.url);
}}
> >
<div class="picker-type"> <div class="picker-type">
{#if itemType === "video"} {#if itemType === "video"}
@ -36,11 +31,11 @@
<img <img
class="picker-image" class="picker-image"
src={item.thumb ? item.thumb : item.url} src={item.thumb ?? item.url}
class:loading={!imageLoaded} class:loading={!imageLoaded}
class:video-thumbnail={item.thumb} class:video-thumbnail={item.thumb}
on:load={() => (imageLoaded = true)} on:load={() => imageLoaded = true}
alt="{$t(`a11y.dialog.picker.item.${itemType}`)} {number}" alt="{$t(`a11y.dialog.picker.item.${itemType}`)} {number}"
/> />