mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
web/PickerItem: small refactor
This commit is contained in:
parent
690ae835b4
commit
5e26c1e122
1 changed files with 4 additions and 9 deletions
|
@ -14,17 +14,12 @@
|
|||
|
||||
let imageLoaded = false;
|
||||
|
||||
let itemType = item.type;
|
||||
if (!itemType) {
|
||||
itemType = "photo"
|
||||
}
|
||||
$: itemType = item.type ?? "photo";
|
||||
</script>
|
||||
|
||||
<button
|
||||
class="picker-item"
|
||||
on:click={() => {
|
||||
downloadFile(item.url);
|
||||
}}
|
||||
on:click={() => downloadFile(item.url)}
|
||||
>
|
||||
<div class="picker-type">
|
||||
{#if itemType === "video"}
|
||||
|
@ -36,11 +31,11 @@
|
|||
|
||||
<img
|
||||
class="picker-image"
|
||||
src={item.thumb ? item.thumb : item.url}
|
||||
src={item.thumb ?? item.url}
|
||||
|
||||
class:loading={!imageLoaded}
|
||||
class:video-thumbnail={item.thumb}
|
||||
on:load={() => (imageLoaded = true)}
|
||||
on:load={() => imageLoaded = true}
|
||||
|
||||
alt="{$t(`a11y.dialog.picker.item.${itemType}`)} {number}"
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue