import React from 'react'; import remark from 'remark'; import remarkHTML from 'remark-html'; import remarkHighlight from 'remark-highlight.js'; import Waypoint from 'react-waypoint'; import PureRenderMixin from 'react-pure-render/mixin'; function renderHighlighted(nodes) { return { __html: remark() .use(remarkHTML) .stringify(remark().use(remarkHighlight).run({ type: 'root', children: nodes })) .replace( /"{timestamp}"<\/span>/g, `"{timestamp}"`) }; } var Section = React.createClass({ mixins: [PureRenderMixin], propTypes: { chunk: React.PropTypes.object.isRequired, onSpy: React.PropTypes.func.isRequired }, waypointEnterFromAbove(e, direction) { if (direction === 'above') { this.props.onSpy(this.props.chunk.title); } }, waypointEnterFromBelow(e, direction) { if (direction === 'below') { this.props.onSpy(this.props.chunk.title); } }, render() { let { chunk } = this.props; let { left, right, preview } = chunk; return (
{(right.length > 0) &&
}
); } }); module.exports = Section;