Lib: Allow adding extra classes to LazyImage component

This commit is contained in:
2025-01-27 23:47:20 +01:00
parent aee0da174d
commit 42c6390d6e

View File

@ -18,6 +18,9 @@
/** Optional extra style for the lazy <div> container */ /** Optional extra style for the lazy <div> container */
containerstyle?: string; containerstyle?: string;
/** Additional classes to insert */
imgclass?: string;
} }
let { let {
@ -26,6 +29,7 @@
imgheight, imgheight,
imgstyle = undefined, imgstyle = undefined,
containerstyle = undefined, containerstyle = undefined,
imgclass = "",
...restProps ...restProps
}: LazyImageProps = $props(); }: LazyImageProps = $props();
@ -55,7 +59,7 @@
<img <img
src={data} src={data}
use:img_opacity_handler use:img_opacity_handler
class="bg-surface-100 transition-opacity" class="bg-surface-100 transition-opacity {imgclass}"
style="opacity: 0; transition-duration: 300ms; {imgstyle ?? ''}" style="opacity: 0; transition-duration: 300ms; {imgstyle ?? ''}"
draggable="false" draggable="false"
{...restProps} {...restProps}