/** * @providesModule AutodocsLayout * @jsx React.DOM */ var DocsSidebar = require('DocsSidebar'); var Header = require('Header'); var Marked = require('Marked'); var React = require('React'); var Site = require('Site'); var slugify = require('slugify'); var Autodocs = React.createClass({ renderType: function(type) { if (type.name === 'enum') { return 'enum(' + type.value.map((v => v.value)).join(', ') + ')'; } if (type.name === 'shape') { return '{' + Object.keys(type.value).map((key => key + ': ' + this.renderType(type.value[key]))).join(', ') + '}'; } if (type.name === 'arrayOf') { return '[' + this.renderType(type.value) + ']'; } if (type.name === 'instanceOf') { return type.value; } if (type.name === 'custom') { return type.raw; } return type.name; }, renderProp: function(name, prop) { return (
{name} {' '} {prop.type && {this.renderType(prop.type)} }
{prop.description && {prop.description}}
); }, renderCompose: function(name) { return (
{name} props...
); }, renderProps: function(props, composes) { return (
{(composes || []).map((name) => this.renderCompose(name) )} {Object.keys(props).sort().map((name) => this.renderProp(name, props[name]) )}
); }, render: function() { var metadata = this.props.metadata; var content = JSON.parse(this.props.children); return (

{metadata.title}

{content.description} {this.renderProps(content.props, content.composes)} {content.fullDescription}
{metadata.previous && ← Prev} {metadata.next && Next →}
); } }); module.exports = Autodocs;