diff --git a/src/lib/components/input/Button.svelte b/src/lib/components/input/Button.svelte index 79fc52bc..e2dbdeb4 100644 --- a/src/lib/components/input/Button.svelte +++ b/src/lib/components/input/Button.svelte @@ -1,6 +1,7 @@ {#if href} diff --git a/src/lib/components/ui/Navbar.svelte b/src/lib/components/ui/Navbar.svelte index c4c83f32..1811a8b2 100644 --- a/src/lib/components/ui/Navbar.svelte +++ b/src/lib/components/ui/Navbar.svelte @@ -6,6 +6,7 @@ import Spinner from '$lib/components/ui/loader/Spinner.svelte' import Menu from '$lib/components/ui/menu/Menu.svelte' import MenuButton from '$lib/components/ui/menu/MenuButton.svelte' + import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js' import { authData, getInstance, instance, user } from '$lib/lemmy.js' import { Color } from '$lib/ui/colors.js' import { @@ -39,6 +40,16 @@
+
diff --git a/src/lib/components/ui/toasts/ToastContainer.svelte b/src/lib/components/ui/toasts/ToastContainer.svelte index 10d16566..860d2919 100644 --- a/src/lib/components/ui/toasts/ToastContainer.svelte +++ b/src/lib/components/ui/toasts/ToastContainer.svelte @@ -1,17 +1,19 @@
- {#each $toasts as toast (toast.id)} + {#each $toasts as toast, index (toast.id)}
diff --git a/src/lib/components/ui/toasts/toasts.ts b/src/lib/components/ui/toasts/toasts.ts index 4fe1dfa1..da4b578a 100644 --- a/src/lib/components/ui/toasts/toasts.ts +++ b/src/lib/components/ui/toasts/toasts.ts @@ -1,10 +1,10 @@ import { writable } from 'svelte/store' export enum ToastType { - 'error' = 'from-red-400 to-red-400 text-red-400', - 'warning' = 'from-yellow-300 to-yellow-300 text-yellow-300', - 'success' = 'from-green-400 to-green-400 text-green-400', - 'info' = '', + 'error' = 'bg-red-500 text-black border border-red-600', + 'warning' = 'bg-yellow-400 text-black border border-yellow-500', + 'success' = 'bg-green-400 text-black border border-green-500', + 'info' = 'dark:bg-zinc-900 bg-white border border-slate-200 dark:border-zinc-800 shadow-lg', } export interface Toast { @@ -20,10 +20,12 @@ export function toast({ title, content, type = ToastType.info, + duration = 5000, }: { title?: string content: string - type: ToastType + type?: ToastType + duration?: number }) { let id = 0 @@ -31,19 +33,19 @@ export function toast({ id = Math.floor(Math.random() * 10000) return [ + ...toasts, { id: id, content: content, title: title, type: type, }, - ...toasts, ] }) setTimeout(() => { toasts.update((toasts) => toasts.filter((toast) => toast.id != id)) - }, 5000) + }, duration) } /** diff --git a/src/routes/inbox/InboxItem.svelte b/src/routes/inbox/InboxItem.svelte index f01b84eb..df0e93f2 100644 --- a/src/routes/inbox/InboxItem.svelte +++ b/src/routes/inbox/InboxItem.svelte @@ -67,7 +67,7 @@ {#if !isPrivateMessage(item)} -
+
-
- -
+
replyToMessage(item)} color="primary" + size="sm" > Submit