design: update button and toast components
This commit is contained in:
6 files changed
+85
-127
No files matched your search
@@ -24,7 +24,7 @@
|
||||
<div
|
||||
class={[
|
||||
toastColors[toast.type],
|
||||
'relative rounded-xl overflow-hidden flex flex-row items-start',
|
||||
'relative rounded-2xl overflow-hidden flex flex-row items-center gap-2 px-3 py-3 backdrop-blur-lg',
|
||||
toast.long ? 'w-full max-w-lg' : 'w-80',
|
||||
]}
|
||||
transition:fly={{
|
||||
@@ -40,9 +40,18 @@
|
||||
</div>
|
||||
{:else}
|
||||
<Icon
|
||||
size="20"
|
||||
size="28"
|
||||
mini
|
||||
class="relative mt-4 mr-2 ml-4 shrink-0 opacity-80"
|
||||
class={[
|
||||
'relative self-center shrink-0 p-1 rounded-full',
|
||||
toast.type == 'info'
|
||||
? 'bg-slate-200 dark:bg-zinc-50 text-slate-700 dark:text-zinc-700'
|
||||
: toast.type == 'success'
|
||||
? 'bg-green-400 dark:bg-green-300 dark:text-green-900 text-green-50'
|
||||
: toast.type == 'warning'
|
||||
? 'bg-yellow-400 dark:bg-yellow-300 dark:text-yellow-900 text-yellow-50'
|
||||
: 'bg-red-400 dark:bg-red-300 dark:text-red-900 text-red-50',
|
||||
]}
|
||||
src={toast.type == 'info'
|
||||
? InformationCircle
|
||||
: toast.type == 'success'
|
||||
@@ -55,17 +64,17 @@
|
||||
/>
|
||||
{/if}
|
||||
<div
|
||||
class="flex flex-col p-4 pl-0 break-words max-w-full text-slate-900 dark:text-zinc-50"
|
||||
class="flex flex-col break-words max-w-full text-slate-900 dark:text-zinc-50"
|
||||
>
|
||||
{#if toast.title}
|
||||
<h1 class="text-base font-bold">{toast.title}</h1>
|
||||
<h1 class="text-base font-semibold">{toast.title}</h1>
|
||||
{/if}
|
||||
<Markdown
|
||||
source={toast.content}
|
||||
class="{toast.long ? 'text-[15px]' : 'text-sm'} font-medium"
|
||||
class={toast.long ? 'text-[15px]' : 'text-sm font-medium'}
|
||||
/>
|
||||
</div>
|
||||
<div class="ml-auto flex items-center gap-1 m-2">
|
||||
<div class="absolute top-0 right-0 flex items-center gap-1 m-1">
|
||||
{#if toast.action}
|
||||
<button
|
||||
onclick={() => {
|
||||
|
||||
@@ -3,12 +3,10 @@ import { writable } from 'svelte/store'
|
||||
type ToastType = keyof typeof toastColors
|
||||
|
||||
export const toastColors = {
|
||||
error: 'bg-white dark:bg-zinc-925 text-red-500 shadow-red-400/30 shadow-sm',
|
||||
warning:
|
||||
'bg-white dark:bg-zinc-925 text-yellow-500 shadow-yellow-400/30 shadow-sm',
|
||||
success:
|
||||
'bg-white dark:bg-zinc-925 text-green-600 dark:text-green-400 shadow-green-400/30 shadow-sm',
|
||||
info: 'dark:bg-zinc-925 bg-white border border-slate-200 dark:border-zinc-800',
|
||||
error: 'bg-red-100/50 dark:bg-red-900/20 border-red-300/40 border',
|
||||
warning: 'bg-yellow-100/50 dark:bg-yellow-900/20 border-yellow-300/40 border',
|
||||
success: 'bg-green-100/50 dark:bg-green-900/20 border-green-300/40 border',
|
||||
info: 'dark:bg-zinc-925/90 bg-white border border-slate-200 dark:border-zinc-800',
|
||||
}
|
||||
|
||||
export interface Toast {
|
||||
|
||||
Reference in new issue
Block a user