* feat: add donation dialog, close #524 * fix: command palette broken
This commit is contained in:
1 parent
58d5be7027
commit
f1f3955a7b
12 files changed
+134
-60
No files matched your search
@@ -12,6 +12,7 @@
|
||||
Check,
|
||||
} from 'svelte-hero-icons'
|
||||
import { fly } from 'svelte/transition'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
|
||||
interface Props {
|
||||
toast: Toast
|
||||
@@ -21,9 +22,11 @@
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="{toastColors[
|
||||
toast.type
|
||||
]} relative w-80 rounded-xl overflow-hidden flex flex-row items-center"
|
||||
class={[
|
||||
toastColors[toast.type],
|
||||
'relative rounded-xl overflow-hidden flex flex-row items-start',
|
||||
toast.long ? 'w-full max-w-lg' : 'w-80',
|
||||
]}
|
||||
transition:fly={{
|
||||
duration: 600,
|
||||
y: 8,
|
||||
@@ -39,7 +42,7 @@
|
||||
<Icon
|
||||
size="20"
|
||||
mini
|
||||
class="relative m-2 ml-4 shrink-0"
|
||||
class="relative mt-4 mr-2 ml-4 shrink-0 opacity-80"
|
||||
src={toast.type == 'info'
|
||||
? InformationCircle
|
||||
: toast.type == 'success'
|
||||
@@ -51,11 +54,16 @@
|
||||
: ExclamationCircle}
|
||||
/>
|
||||
{/if}
|
||||
<div class="flex flex-col p-4 pl-0 break-words max-w-full">
|
||||
<div
|
||||
class="flex flex-col p-4 pl-0 break-words max-w-full text-slate-900 dark:text-zinc-50"
|
||||
>
|
||||
{#if toast.title}
|
||||
<h1 class="text-base font-bold">{toast.title}</h1>
|
||||
{/if}
|
||||
<p class="text-sm">{toast.content}</p>
|
||||
<Markdown
|
||||
source={toast.content}
|
||||
class="{toast.long ? 'text-[15px]' : 'text-sm'} font-medium"
|
||||
/>
|
||||
</div>
|
||||
<div class="ml-auto flex items-center gap-1 m-2">
|
||||
{#if toast.action}
|
||||
@@ -64,18 +72,18 @@
|
||||
toast.action?.()
|
||||
toasts.update(toasts => toasts.filter(t => t.id != toast.id))
|
||||
}}
|
||||
class="rounded-lg w-max transition-colors hover:bg-black/20 dark:hover:bg-white/20 p-2"
|
||||
class="rounded-lg w-max transition-colors hover:bg-slate-100 dark:hover:bg-zinc-800 p-1 cursor-pointer"
|
||||
>
|
||||
<Icon src={Check} size="16" mini />
|
||||
<Icon src={Check} size="20" micro />
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
onclick={() => {
|
||||
toasts.update(toasts => toasts.filter(t => t.id != toast.id))
|
||||
}}
|
||||
class="rounded-lg w-max transition-colors hover:bg-black/20 dark:hover:bg-white/20 p-2"
|
||||
class="rounded-lg w-max transition-colors hover:bg-slate-100 dark:hover:bg-zinc-800 p-1 cursor-pointer"
|
||||
>
|
||||
<Icon src={XMark} size="16" mini />
|
||||
<Icon src={XMark} size="20" micro />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3,13 +3,12 @@ import { writable } from 'svelte/store'
|
||||
type ToastType = keyof typeof toastColors
|
||||
|
||||
export const toastColors = {
|
||||
error:
|
||||
'bg-white dark:bg-zinc-950 text-red-600 dark:text-red-400 border border-red-700',
|
||||
error: 'bg-white dark:bg-zinc-925 text-red-500 shadow-red-400/30 shadow-sm',
|
||||
warning:
|
||||
'bg-white dark:bg-zinc-950 text-yellow-600 dark:text-yellow-400 border border-yellow-600',
|
||||
'bg-white dark:bg-zinc-925 text-yellow-500 shadow-yellow-400/30 shadow-sm',
|
||||
success:
|
||||
'bg-white dark:bg-zinc-950 text-green-700 dark:text-green-400 border border-green-500',
|
||||
info: 'dark:bg-zinc-950 bg-white border border-slate-200 dark:border-zinc-800 shadow-lg',
|
||||
'bg-white dark:bg-zinc-925 text-green-700 shadow-green-400/30 shadow-sm',
|
||||
info: 'dark:bg-zinc-925 bg-white border border-slate-200 dark:border-zinc-800',
|
||||
}
|
||||
|
||||
export interface Toast {
|
||||
@@ -18,6 +17,7 @@ export interface Toast {
|
||||
content: string
|
||||
type: ToastType
|
||||
loading?: boolean
|
||||
long?: boolean
|
||||
action?: () => void
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ export function toast({
|
||||
type = 'info',
|
||||
duration = 5000,
|
||||
loading = false,
|
||||
long = false,
|
||||
action,
|
||||
}: {
|
||||
title?: string
|
||||
@@ -36,6 +37,7 @@ export function toast({
|
||||
type?: ToastType
|
||||
duration?: number
|
||||
loading?: boolean
|
||||
long?: boolean
|
||||
action?: () => void
|
||||
}) {
|
||||
let id = 0
|
||||
@@ -51,6 +53,7 @@ export function toast({
|
||||
title: title,
|
||||
type: type,
|
||||
loading: loading,
|
||||
long: long,
|
||||
action: action,
|
||||
},
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user