feat: Update login screen

This commit is contained in:
Xyphyn committed 2023-07-12 14:06:59 -07:00
1 parent 9007eb46d6
commit c3fc860117
5 files changed
+114 -20

No files matched your search

+3 -1
View File
@@ -43,7 +43,9 @@
: ExclamationCircle}
/>
<div class="flex flex-col p-4 pl-0">
<h1 class="text-base font-bold">{toast.title}</h1>
{#if toast.title}
<h1 class="text-base font-bold">{toast.title}</h1>
{/if}
<p class="text-sm">{toast.content}</p>
</div>
<button
+39 -2
View File
@@ -9,14 +9,51 @@ export enum ToastType {
export interface Toast {
id: number
title: string
title: string | undefined
content: string
type: ToastType
}
export const toasts = writable<Toast[]>([])
export function addToast(title: string, content: string, type: ToastType) {
export function toast({
title,
content,
type = ToastType.info,
}: {
title?: string
content: string
type: ToastType
}) {
let id = 0
toasts.update((toasts) => {
id = Math.floor(Math.random() * 10000)
return [
{
id: id,
content: content,
title: title,
type: type,
},
...toasts,
]
})
setTimeout(() => {
toasts.update((toasts) => toasts.filter((toast) => toast.id != id))
}, 5000)
}
/**
* @deprecated use @function toast
*/
export function addToast(
title: string | undefined,
content: string,
type: ToastType
) {
let id = 0
toasts.update((toasts) => {