UNPKG

2.21 kBJavaScriptView Raw
1var _excluded = ["className", "cssModule", "fluid", "tag"];
2function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5import React from 'react';
6import PropTypes from 'prop-types';
7import classNames from 'classnames';
8import { mapToCssModules, tagPropType } from './utils';
9var propTypes = {
10 tag: tagPropType,
11 fluid: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
12 className: PropTypes.string,
13 cssModule: PropTypes.object
14};
15function Container(props) {
16 var className = props.className,
17 cssModule = props.cssModule,
18 fluid = props.fluid,
19 _props$tag = props.tag,
20 Tag = _props$tag === void 0 ? 'div' : _props$tag,
21 attributes = _objectWithoutProperties(props, _excluded);
22 var containerClass = 'container';
23 if (fluid === true) {
24 containerClass = 'container-fluid';
25 } else if (fluid) {
26 containerClass = "container-".concat(fluid);
27 }
28 var classes = mapToCssModules(classNames(className, containerClass), cssModule);
29 return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {
30 className: classes
31 }));
32}
33Container.propTypes = propTypes;
34export default Container;
\No newline at end of file