Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte: Use JSDocs in JS CLI templates and put manual enum arg type back as it is not inferred #20042

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
const meta: Meta<Button> = {
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