summaryrefslogtreecommitdiffstatshomepage
path: root/frontend/src/lib/components/Titlebar.svelte
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--frontend/src/lib/components/Titlebar.svelte17
1 files changed, 10 insertions, 7 deletions
diff --git a/frontend/src/lib/components/Titlebar.svelte b/frontend/src/lib/components/Titlebar.svelte
index 8aab2dd..bb36d8f 100644
--- a/frontend/src/lib/components/Titlebar.svelte
+++ b/frontend/src/lib/components/Titlebar.svelte
@@ -1,12 +1,15 @@
<script lang="ts">
import Star from '$lib/icons/Star.svelte';
- import { createEventDispatcher } from 'svelte';
+ import type { MouseEventHandler } from 'svelte/elements';
- export let title: string;
- export let subtitle: string | null = '';
- export let favourite: boolean | undefined = undefined;
+ interface Props {
+ title: string;
+ subtitle?: string | null;
+ favourite?: boolean;
+ onfavourite?: MouseEventHandler<HTMLButtonElement>;
+ }
- const dispatch = createEventDispatcher<{ favourite: null }>();
+ let { title, subtitle, favourite, onfavourite }: Props = $props();
</script>
<div class="flex flex-wrap gap-x-4">
@@ -14,9 +17,9 @@
{#if favourite !== undefined}
<button
type="button"
- class="mr-1 flex items-center"
+ class="mr-1 flex items-center focus-visible:bg-yellow-400/20 focus-visible:outline-hidden"
title="Toggle favourite"
- on:click={() => dispatch('favourite')}
+ onclick={onfavourite}
>
<Star large hoverable {favourite} />
</button>