From 3d3265e195b64b805cffe8fdf2ecbb71d7cd2d85 Mon Sep 17 00:00:00 2001 From: Kasper Peulen Date: Thu, 1 Dec 2022 10:38:54 +0100 Subject: [PATCH 1/2] Svelte: Use JSDocs and put manual enum arg type back as it is not inferred --- code/renderers/svelte/template/cli/js/Button.stories.js | 4 ++++ code/renderers/svelte/template/cli/js/Button.svelte | 8 +++++--- .../svelte/template/cli/ts-legacy/Button.stories.ts | 9 +++++++-- code/renderers/svelte/template/cli/ts/Button.stories.ts | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/code/renderers/svelte/template/cli/js/Button.stories.js b/code/renderers/svelte/template/cli/js/Button.stories.js index 6377b5dda3dc..1cffc7520fde 100644 --- a/code/renderers/svelte/template/cli/js/Button.stories.js +++ b/code/renderers/svelte/template/cli/js/Button.stories.js @@ -7,6 +7,10 @@ export default { tags: ['docsPage'], argTypes: { backgroundColor: { control: 'color' }, + size: { + control: { type: 'select' }, + options: ['small', 'medium', 'large'], + }, }, }; diff --git a/code/renderers/svelte/template/cli/js/Button.svelte b/code/renderers/svelte/template/cli/js/Button.svelte index cdf77abadac7..a2a78d9d0d6f 100644 --- a/code/renderers/svelte/template/cli/js/Button.svelte +++ b/code/renderers/svelte/template/cli/js/Button.svelte @@ -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; diff --git a/code/renderers/svelte/template/cli/ts-legacy/Button.stories.ts b/code/renderers/svelte/template/cli/ts-legacy/Button.stories.ts index ed3ec8c50799..deac95fe469d 100644 --- a/code/renderers/svelte/template/cli/ts-legacy/Button.stories.ts +++ b/code/renderers/svelte/template/cli/ts-legacy/Button.stories.ts @@ -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