UNPKG

react-lite-markdown

Version:
53 lines (45 loc) 1.13 kB
// Generated by CoffeeScript 1.10.0 (function() { var React, T, cx, div, markdown; cx = require('classnames'); React = require('react'); markdown = require('./util/markdown'); div = React.DOM.div; T = React.PropTypes; module.exports = React.createClass({ displayName: 'lite-markdown', propTypes: { name: T.string, value: T.string, className: T.string }, getDefaultProps: function() { return { name: '', value: '', className: 'markdown-body' }; }, getClassName: function() { var className, obj; return className = cx('lite-markdown', ( obj = {}, obj["is-" + this.props.name] = (this.props.name != null) && this.props.name.length, obj )); }, getMarkup: function() { return markdown.renderer.render(this.props.value); }, render: function() { return div({ className: this.getClassName() }, div({ className: this.props.className, dangerouslySetInnerHTML: { __html: this.getMarkup() } })); } }); }).call(this);