Skip to content

Commit

Permalink
Svelte: Use JSDocs and put manual enum arg type back as it is not inf…
Browse files Browse the repository at this point in the history
…erred
  • Loading branch information
kasperpeulen committed Dec 1, 2022
1 parent b8ff859 commit 3d3265e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions code/renderers/svelte/template/cli/js/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export default {
tags: ['docsPage'],
argTypes: {
backgroundColor: { control: 'color' },
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
};

Expand Down
8 changes: 5 additions & 3 deletions code/renderers/svelte/template/cli/js/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
export let primary = false;
/**
* What background color to use
* @type {string} What background color to use
*/
export let backgroundColor = undefined;
/**
* How large should the button be?
* @type {'small' | 'medium' | 'large'} How large should the button be?
*/
export let size = 'medium';
/**
* Button contents
* @type {string} Button contents
*/
export let label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ import type { Meta, StoryObj } from '@storybook/svelte';

import Button from './Button.svelte';

// More on how to set up stories at: https://storybook.js.org/docs/svelte/writing-stories/introduction#default-export
const meta: Meta<Button> = {
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
const meta = {
title: 'Example/Button',
component: Button,
tags: ['docsPage'],
argTypes: {
backgroundColor: { control: 'color' },
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
};

Expand Down
4 changes: 4 additions & 0 deletions code/renderers/svelte/template/cli/ts/Button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const meta = {
tags: ['docsPage'],
argTypes: {
backgroundColor: { control: 'color' },
size: {
control: { type: 'select' },
options: ['small', 'medium', 'large'],
},
},
} satisfies Meta<Button>;

Expand Down

0 comments on commit 3d3265e

Please sign in to comment.