update components

This commit is contained in:
Benjamin Palko 2025-01-17 11:33:12 -05:00 committed by Baobeld
parent 0d21abd3a0
commit 46eed550d5
3 changed files with 9 additions and 5 deletions

View file

@ -38,7 +38,7 @@
<label class="form-control w-full" transition:fadeTransition={{ duration: fade ? 200 : 0 }}> <label class="form-control w-full" transition:fadeTransition={{ duration: fade ? 200 : 0 }}>
<div class="label"> <div class="label">
<span <span
class="label-text" class="label-text flex items-center gap-2"
class:text-primary={color === 'primary'} class:text-primary={color === 'primary'}
class:text-secondary={color === 'secondary'} class:text-secondary={color === 'secondary'}
class:text-accent={color === 'accent'} class:text-accent={color === 'accent'}

View file

@ -19,7 +19,7 @@
<label class="form-control w-full max-w-lg"> <label class="form-control w-full max-w-lg">
<div class="label"> <div class="label">
<span <span
class="label-text" class="label-text flex items-center gap-2"
class:text-primary={color === 'primary'} class:text-primary={color === 'primary'}
class:text-secondary={color === 'secondary'} class:text-secondary={color === 'secondary'}
class:text-accent={color === 'accent'} class:text-accent={color === 'accent'}

View file

@ -1,23 +1,27 @@
<script lang="ts"> <script lang="ts">
import type { DaisyColor } from '$lib/types'; import type { DaisyColor } from '$lib/types';
import clsx from 'clsx';
import type { Snippet } from 'svelte'; import type { Snippet } from 'svelte';
import type { SvelteHTMLElements } from 'svelte/elements';
import { twMerge } from 'tailwind-merge';
type Props = { type Props = {
children?: Snippet; children?: Snippet;
icon?: Snippet; icon?: Snippet;
status?: Extract<DaisyColor, 'info' | 'success' | 'warning' | 'error'>; status?: Extract<DaisyColor, 'info' | 'success' | 'warning' | 'error'>;
}; } & SvelteHTMLElements['div'];
let { children, icon, status: color }: Props = $props(); let { children, class: className, icon, status: color, ...props }: Props = $props();
</script> </script>
<div <div
role="alert" role="alert"
class="alert" class={twMerge('alert', clsx(className))}
class:alert-info={color === 'info'} class:alert-info={color === 'info'}
class:alert-success={color === 'success'} class:alert-success={color === 'success'}
class:alert-warning={color === 'warning'} class:alert-warning={color === 'warning'}
class:alert-error={color === 'error'} class:alert-error={color === 'error'}
{...props}
> >
{@render icon?.()} {@render icon?.()}
{@render children?.()} {@render children?.()}