Build out components #45

Merged
BenjaminPalko merged 14 commits from build-out-components into master 2025-01-04 22:14:19 -05:00
3 changed files with 72 additions and 0 deletions
Showing only changes of commit c59c82d614 - Show all commits

View file

@ -0,0 +1,40 @@
<script module lang="ts">
import { defineMeta } from '@storybook/addon-svelte-csf';
import type { ComponentProps } from 'svelte';
import Loading from './Loading.svelte';
const { Story } = defineMeta({
title: 'Feedback/Loading',
component: Loading,
argTypes: {
color: {
control: 'select',
options: [
'neutral',
'primary',
'secondary',
'accent',
'info',
'success',
'warning',
'error',
],
piopi commented 2025-01-04 21:30:42 -05:00 (Migrated from github.com)
Review

I see some of them also used in the alert and other place, maybe it could be worth it to put them in an array or enums as UI tokens

I see some of them also used in the alert and other place, maybe it could be worth it to put them in an array or enums as UI tokens
piopi commented 2025-01-04 21:31:06 -05:00 (Migrated from github.com)
Review

Same thing for the sizes tokens and anything you see used in common

Same thing for the sizes tokens and anything you see used in common
piopi commented 2025-01-04 21:33:21 -05:00 (Migrated from github.com)
Review

Just noticed my comment is on the stories file but I meant it to be on the component itself

Just noticed my comment is on the stories file but I meant it to be on the component itself
BenjaminPalko commented 2025-01-04 21:46:12 -05:00 (Migrated from github.com)
Review

It did occur to me, there can be variation between components though, some will have ghost, others might have neutral, or not. So I just haven't made a decision for it yet.

It did occur to me, there can be variation between components though, some will have ghost, others might have neutral, or not. So I just haven't made a decision for it yet.
},
size: { control: 'select', options: ['xs', 'sm', 'md', 'lg'] },
variant: {
control: 'select',
options: ['spinner', 'dots', 'ring', 'ball', 'bars', 'infinity'],
},
},
});
</script>
{#snippet template(props: ComponentProps<typeof Loading>)}
<Loading {...props} />
{/snippet}
<Story
name="Default"
args={{ color: 'neutral', size: 'md', variant: 'spinner' }}
children={template}
/>

View file

@ -0,0 +1,31 @@
<script lang="ts">
import type { DaisyColor, DaisySize } from '$lib/types';
type Props = {
color?: Exclude<DaisyColor, 'ghost'>;
size?: DaisySize | 'md';
variant?: 'spinner' | 'dots' | 'ring' | 'ball' | 'bars' | 'infinity';
};
let { color, size = 'md', variant = 'spinner' }: Props = $props();
</script>
<span
class="loading"
class:text-primary={color === 'primary'}
class:text-secondary={color === 'secondary'}
class:text-accent={color === 'accent'}
class:text-info={color === 'info'}
class:text-success={color === 'success'}
class:text-warning={color === 'warning'}
class:text-error={color === 'error'}
class:loading-xs={size === 'xs'}
class:loading-sm={size === 'sm'}
class:loading-md={size === 'md'}
class:loading-lg={size === 'lg'}
class:loading-spinner={variant === 'spinner'}
class:loading-dots={variant === 'dots'}
class:loading-ring={variant === 'ring'}
class:loading-ball={variant === 'ball'}
class:loading-bars={variant === 'bars'}
class:loading-infinity={variant === 'infinity'}
></span>

View file

@ -1,2 +1,3 @@
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';