A npx-utility for creating a storybook-story for your existing react-component.
$ npx https://gist.github.com/PutziSan/7621bb69364fcf95409264261b77887c src/MyComponent.tsx
npx: installed 1 in 6.294s
write new story into src/MyComponent.stories.tsx
This will create the file src/MyComponent.stories.tsx
:
// src/MyComponent.stories.tsx
import { storiesOf } from "@storybook/react";
import { MyComponent } from "./MyComponent";
storiesOf("MyComponent", module)
.add("default", () => {
return <MyComponent />;
});
This assumes, your react-component looks like this:
// src/MyComponent.tsx
import * as React from "react";
export function MyComponent() {
return <div>My Component</div>;
}