Skip to content

Commit

Permalink
Add TransformPropTypes to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Vatne committed May 7, 2015
1 parent 1c90a2d commit b8ca4e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
14 changes: 9 additions & 5 deletions website/layout/AutodocsLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
Expand Down
16 changes: 10 additions & 6 deletions website/server/extractDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand All @@ -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),
Expand All @@ -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];
});
}

Expand All @@ -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'))
);
};

0 comments on commit b8ca4e4

Please sign in to comment.