0.0.9 • Published 1 year ago

@krofdrakula/prop-docs-storybook v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

This package is part of the @krofdrakula/prop-docs-* ecosystem. Please visit the monorepository for a complete guide:

https://github.com/krofdrakula/prop-docs

Storybook

yarn add @krofdrakula/prop-docs-storybook

When provided with an extracted Type this package will enable you to create an ArgTypes description for a specific component.

For example, extracting a Preact component requires parsing the components using @krofdrakula/prop-docs-preact and then using convertType to return the correct description:

import { Project } from "ts-morph";
import { getPropsType } from "@krofdrakula/prop-docs-preact";
import { extractCSF, convertType } from "@krofdrakula/prop-docs-storybook";

const project = new Project();
// this project assumes that `components.tsx` exists as in the Preact example
const { Profile } = extractCSF(project, "components.tsx", getPropsType);
const profileArgTypes = convertType(Profile);
//    ^? {
//         name: {
//           type: { name: "string", required: true },
//           description: "Person's name"
//         },
//         image: {
//           type: { name: "string", required: true },
//           description: "Person's image URL"
//         }
//       }
0.0.3

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago