UNPKG

react-zeanium-ui-ui

Version:

Zeanium UI Framework for React.js

56 lines (50 loc) 1.26 kB
var React = require('react'); module.exports = React.createClass({ displayName:'Dialog', getDefaultProps: function (){ return { className: 'c-default' } }, getInitialState: function(){ return { } }, componentDidMount: function(){ }, __onClose: function (){ this.props.onClose && this.props.onClose(); }, __renderHead: function (_hStyle){ if(!!this.props.icon||!!this.props.title){ return <div className="rt-dialog-head" style={_hStyle} > { this.props.icon && <span className={"icon fa " + this.props.icon}></span> } { this.props.title && <span className="title">{this.props.title}</span> } </div>; } }, render:function(){ var _props = this.props, _hStyle = _props.hStyle||{}, _fStyle = _props.fStyle||{}, _style = _props.style||{}; _hStyle.height = _props.hHeight; _fStyle.height = _props.fHeight; _style.zIndex = _props.zIndex; return ( <div className={"rt-dialog " + _props.className} style={_style}> { this.props.enableClose && <i onClick={this.__onClose} className="close fa fa-close"></i> } {this.__renderHead(_hStyle)} <div className="rt-dialog-body" style={_props.bStyle}> {_props.content||_props.children} </div> </div> ); } });