mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 07:21:16 +08:00
25 lines
674 B
Plaintext
25 lines
674 B
Plaintext
```ts
|
|
// MyComponent.stories.ts| tsx
|
|
|
|
import React from 'react';
|
|
|
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
|
|
import { MyComponent } from './MyComponent';
|
|
|
|
export default {
|
|
/* 👇 The title prop is optional.
|
|
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
|
|
* to learn how to generate automatic titles
|
|
*/
|
|
title: 'MyComponent',
|
|
component: MyComponent,
|
|
} as ComponentMeta<typeof MyComponent>;
|
|
|
|
const Template: ComponentStory<typeof MyComponent> = (args) => <MyComponent {...args} />;
|
|
|
|
export const ExampleStory = Template.bind({});
|
|
ExampleStory.args = {
|
|
propertyA: process.env.STORYBOOK_DATA_KEY,
|
|
};
|
|
``` |