diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-11-03 09:43:38 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-11-03 09:43:38 -0500 |
| commit | bccb69f370a63d95099dcc5054ac10ca09ac8c84 (patch) | |
| tree | 527c2f4f51d97609acabe01f0cd75335c1ceb316 | |
| parent | 37a319642f52a8458a048262794eca041889396d (diff) | |
Generalize menu-closing
| -rw-r--r-- | ui/lib/components/Channel.svelte | 8 | ||||
| -rw-r--r-- | ui/routes/+layout.svelte | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/ui/lib/components/Channel.svelte b/ui/lib/components/Channel.svelte index 60c9092..3dc5c87 100644 --- a/ui/lib/components/Channel.svelte +++ b/ui/lib/components/Channel.svelte @@ -1,17 +1,11 @@ <script> - import { showMenu } from '$lib/store'; - export let id; export let name; export let active = false; - - function hideMenu() { - showMenu.update(() => false); - } </script> <li class="rounded-full" class:bg-slate-400={active}> - <a href="/ch/{id}" on:click={hideMenu}> + <a href="/ch/{id}"> <span class="badge bg-primary-500">#</span> <span class="flex-auto">{name}</span> </a> diff --git a/ui/routes/+layout.svelte b/ui/routes/+layout.svelte index da205d3..e0355dd 100644 --- a/ui/routes/+layout.svelte +++ b/ui/routes/+layout.svelte @@ -1,4 +1,5 @@ <script> + import { onNavigate } from '$app/navigation'; import '../app.css'; import logo from '$lib/assets/logo.png'; @@ -10,6 +11,10 @@ function toggleMenu() { showMenu.update((value) => !value); } + + onNavigate(() => { + showMenu.update(() => false); + }); </script> <div id="app" class="m-0 p-0 h-vh w-full"> |
