fix(frontend): Change button click propagation (#690)

Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
This commit is contained in:
Ádám Kovács
2022-10-08 13:31:32 +02:00
committed by GitHub
co-authored by Ruben Fiszel
parent e66522d266
commit 911e6c32d6
2 changed files with 3 additions and 2 deletions
@@ -1,6 +1,5 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { goto } from '$app/navigation'
import { classNames } from '$lib/utils'
import Icon from 'svelte-awesome'
import { ButtonType } from './model'
@@ -45,6 +44,7 @@
}
$: buttonProps = {
id,
class: classNames(
colorVariants[color][variant],
variant === 'border' ? 'border' : '',
@@ -63,9 +63,9 @@
}
function onClick(event: MouseEvent) {
event.preventDefault()
dispatch('click', event)
if (href) {
event.preventDefault()
goto(href)
}
}
@@ -47,6 +47,7 @@
bind:element={ref}
{...commonProps}
btnClasses="{$$slots.main ? '!rounded-l-none' : ''} {toggleClasses}"
on:click={() => {}}
>
<slot name="toggle">
<!-- Invisible, but needed to match the height of the 'main' button -->