auto generated UI docs

Summary:
Using `react-docgen` to automatically generate docs for our UI components.
React-docgen parses the files in `components/ui` and using comments and flowtypes to generate structured information about the UI components.

For higher-order-components `react-docgen` is not able to get the information. As we are using HOC often as part of emotion's styled-components, I added a custom parser for HOCs. Using babel/parser I am parsing the components and using their doc-comments to generate the structured description.

Then, the description generated by react-docgen and my custom parser is used to generate markdown which is added to the `ui-components.md` file of our docs.

Plus: Added some styling around the documentation of props, mostly table styles.

Reviewed By: jknoxville

Differential Revision: D12896110

fbshipit-source-id: 1337c924c06e10a5d3aa752579428fd2cc7b4743
This commit is contained in:
Daniel Büchele
2018-11-05 03:10:27 -08:00
committed by Facebook Github Bot
parent ac6575850e
commit 640dee6645
5 changed files with 338 additions and 256 deletions

View File

@@ -252,6 +252,48 @@ pre code {
opacity: 0.8;
}
.mainContainer article table {
width: 100%;
border: 0;
}
.mainContainer article table td:nth-child(1){
width: 15%;
min-width: 140px;
}
.mainContainer article table td:nth-child(2){
width: 25%;
}
table tr {
border-bottom: 1px solid #e5e5e5;
}
table tr td {
vertical-align: top;
border: 0;
}
table tr th {
border: 0;
text-transform: none;
}
table tr th code, table tr td code {
background: none;
margin: 0;
color: inherit;
border: 0;
box-shadow: none;
}
table tr:nth-of-type(odd) {
background: none;
}
table tr:hover {
background: #f5f5f5;
}
footer .sitemap .nav-home,
footer .fbOpenSource {
opacity: 1;