ost-ui
Version:
ost ui for react
111 lines (92 loc) • 2.87 kB
JavaScript
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import OstMask from '../OstMask';
var Basic = function (_Component) {
_inherits(Basic, _Component);
function Basic() {
_classCallCheck(this, Basic);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
Basic.prototype.componentDidMount = function componentDidMount() {
var _refs = this.refs,
priBtn = _refs.priBtn,
secBtn = _refs.secBtn;
if (priBtn && secBtn) {
var btnWidth = Math.max(priBtn.clientWidth, secBtn.clientWidth);
priBtn.style.width = secBtn.style.width = btnWidth + 'px';
}
};
Basic.prototype.render = function render() {
var _props = this.props,
text = _props.text,
button = _props.button,
show = _props.show;
return React.createElement(
OstMask,
{ show: show },
React.createElement(
'div',
{ className: 'ost-modal-basic' },
React.createElement(
'div',
{ className: 'ost-modal-basic-box' },
React.createElement(
'p',
{ className: 'ost-modal-basic-primary' },
text.primary || ''
),
React.createElement(
'p',
{ className: 'ost-modal-basic-secondary' },
text.secondary || ''
),
button && button[0] && React.createElement(
'div',
{ className: 'ost-modal-basic-priBtn' },
React.createElement(
'button',
{ ref: 'priBtn', onClick: button[0].onPress },
button[0].text
)
),
button && button[1] && React.createElement(
'div',
{ className: 'ost-modal-basic-secBtn' },
React.createElement(
'button',
{ ref: 'secBtn', onClick: button[1].onPress },
button[1].text
)
)
)
)
);
};
return Basic;
}(Component);
var OstModal = function (_Component2) {
_inherits(OstModal, _Component2);
function OstModal() {
_classCallCheck(this, OstModal);
return _possibleConstructorReturn(this, _Component2.apply(this, arguments));
}
OstModal.prototype.render = function render() {
var _props2 = this.props,
children = _props2.children,
style = _props2.style;
return React.createElement(
'div',
{ className: 'ost-card', style: style },
children
);
};
return OstModal;
}(Component);
OstModal.basic = Basic;
export default OstModal;
OstModal.propTypes = {
style: PropTypes.object
};