Use docs/ComponentName.md at the end of the component docs

This commit is contained in:
Christopher Chedeau 2015-03-04 21:03:24 -08:00
parent d935f4554b
commit b9ab607197
3 changed files with 17 additions and 6 deletions

View File

@ -1085,7 +1085,9 @@ marked.parse = marked;
var Marked = React.createClass({
render: function() {
return React.DOM.div(null, marked(this.props.children, this.props));
return this.props.children ?
React.DOM.div(null, marked(this.props.children, this.props)) :
null;
}
});

View File

@ -17,8 +17,9 @@ var Autodocs = React.createClass({
<Header level={4} className="propTitle" toSlug={name}>
{name}
{' '}
<span className="propType">{prop.type.name}</span></Header>
<Marked>{prop.description}</Marked>
{prop.type && <span className="propType">{prop.type.name}</span>}
</Header>
{prop.description && <Marked>{prop.description}</Marked>}
</div>
);
},
@ -43,6 +44,9 @@ var Autodocs = React.createClass({
{content.description}
</Marked>
{this.renderProps(content.props)}
<Marked>
{content.fullDescription}
</Marked>
<div className="docs-prevnext">
{metadata.previous && <a className="docs-prev" href={metadata.previous + '.html#content'}>&larr; Prev</a>}
{metadata.next && <a className="docs-next" href={metadata.next + '.html#content'}>Next &rarr;</a>}

View File

@ -19,9 +19,13 @@ function docsToMarkdown(filepath, i) {
docs.resolver.findAllReactCreateClassCalls(node, recast)[0];
}
);
var componentName = getNameFromPath(filepath);
var docFilePath = '../docs/' + componentName + '.md';
if (fs.existsSync(docFilePath)) {
json.fullDescription = fs.readFileSync(docFilePath).toString();
}
var res = [
'---',
'id: ' + slugify(componentName),
@ -37,15 +41,16 @@ function docsToMarkdown(filepath, i) {
}
var components = [
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
'../Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js',
'../Libraries/Text/ExpandingText.js',
'../Libraries/Image/Image.ios.js',
'../Libraries/Components/ListView/ListView.js',
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
'../Libraries/Components/ScrollView/ScrollView.ios.js',
'../Libraries/Text/Text.js',
'../Libraries/Image/Image.ios.js',
'../Libraries/Components/TextInput/TextInput.ios.js',
'../Libraries/Components/Touchable/TouchableHighlight.js',
'../Libraries/Components/Touchable/TouchableOpacity.js',
'../Libraries/Components/Touchable/TouchableWithoutFeedback.js',
'../Libraries/Components/View/View.js',
];