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

+13 -3
View File
@@ -7,6 +7,9 @@
export let value: string = ''
export let maxlength: number = -1
export let required = false
export let id = ''
export let pattern: string | undefined = undefined
export let minlength: number = 0
function typeAction(node: Node) {
// @ts-ignore
@@ -33,11 +36,18 @@
<input
use:typeAction
bind:value
on:keydown={(e) => dispatcher('keydown', e)}
on:input={(e) => dispatcher('input', e)}
{placeholder}
{maxlength}
class="w-full px-3 text-sm py-2.5 bg-transparent border border-black/20
dark:border-white/20 dark:focus:border-white focus:outline-none
focus:border-black transition-colors rounded-md {clazz}"
{minlength}
{pattern}
{id}
class="{value.length != 0
? 'invalid:border-red-400'
: ''} w-full px-3 text-sm py-2.5 bg-transparent
border border-black/20 dark:border-white/20 dark:focus:border-white
focus:outline-none focus:border-black transition-colors rounded-md {clazz}"
{required}
/>
</label>
+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) => {