1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-12 13:00:04 +02:00
copilot/ui/docs/containers/item/index.js
Sérgio Ramos f1917acae1 no in embeds
2016-10-26 17:33:40 +01:00

34 lines
651 B
JavaScript

const get = require('lodash.get');
const InnerHTML = require('dangerously-set-inner-html');
const React = require('react');
const titleCase = require('title-case');
const Docs = require('../../../src/docs');
const Item = ({
params
}) => {
const path = (params.parent !== 'undefined')
? `${titleCase(params.parent)}.${titleCase(params.name)}`
: `${titleCase(params.name)}`;
const body = get(Docs, path);
const item = body ? (
<InnerHTML html={body} />
) : (
<h1>{path} Not Found</h1>
);
return (
<div>
{item}
</div>
);
};
Item.propTypes = {
params: React.PropTypes.object
};
module.exports = Item;