UNPKG

generator-bingo-dig-h5

Version:

Bingo-dig-h5 generator by BINGO.DIG

56 lines (42 loc) 1.11 kB
var React = require('react'); var Classable = require('../mixins/classable'); var DialogWindow = require('./dialog-window'); var Dialog = React.createClass({ mixins: [Classable], propTypes: { title: React.PropTypes.node }, render: function() { var { className, ...other } = this.props; var classes = this.getClasses('dig-dialog'); var title; if (this.props.title) { // If the title is a string, wrap in an h3 tag. // If not, just use it as a node. title = Object.prototype.toString.call(this.props.title) === '[object String]' ? <h3 className="dig-dialog-title">{this.props.title}</h3> : this.props.title; } return ( <DialogWindow {...other} ref="dialogWindow" className={classes}> {title} <div ref="dialogContent" className="dig-dialog-content"> {this.props.children} </div> </DialogWindow> ); }, dismiss: function() { this.refs.dialogWindow.dismiss(); }, show: function() { this.refs.dialogWindow.show(); } }); module.exports = Dialog;