mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat: notifications can have buttons
This commit is contained in:
1 parent
de526fa5e7
commit
a2427251f4
3 files changed
+18
-11
No files matched your search
@@ -4,6 +4,7 @@
|
||||
|
||||
export let type: Notification['type'] = 'info';
|
||||
export let title: Notification['title'];
|
||||
export let func: Notification['func'];
|
||||
|
||||
let icon: string;
|
||||
switch (type) {
|
||||
@@ -43,14 +44,13 @@
|
||||
{/if}
|
||||
<p><slot /></p>
|
||||
</div>
|
||||
<!--
|
||||
<div class="buttons u-flex">
|
||||
<button class="button is-text is-small">
|
||||
<span class="text">Action 1</span>
|
||||
</button>
|
||||
<button class="button is-text is-small">
|
||||
<span class="text">Action 2</span>
|
||||
</button>
|
||||
</div>
|
||||
-->
|
||||
{#if func}
|
||||
<div class="buttons u-flex">
|
||||
{#each func as f}
|
||||
<button class="button is-text is-small" on:click={f.method}>
|
||||
<span class="text">{f.name}</span>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</li>
|
||||
@@ -10,7 +10,8 @@
|
||||
<Notification
|
||||
type={notification.type}
|
||||
title={notification.title}
|
||||
on:dismiss={() => dismissNotification(notification.id)}>
|
||||
on:dismiss={() => dismissNotification(notification.id)}
|
||||
func={notification?.func}>
|
||||
{notification.message}
|
||||
</Notification>
|
||||
{/each}
|
||||
|
||||
@@ -7,6 +7,12 @@ export type Notification = {
|
||||
timeout?: number;
|
||||
message: string;
|
||||
title?: string;
|
||||
func?: Func[];
|
||||
};
|
||||
|
||||
export type Func = {
|
||||
method: () => void; //TODO Check if promise is needed rather tha () => void
|
||||
name: string;
|
||||
};
|
||||
|
||||
let counter = 0;
|
||||
|
||||
Reference in new issue
Block a user