From 4df47e3de71c97f16b395d07ab30ae972284f3a7 Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Fri, 20 Oct 2023 14:13:56 +0300 Subject: [PATCH] feat(message): add onClick handler fixes #177 --- src/svelte/components/Message.svelte | 3 +++ src/types/Message.d.ts | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/svelte/components/Message.svelte b/src/svelte/components/Message.svelte index 5beaf9a9..18c6abc9 100644 --- a/src/svelte/components/Message.svelte +++ b/src/svelte/components/Message.svelte @@ -24,6 +24,8 @@ export let textFooter = ''; export let avatar = undefined; + export let onClick = undefined; + const rippleEl = { current: null }; const dark = useDarkClasses(); @@ -53,6 +55,7 @@ {id} bind:this={rippleEl.current} class={classes} + on:click={onClick} {...$$restProps} > {#if avatar || $$slots.avatar} diff --git a/src/types/Message.d.ts b/src/types/Message.d.ts index 308bde05..c57865b1 100644 --- a/src/types/Message.d.ts +++ b/src/types/Message.d.ts @@ -80,4 +80,9 @@ interface Props { * Message user's avatar URL */ avatar?: string | React.ReactNode; + + /** + * Message click handler + */ + onClick?: (e: any) => void; }