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 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}"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue