Add TransformPropTypes to docs

This commit is contained in:
Brent Vatne 2015-05-07 12:16:48 -07:00
parent 1c90a2dbcc
commit b8ca4e450b
2 changed files with 19 additions and 11 deletions

View File

@ -100,14 +100,18 @@ var ComponentDoc = React.createClass({
<div className="compactProps">
{(style.composes || []).map((name) => {
var link;
if (name !== 'LayoutPropTypes') {
name = name.replace('StylePropTypes', '');
link =
<a href={slugify(name) + '.html#style'}>{name}#style...</a>;
} else {
if (name === 'LayoutPropTypes') {
name = 'Flexbox';
link =
<a href={slugify(name) + '.html#proptypes'}>{name}...</a>;
} else if (name === 'TransformPropTypes') {
name = 'Transforms';
link =
<a href={slugify(name) + '.html#proptypes'}>{name}...</a>;
} else {
name = name.replace('StylePropTypes', '');
link =
<a href={slugify(name) + '.html#style'}>{name}#style...</a>;
}
return (
<div className="prop" key={name}>

View File

@ -19,9 +19,12 @@ function getNameFromPath(filepath) {
while (ext = path.extname(filepath)) {
filepath = path.basename(filepath, ext);
}
if (filepath === 'LayoutPropTypes') {
return 'Flexbox';
} else if (filepath == 'TabBarItemIOS') {
} else if (filepath === 'TransformPropTypes') {
return 'Transforms';
} else if (filepath === 'TabBarItemIOS') {
return 'TabBarIOS.Item';
}
return filepath;
@ -148,6 +151,7 @@ var apis = [
var styles = [
'../Libraries/StyleSheet/LayoutPropTypes.js',
'../Libraries/StyleSheet/TransformPropTypes.js',
'../Libraries/Components/View/ViewStylePropTypes.js',
'../Libraries/Text/TextStylePropTypes.js',
'../Libraries/Image/ImageStylePropTypes.js',
@ -159,10 +163,10 @@ var polyfills = [
var all = components
.concat(apis)
.concat(styles.slice(0, 1))
.concat(styles.slice(0, 2))
.concat(polyfills);
var styleDocs = styles.slice(1).reduce(function(docs, filepath) {
var styleDocs = styles.slice(2).reduce(function(docs, filepath) {
docs[path.basename(filepath).replace(path.extname(filepath), '')] =
docgen.parse(
fs.readFileSync(filepath),
@ -171,9 +175,9 @@ var styleDocs = styles.slice(1).reduce(function(docs, filepath) {
);
// Remove deprecated style props
if (docs['ViewStylePropTypes']) {
if (docs['TransformPropTypes']) {
['rotation', 'scaleX', 'scaleY', 'translateX', 'translateY'].forEach(function(key) {
delete docs['ViewStylePropTypes']['props'][key];
delete docs['TransformPropTypes']['props'][key];
});
}
@ -185,7 +189,7 @@ module.exports = function() {
return [].concat(
components.map(renderComponent),
apis.map(renderAPI('api')),
styles.slice(0, 1).map(renderStyle),
styles.slice(0, 2).map(renderStyle),
polyfills.map(renderAPI('Polyfill'))
);
};