Norbert de Langen e26712b4cf Add Storybook template components for Svelte Vite CLI
Add Button, Header, and Page components with stories for multiple Svelte variations:
- JavaScript
- Svelte 5 JavaScript
- Svelte 5 TypeScript (3.8 and 4.9)
- TypeScript (4.9)

Include stories, components, and CSS files to support the Storybook template components across different Svelte configurations
2025-03-07 15:37:41 +01:00

27 lines
822 B
Svelte

<script>
import './button.css';
/**
* @typedef {Object} Props
* @property {boolean} [primary] Is this the principal call to action on the page?
* @property {string} [backgroundColor] What background color to use
* @property {'small' | 'medium' | 'large'} [size] How large should the button be?
* @property {string} label Button contents
* @property {() => void} [onClick] The onclick event handler
*/
/** @type {Props} */
const { primary = false, backgroundColor, size = 'medium', label, onClick } = $props();
</script>
<button
type="button"
class={['storybook-button', `storybook-button--${size}`].join(' ')}
class:storybook-button--primary={primary}
class:storybook-button--secondary={!primary}
style:background-color={backgroundColor}
onclick={onClick}
>
{label}
</button>