const React = require('react');
const ImmutablePropTypes = require('react-immutable-proptypes');
const NODES = {
// Blocks
heading_one: props =>
{props.children}
,
heading_two: props => {props.children}
,
heading_three: props => {props.children}
,
heading_four: props => {props.children}
,
heading_five: props => {props.children}
,
heading_six: props => {props.children}
,
paragraph: props => {props.children}
};
const MARKS = {
BOLD: props => {props.children},
ITALIC: props => {props.children},
STRIKETHROUGH: props => {props.children},
CODE: props => {props.children}
};
/**
* Render a text node.
* @type {ReactClass}
*/
const Text = React.createClass({
propTypes: {
node: React.PropTypes.object.isRequired
},
render() {
const { node } = this.props;
const ranges = node.get('ranges');
return (
);
}
});
/**
* Inner content of a page.
* @type {ReactClass}
*/
const Node = React.createClass({
propTypes: {
node: React.PropTypes.object.isRequired
},
render() {
const { node } = this.props;
const children = node
.get('children')
.map((child) => {
if (child.kind == 'text') {
return ;
} else {
return ;
}
})
.toArray();
return React.createElement(
NODES[node.type],
{
node
},
children
);
}
});
/**
* Inner content of a page.
* @type {ReactClass}
*/
const PageContent = React.createClass({
propTypes: {
document: React.PropTypes.object.isRequired
},
render() {
const { document } = this.props;
return (
);
}
});
module.exports = PageContent;