Progress component
This commit is contained in:
parent
c59c82d614
commit
7659ee200f
3 changed files with 49 additions and 0 deletions
24
src/lib/components/Feedback/Progress.stories.svelte
Normal file
24
src/lib/components/Feedback/Progress.stories.svelte
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<script module lang="ts">
|
||||||
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
||||||
|
import type { ComponentProps } from 'svelte';
|
||||||
|
import Progress from './Progress.svelte';
|
||||||
|
|
||||||
|
const { Story } = defineMeta({
|
||||||
|
title: 'Feedback/Progress',
|
||||||
|
component: Progress,
|
||||||
|
argTypes: {
|
||||||
|
color: {
|
||||||
|
control: 'select',
|
||||||
|
options: ['primary', 'secondary', 'accent', 'info', 'success', 'warning', 'error'],
|
||||||
|
},
|
||||||
|
value: { control: 'number' },
|
||||||
|
max: { control: 'number' },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#snippet template(props: ComponentProps<typeof Progress>)}
|
||||||
|
<Progress {...props} />
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
<Story name="Default" args={{}} children={template} />
|
||||||
24
src/lib/components/Feedback/Progress.svelte
Normal file
24
src/lib/components/Feedback/Progress.svelte
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type { DaisyColor } from '$lib/types';
|
||||||
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
||||||
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
color?: Exclude<DaisyColor, 'neutral' | 'ghost'>;
|
||||||
|
} & SvelteHTMLElements['progress'];
|
||||||
|
let { children, class: className, color, ...props }: Props = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<progress
|
||||||
|
class={twMerge(className, 'progress')}
|
||||||
|
class:progress-primary={color === 'primary'}
|
||||||
|
class:progress-secondary={color === 'secondary'}
|
||||||
|
class:progress-accent={color === 'accent'}
|
||||||
|
class:progress-info={color === 'info'}
|
||||||
|
class:progress-success={color === 'success'}
|
||||||
|
class:progress-warning={color === 'warning'}
|
||||||
|
class:progress-error={color === 'error'}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{@render children?.()}
|
||||||
|
</progress>
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
export { default as Alert } from './Alert.svelte';
|
export { default as Alert } from './Alert.svelte';
|
||||||
export { default as Loader } from './Loader.svelte';
|
export { default as Loader } from './Loader.svelte';
|
||||||
export { default as Loading } from './Loading.svelte';
|
export { default as Loading } from './Loading.svelte';
|
||||||
|
export { default as Progress } from './Progress.svelte';
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue