Compare commits

...

3 Commits

Author SHA1 Message Date
ef46342384 Lib: Fix LazyImage in Dropdown component 2024-12-16 21:11:52 +01:00
1a51b000ac Lib: Remove debug log 2024-12-16 21:11:37 +01:00
ebfcca559a Fix data dropdown padding 2024-12-16 21:11:08 +01:00
4 changed files with 24 additions and 11 deletions

View File

@ -43,7 +43,6 @@
let load: boolean = $state(false); let load: boolean = $state(false);
const lazy_visible_handler = () => { const lazy_visible_handler = () => {
console.log("Hi");
load = true; load = true;
}; };
</script> </script>

View File

@ -151,11 +151,12 @@
alt="" alt=""
imgwidth={option.icon_width ?? 1} imgwidth={option.icon_width ?? 1}
imgheight={option.icon_height ?? 1} imgheight={option.icon_height ?? 1}
class="mr-2 rounded" class="rounded"
style="height: 24px; max-width: 64px;" imgstyle="height: 24px;"
containerstyle="height: 24px;"
/> />
{/if} {/if}
{option.label} <span class="ml-2">{option.label}</span>
</div> </div>
</ListBoxItem> </ListBoxItem>
{/each} {/each}

View File

@ -12,9 +12,22 @@
/** The aspect ratio height used to reserve image space (while its loading) */ /** The aspect ratio height used to reserve image space (while its loading) */
imgheight: number; imgheight: number;
/** Optional extra style for the <img> element */
imgstyle?: string;
/** Optional extra style for the lazy <div> container */
containerstyle?: string;
} }
let { src, imgwidth, imgheight, ...restProps }: LazyImageProps = $props(); let {
src,
imgwidth,
imgheight,
imgstyle = undefined,
containerstyle = undefined,
...restProps
}: LazyImageProps = $props();
// Once the image is visible, this will be set to true, triggering the loading // Once the image is visible, this will be set to true, triggering the loading
let load: boolean = $state(false); let load: boolean = $state(false);
@ -32,7 +45,7 @@
<div <div
use:lazyload use:lazyload
onLazyVisible={lazy_visible_handler} onLazyVisible={lazy_visible_handler}
style="width: 100%; aspect-ratio: {imgwidth} / {imgheight};" style="aspect-ratio: {imgwidth} / {imgheight}; {containerstyle ?? ''}"
> >
{#if load} {#if load}
{#await fetch_image_base64(src) then data} {#await fetch_image_base64(src) then data}
@ -40,7 +53,7 @@
src={data} src={data}
use:img_opacity_handler use:img_opacity_handler
class="bg-surface-100 transition-opacity" class="bg-surface-100 transition-opacity"
style="width: 100%; opacity: 0; transition-duration: 500ms;" style="opacity: 0; transition-duration: 300ms; {imgstyle ?? ''}"
{...restProps} {...restProps}
/> />
{/await} {/await}

View File

@ -120,7 +120,7 @@
<!-- Menu Drawer --> <!-- Menu Drawer -->
<!-- Menu Drawer --> <!-- Menu Drawer -->
<!-- Menu Drawer --> <!-- Menu Drawer -->
<div class="flex flex-col gap-2 p-3"> <div class="flex flex-col gap-2 p-2 pt-3">
<Button href="/racepicks" onclick={close_drawer} color="surface" fullwidth>Race Picks</Button> <Button href="/racepicks" onclick={close_drawer} color="surface" fullwidth>Race Picks</Button>
<Button href="/seasonpicks" onclick={close_drawer} color="surface" fullwidth <Button href="/seasonpicks" onclick={close_drawer} color="surface" fullwidth
>Season Picks >Season Picks
@ -137,7 +137,7 @@
<!-- Data Drawer --> <!-- Data Drawer -->
<!-- Data Drawer --> <!-- Data Drawer -->
<!-- Data Drawer --> <!-- Data Drawer -->
<div class="flex flex-col gap-2 p-3"> <div class="flex flex-col gap-2 p-2 pt-3">
<Button href="/data/raceresult" onclick={close_drawer} color="surface" fullwidth <Button href="/data/raceresult" onclick={close_drawer} color="surface" fullwidth
>Race Results >Race Results
</Button> </Button>
@ -148,7 +148,7 @@
<!-- Login Drawer --> <!-- Login Drawer -->
<!-- Login Drawer --> <!-- Login Drawer -->
<!-- Login Drawer --> <!-- Login Drawer -->
<div class="flex flex-col gap-2 p-3"> <div class="flex flex-col gap-2 p-2 pt-3">
<h4 class="h4 select-none">Enter Username and Password</h4> <h4 class="h4 select-none">Enter Username and Password</h4>
<form method="POST" class="contents"> <form method="POST" class="contents">
<!-- Supply the pathname so the form can redirect to the current page. --> <!-- Supply the pathname so the form can redirect to the current page. -->
@ -177,7 +177,7 @@
<!-- Profile Drawer --> <!-- Profile Drawer -->
<!-- Profile Drawer --> <!-- Profile Drawer -->
<!-- Profile Drawer --> <!-- Profile Drawer -->
<div class="flex flex-col gap-2 p-3"> <div class="flex flex-col gap-2 p-2 pt-3">
<h4 class="h4 select-none">Edit Profile</h4> <h4 class="h4 select-none">Edit Profile</h4>
<form method="POST" enctype="multipart/form-data" class="contents"> <form method="POST" enctype="multipart/form-data" class="contents">
<!-- Supply the pathname so the form can redirect to the current page. --> <!-- Supply the pathname so the form can redirect to the current page. -->