@setoelkahfi / svara / commits / fca077a

Close on clear notifications

mellbacon committed Dec 29, 2022 at 11:42 UTC fca077a24dbcfe12a1a5043622fbccda524aa40b
2 files changed +10 -3
src/components/Footer/Footer.svelte
+4 -2
@@ -37,10 +37,12 @@
37
38 export let tool = writable({name: "", content: null});
39
40 - export function togglePanel(x) {
40 + export function togglePanel(x = null) {
41 show = !show;
42 showpanel.set(show);
43 - tool.set({name: x.name, content: x.content});
43 + if (x) {
44 + tool.set({name: x.name, content: x.content});
45 + }
46 }
47 </script>
48
src/components/Notifications/Notifications.svelte
+6 -1
@@ -1,10 +1,15 @@
1 <script lang="ts">
2 import { clearNotifications, notifications } from "./Notifications";
3 import Notification from "./Notification.svelte";
4 + import {togglePanel} from "../Footer/Footer.svelte";
5 </script>
6
7 <!-- svelte-ignore a11y-click-events-have-key-events -->
7 -<div id="title">Notifications <span on:click={() => {clearNotifications()}}>Clear Notifications</span></div>
8 +<div id="title">Notifications <span on:click={() => {
9 + clearNotifications();
10 + togglePanel();
11 + }
12 +}>Clear Notifications</span></div>
13 <div id="notifications">
14 {#each $notifications as notification}
15 <Notification id={notification.id} type={notification.type} message={notification.message} read={notification.read} actions={notification.actions}></Notification>