1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 | import classNames from 'classnames';
|
7 | import React from 'react';
|
8 | import PropTypes from 'prop-types';
|
9 | import elementType from 'prop-types-extra/lib/elementType';
|
10 |
|
11 | import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
|
12 | import capitalize from './utils/capitalize';
|
13 | import { DEVICE_SIZES } from './utils/StyleConfig';
|
14 |
|
15 | var propTypes = {
|
16 | componentClass: elementType,
|
17 |
|
18 | |
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | visibleXsBlock: PropTypes.bool,
|
26 | |
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | visibleSmBlock: PropTypes.bool,
|
34 | |
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 | visibleMdBlock: PropTypes.bool,
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | visibleLgBlock: PropTypes.bool
|
50 | };
|
51 |
|
52 | var defaultProps = {
|
53 | componentClass: 'div'
|
54 | };
|
55 |
|
56 | var Clearfix = function (_React$Component) {
|
57 | _inherits(Clearfix, _React$Component);
|
58 |
|
59 | function Clearfix() {
|
60 | _classCallCheck(this, Clearfix);
|
61 |
|
62 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
63 | }
|
64 |
|
65 | Clearfix.prototype.render = function render() {
|
66 | var _props = this.props,
|
67 | Component = _props.componentClass,
|
68 | className = _props.className,
|
69 | props = _objectWithoutProperties(_props, ['componentClass', 'className']);
|
70 |
|
71 | var _splitBsProps = splitBsProps(props),
|
72 | bsProps = _splitBsProps[0],
|
73 | elementProps = _splitBsProps[1];
|
74 |
|
75 | var classes = getClassSet(bsProps);
|
76 |
|
77 | DEVICE_SIZES.forEach(function (size) {
|
78 | var propName = 'visible' + capitalize(size) + 'Block';
|
79 | if (elementProps[propName]) {
|
80 | classes['visible-' + size + '-block'] = true;
|
81 | }
|
82 |
|
83 | delete elementProps[propName];
|
84 | });
|
85 |
|
86 | return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) }));
|
87 | };
|
88 |
|
89 | return Clearfix;
|
90 | }(React.Component);
|
91 |
|
92 | Clearfix.propTypes = propTypes;
|
93 | Clearfix.defaultProps = defaultProps;
|
94 |
|
95 | export default bsClass('clearfix', Clearfix); |
\ | No newline at end of file |