Add your-component.ts snippet for html framework

This commit is contained in:
WIVSW 2022-01-23 00:18:43 +05:00
parent 841fe3753d
commit 9bd8804ffb
2 changed files with 24 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Pick a simple component from your project, like a Button, and write a `.stories.
'svelte/your-component.mdx.mdx',
'web-components/your-component.js.mdx',
'html/your-component.js.mdx',
'html/your-component.ts.mdx',
]}
/>

View File

@ -0,0 +1,23 @@
```ts
// YourComponent.stories.ts
import { Meta, StoryFn } from '@storybook/html';
import { createYourComponent } from './YourComponent';
//👇 This default export determines where your story goes in the story list
export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docsreact/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'YourComponent',
} as Meta;
//👇 We create a “template” of how args map to rendering
const Template: StoryFn = (args): HTMLElement => createYourComponent(args);
export const FirstStory = Template.bind({});
FirstStory.args = {
//👇 The args you need here will depend on your component
};
```