You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
10 years ago
|
"use strict";
|
||
|
|
||
|
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
|
||
|
|
||
|
var React = _interopRequire(require("react"));
|
||
|
|
||
|
var constants = _interopRequire(require("./constants"));
|
||
|
|
||
|
var BootstrapMixin = {
|
||
|
propTypes: {
|
||
|
bsClass: React.PropTypes.oneOf(Object.keys(constants.CLASSES)),
|
||
|
bsStyle: React.PropTypes.oneOf(Object.keys(constants.STYLES)),
|
||
|
bsSize: React.PropTypes.oneOf(Object.keys(constants.SIZES))
|
||
|
},
|
||
|
|
||
|
getBsClassSet: function getBsClassSet() {
|
||
|
var classes = {};
|
||
|
|
||
|
var bsClass = this.props.bsClass && constants.CLASSES[this.props.bsClass];
|
||
|
if (bsClass) {
|
||
|
classes[bsClass] = true;
|
||
|
|
||
|
var prefix = bsClass + "-";
|
||
|
|
||
|
var bsSize = this.props.bsSize && constants.SIZES[this.props.bsSize];
|
||
|
if (bsSize) {
|
||
|
classes[prefix + bsSize] = true;
|
||
|
}
|
||
|
|
||
|
var bsStyle = this.props.bsStyle && constants.STYLES[this.props.bsStyle];
|
||
|
if (this.props.bsStyle) {
|
||
|
classes[prefix + bsStyle] = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return classes;
|
||
|
},
|
||
|
|
||
|
prefixClass: function prefixClass(subClass) {
|
||
|
return constants.CLASSES[this.props.bsClass] + "-" + subClass;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports = BootstrapMixin;
|