From 00a577520c2df31037b1adc050cea7d412eafb6c Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Fri, 27 Dec 2024 19:43:16 +0100 Subject: [PATCH] Lib: Allow to pass an onclick handler for the card image --- src/lib/components/cards/Card.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/components/cards/Card.svelte b/src/lib/components/cards/Card.svelte index 39e19c8..300a82a 100644 --- a/src/lib/components/cards/Card.svelte +++ b/src/lib/components/cards/Card.svelte @@ -23,6 +23,9 @@ /** The width class for the card, defaults to [w-auto] */ width?: string; + + /** An optional event handler for clicking the image */ + imgonclick?: (event: Event) => void; } let { @@ -33,6 +36,7 @@ imgid = undefined, imghidden = false, width = "w-auto", + imgonclick = undefined, ...restProps }: CardProps = $props(); @@ -53,6 +57,7 @@ hidden={imghidden} imgwidth={imgwidth ?? 0} imgheight={imgheight ?? 0} + onclick={imgonclick} /> {/if}