storybook/docs/snippets/react/my-component-with-env-variables.ts.mdx
2021-11-06 03:20:29 +00:00

25 lines
648 B
Plaintext

```ts
// MyComponent.stories.ts| tsx
import React from 'react';
import { Story, Meta } from '@storybook/react/types-6-0';
import { MyComponent, MyComponentProps } 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 Meta;
const Template: Story<MyComponentProps> = (args) => <MyComponent {...args} />;
export const ExampleStory = Template.bind({});
ExampleStory.args = {
propertyA: process.env.STORYBOOK_DATA_KEY,
};
```