UNPKG

1.79 kBJavaScriptView Raw
1import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
3import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
4import classNames from 'classnames';
5import React from 'react';
6import PropTypes from 'prop-types';
7import elementType from 'prop-types-extra/lib/elementType';
8import { bsClass, prefix, splitBsProps } from './utils/bootstrapUtils';
9var propTypes = {
10 /**
11 * Turn any fixed-width grid layout into a full-width layout by this property.
12 *
13 * Adds `container-fluid` class.
14 */
15 fluid: PropTypes.bool,
16
17 /**
18 * You can use a custom element for this component
19 */
20 componentClass: elementType
21};
22var defaultProps = {
23 componentClass: 'div',
24 fluid: false
25};
26
27var Grid =
28/*#__PURE__*/
29function (_React$Component) {
30 _inheritsLoose(Grid, _React$Component);
31
32 function Grid() {
33 return _React$Component.apply(this, arguments) || this;
34 }
35
36 var _proto = Grid.prototype;
37
38 _proto.render = function render() {
39 var _this$props = this.props,
40 fluid = _this$props.fluid,
41 Component = _this$props.componentClass,
42 className = _this$props.className,
43 props = _objectWithoutPropertiesLoose(_this$props, ["fluid", "componentClass", "className"]);
44
45 var _splitBsProps = splitBsProps(props),
46 bsProps = _splitBsProps[0],
47 elementProps = _splitBsProps[1];
48
49 var classes = prefix(bsProps, fluid && 'fluid');
50 return React.createElement(Component, _extends({}, elementProps, {
51 className: classNames(className, classes)
52 }));
53 };
54
55 return Grid;
56}(React.Component);
57
58Grid.propTypes = propTypes;
59Grid.defaultProps = defaultProps;
60export default bsClass('container', Grid);
\No newline at end of file