modo-mobile
Version:
A mobile UI toolkit, based on React
78 lines (67 loc) • 2.53 kB
JavaScript
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import * as React from 'react';
var TitleBar = function (_React$Component) {
_inherits(TitleBar, _React$Component);
function TitleBar() {
_classCallCheck(this, TitleBar);
var _this = _possibleConstructorReturn(this, (TitleBar.__proto__ || Object.getPrototypeOf(TitleBar)).apply(this, arguments));
_this.handleCancel = function () {
var onCancel = _this.props.onCancel;
if (onCancel) {
onCancel();
}
};
_this.handleConfirm = function () {
var onConfirm = _this.props.onConfirm;
if (onConfirm) onConfirm();
};
return _this;
}
_createClass(TitleBar, [{
key: 'render',
value: function render() {
var _props = this.props,
prefixCls = _props.prefixCls,
title = _props.title,
describe = _props.describe,
okText = _props.okText,
cancelText = _props.cancelText;
return React.createElement(
'div',
{ className: prefixCls + '-title-bar' },
React.createElement(
'div',
{ className: prefixCls + '-title-bar-left', onClick: this.handleCancel },
cancelText
),
React.createElement(
'div',
{ className: prefixCls + '-title-bar-center' },
React.createElement(
'div',
{ className: prefixCls + '-title-bar-title' },
title
),
React.createElement(
'div',
{ className: prefixCls + '-title-bar-describe' },
describe
)
),
React.createElement(
'div',
{ className: prefixCls + '-title-bar-right', onClick: this.handleConfirm },
okText
)
);
}
}]);
return TitleBar;
}(React.Component);
export default TitleBar;
TitleBar.defaultProps = {
prefixCls: 'm-popup'
};