design: use better component for ErrorContainer
This commit is contained in:
1 file changed
+14
-22
@@ -16,9 +16,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button } from 'mono-svelte'
|
|
||||||
import { onDestroy } from 'svelte'
|
import { onDestroy } from 'svelte'
|
||||||
import { Icon, XCircle, XMark } from 'svelte-hero-icons'
|
import { ExclamationTriangle, Icon } from 'svelte-hero-icons'
|
||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
import { fly, slide } from 'svelte/transition'
|
import { fly, slide } from 'svelte/transition'
|
||||||
|
|
||||||
@@ -39,37 +38,30 @@
|
|||||||
|
|
||||||
{#if scopedErrors.length > 0}
|
{#if scopedErrors.length > 0}
|
||||||
<div
|
<div
|
||||||
class={clazz}
|
class={['flex flex-col gap-4', clazz]}
|
||||||
in:slide={{ duration: 400, easing: expoOut }}
|
in:slide={{ duration: 400, easing: expoOut }}
|
||||||
out:slide={{ duration: 400, delay: 400, easing: expoOut }}
|
out:slide={{ duration: 400, delay: 400, easing: expoOut }}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-row p-1.5 bg-red-100/50 dark:bg-red-900/10 rounded-xl border border-red-300/40 gap-2 items-center"
|
in:fly|global={{
|
||||||
in:fly={{ y: -8, duration: 400, delay: 200, opacity: 0, easing: expoOut }}
|
y: -8,
|
||||||
|
duration: 400,
|
||||||
|
delay: 200,
|
||||||
|
opacity: 0,
|
||||||
|
easing: expoOut,
|
||||||
|
}}
|
||||||
out:fly={{ y: -8, duration: 400, opacity: 0, easing: expoOut }}
|
out:fly={{ y: -8, duration: 400, opacity: 0, easing: expoOut }}
|
||||||
|
class="bg-red-400/10 border border-red-500/30 text-red-900 dark:text-red-50 rounded-2xl p-4"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
src={XCircle}
|
src={ExclamationTriangle}
|
||||||
size="28"
|
size="32"
|
||||||
mini
|
mini
|
||||||
class={[
|
class="inline-block rounded-lg bg-red-500 p-1.5 text-white clear-both float-left mr-2"
|
||||||
'relative self-center shrink-0 p-0.5 rounded-full',
|
|
||||||
'bg-red-400 dark:bg-red-400 dark:text-red-900 text-red-50',
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col text-sm font-medium gap-4">
|
|
||||||
{#each scopedErrors as error}
|
{#each scopedErrors as error}
|
||||||
{error.message}
|
<p>{error.message}</p>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<Button
|
|
||||||
onclick={() => clearErrorScope(scope)}
|
|
||||||
color="tertiary"
|
|
||||||
size="square-sm"
|
|
||||||
class="ml-auto"
|
|
||||||
>
|
|
||||||
<Icon src={XMark} size="16" micro />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
Reference in new issue
Block a user