Fix some click propagation

This commit is contained in:
Jon Staab
2024-10-24 10:11:01 -07:00
parent edeb573caa
commit 7ae0711905
4 changed files with 23 additions and 11 deletions
+1 -1
View File
@@ -25,7 +25,7 @@
class:border={isOwn} class:border={isOwn}
class:border-solid={isOwn} class:border-solid={isOwn}
class:border-primary={isOwn} class:border-primary={isOwn}
on:click|stopPropagation|preventDefault={onClick}> on:click={onClick}>
<span>{displayReaction(content)}</span> <span>{displayReaction(content)}</span>
{#if events.length > 1} {#if events.length > 1}
<span>{events.length}</span> <span>{events.length}</span>
+4 -4
View File
@@ -43,9 +43,9 @@
</script> </script>
<div class="flex flex-wrap items-center justify-between gap-2"> <div class="flex flex-wrap items-center justify-between gap-2">
<div class="flex gap-2"> <Button class="flex gap-2">
<ReactionSummary {event} {onReactionClick} /> <ReactionSummary {event} {onReactionClick} />
</div> </Button>
<div class="flex flex-grow justify-end gap-2"> <div class="flex flex-grow justify-end gap-2">
{#if showActivity} {#if showActivity}
<div class="flex-inline btn btn-neutral btn-xs gap-1 rounded-full"> <div class="flex-inline btn btn-neutral btn-xs gap-1 rounded-full">
@@ -56,7 +56,7 @@
Active {formatTimestampRelative(lastActive)} Active {formatTimestampRelative(lastActive)}
</div> </div>
{/if} {/if}
<button type="button" class="join rounded-full" on:click|stopPropagation> <Button class="join rounded-full">
<EmojiButton {onEmoji} class="join-item btn-neutral" /> <EmojiButton {onEmoji} class="join-item btn-neutral" />
<Tippy <Tippy
bind:popover bind:popover
@@ -67,6 +67,6 @@
<Icon icon="menu-dots" size={4} /> <Icon icon="menu-dots" size={4} />
</Button> </Button>
</Tippy> </Tippy>
</button> </Button>
</div> </div>
</div> </div>
+15 -3
View File
@@ -1,3 +1,15 @@
<button on:click|stopPropagation type="button" {...$$props} class="text-left {$$props.class}"> <script lang="ts">
<slot /> export let type: "button" | "submit" = "button"
</button>
$: className = `text-left ${$$props.class}`
</script>
{#if type === 'submit'}
<button {...$$props} {type} class={className}>
<slot />
</button>
{:else}
<button on:click|stopPropagation|preventDefault {...$$props} {type} class={className}>
<slot />
</button>
{/if}
+3 -3
View File
@@ -28,7 +28,7 @@
<div class="column content gap-4"> <div class="column content gap-4">
<h1 class="text-center text-5xl">Welcome to</h1> <h1 class="text-center text-5xl">Welcome to</h1>
<h1 class="mb-4 text-center text-5xl font-bold uppercase">{PLATFORM_NAME}</h1> <h1 class="mb-4 text-center text-5xl font-bold uppercase">{PLATFORM_NAME}</h1>
<div class="grid gap-3 lg:grid-cols-2"> <div class="col-3">
<Button on:click={addSpace}> <Button on:click={addSpace}>
<CardButton> <CardButton>
<div slot="icon"><Icon icon="add-circle" size={7} /></div> <div slot="icon"><Icon icon="add-circle" size={7} /></div>
@@ -38,14 +38,14 @@
</Button> </Button>
<Link href="/people"> <Link href="/people">
<CardButton> <CardButton>
<div slot="icon"><Icon icon="plain" size={7} /></div> <div slot="icon"><Icon icon="compass" size={7} /></div>
<div slot="title">Browse the network</div> <div slot="title">Browse the network</div>
<div slot="info">Find your people on the nostr network</div> <div slot="info">Find your people on the nostr network</div>
</CardButton> </CardButton>
</Link> </Link>
<Button on:click={startChat}> <Button on:click={startChat}>
<CardButton> <CardButton>
<div slot="icon"><Icon icon="hand-pills" size={7} /></div> <div slot="icon"><Icon icon="chat-round" size={7} /></div>
<div slot="title">Start a conversation</div> <div slot="title">Start a conversation</div>
<div slot="info">Use nostr's encrypted group chats to stay in touch</div> <div slot="info">Use nostr's encrypted group chats to stay in touch</div>
</CardButton> </CardButton>