@krofdrakula/prop-docs-storybook
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

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"
//         }
//       }

Package Sidebar

Install

npm i @krofdrakula/prop-docs-storybook

Weekly Downloads

0

Version

0.0.9

License

MIT

Unpacked Size

46.4 kB

Total Files

11

Last publish

Collaborators

  • krofdrakula