1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
|
4 | import classNames from 'classnames';
|
5 | import React from 'react';
|
6 | import { createBootstrapComponent } from './ThemeProvider';
|
7 | var defaultProps = {
|
8 | aspectRatio: '1by1'
|
9 | };
|
10 |
|
11 | var ResponsiveEmbed =
|
12 |
|
13 | function (_React$Component) {
|
14 | _inheritsLoose(ResponsiveEmbed, _React$Component);
|
15 |
|
16 | function ResponsiveEmbed() {
|
17 | return _React$Component.apply(this, arguments) || this;
|
18 | }
|
19 |
|
20 | var _proto = ResponsiveEmbed.prototype;
|
21 |
|
22 | _proto.render = function render() {
|
23 | var _this$props = this.props,
|
24 | bsPrefix = _this$props.bsPrefix,
|
25 | className = _this$props.className,
|
26 | children = _this$props.children,
|
27 | aspectRatio = _this$props.aspectRatio,
|
28 | props = _objectWithoutPropertiesLoose(_this$props, ["bsPrefix", "className", "children", "aspectRatio"]);
|
29 |
|
30 | var child = React.Children.only(children);
|
31 | return React.createElement("div", _extends({}, props, {
|
32 | className: classNames(bsPrefix, className, aspectRatio && bsPrefix + "-" + aspectRatio)
|
33 | }), React.cloneElement(child, {
|
34 | className: classNames(child.props.className, bsPrefix + "-item")
|
35 | }));
|
36 | };
|
37 |
|
38 | return ResponsiveEmbed;
|
39 | }(React.Component);
|
40 |
|
41 | ResponsiveEmbed.defaultProps = defaultProps;
|
42 | export default createBootstrapComponent(ResponsiveEmbed, 'embed-responsive'); |
\ | No newline at end of file |