add error box component
This commit is contained in:
18
src/lib/ErrorBox.svelte
Normal file
18
src/lib/ErrorBox.svelte
Normal file
@@ -0,0 +1,18 @@
|
||||
<script lang="ts">
|
||||
import type { ClassValue } from 'svelte/elements';
|
||||
import type { ErrorMessage } from './error';
|
||||
|
||||
interface Props {
|
||||
error: ErrorMessage | null;
|
||||
class?: ClassValue | null;
|
||||
}
|
||||
|
||||
let { error, class: classValue }: Props = $props();
|
||||
</script>
|
||||
|
||||
{#if error}
|
||||
<!-- eslint-disable svelte/no-at-html-tags -->
|
||||
<div class={['bg-sui-accent text-sui-background my-4 rounded-xs px-6 py-4', classValue]}>
|
||||
{@html error.message}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -6,6 +6,7 @@ export { default as Checkbox, type CheckboxState } from './Checkbox.svelte';
|
||||
export { default as Combobox, type ComboboxOption } from './Combobox.svelte';
|
||||
export { default as DateInput } from './DateInput.svelte';
|
||||
export { default as Dialog } from './Dialog.svelte';
|
||||
export { default as ErrorBox } from './ErrorBox.svelte';
|
||||
export { default as FramelessButton } from './FramelessButton.svelte';
|
||||
export { default as InjectGoogleMaps } from './InjectGoogleMaps.svelte';
|
||||
export { default as InjectUmami } from './InjectUmami.svelte';
|
||||
|
||||
Reference in New Issue
Block a user