twostoryrobot / storybook-addon-docgen Goto Github PK
View Code? Open in Web Editor NEWGenerates documentation using react-docgen
License: MIT License
Generates documentation using react-docgen
License: MIT License
Similarly to #9, Array PropTypes are not displayed correctly.
react-docgen
provides the parse docgen onto the Component at Component.__docgenInfo
. This object is being passed to the storybook docs panel. Currently it just converts the object to a string and displays that.
What we want is for it to be nicely formatted with descriptions and a prop types table. See this repo for inspiration. The linked package is MIT
so you could start by just pulling put the DocPanel
and see how it looks.
storybook-addon-docgen/src/register.js
Lines 38 to 43 in a0eb72c
Currently if a PropTypes
function is used it displays it like this:
If PropTypes
functions like PropTypes.arrayOf()
or PropTypes.shape()
are used, it should add a column (in the example below I named it shape names
but it could be anything) and break the supplied object down to it's sub elements.
For example, the following:
cars: PropTypes.shape({
id: PropTypes.string,
isEmpty: PropTypes.bool,
timeInYard: PropTypes.number
})
should produce:
name | SHAPE NAMES | type | required | default | description |
---|---|---|---|---|---|
cars | shape | yes | list of cars in the CarGrouping | ||
id | string | ||||
isEmpty | bool | ||||
timeInYard | number | ||||
children | node | null |
However, there is the chance that this could become fairly deeply nested, so some thought should be put into how we might handle that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.