Add long press for chat messages

This commit is contained in:
Jon Staab
2024-10-24 16:28:56 -07:00
parent 87df0eeeea
commit 81672080f5
6 changed files with 80 additions and 9 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
<div class="grid grid-cols-2 gap-2 {$$props.class}">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 {$$props.class}">
<label class="flex items-center gap-2 font-bold">
<slot name="label" />
</label>
+15
View File
@@ -0,0 +1,15 @@
<script lang="ts">
export let onLongPress
const onTouchStart = () => {
timeout = setTimeout(onLongPress, 500)
}
const onTouchEnd = () => clearTimeout(timeout)
let timeout: number
</script>
<div on:touchstart={onTouchStart} on:touchend={onTouchEnd} {...$$props}>
<slot />
</div>