UNPKG

1.66 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 Media from './Media';
8import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
9var propTypes = {
10 /**
11 * Align the media to the top, middle, or bottom of the media object.
12 */
13 align: PropTypes.oneOf(['top', 'middle', 'bottom'])
14};
15
16var MediaLeft =
17/*#__PURE__*/
18function (_React$Component) {
19 _inheritsLoose(MediaLeft, _React$Component);
20
21 function MediaLeft() {
22 return _React$Component.apply(this, arguments) || this;
23 }
24
25 var _proto = MediaLeft.prototype;
26
27 _proto.render = function render() {
28 var _this$props = this.props,
29 align = _this$props.align,
30 className = _this$props.className,
31 props = _objectWithoutPropertiesLoose(_this$props, ["align", "className"]);
32
33 var _splitBsProps = splitBsProps(props),
34 bsProps = _splitBsProps[0],
35 elementProps = _splitBsProps[1];
36
37 var classes = getClassSet(bsProps);
38
39 if (align) {
40 // The class is e.g. `media-top`, not `media-left-top`.
41 classes[prefix(Media.defaultProps, align)] = true;
42 }
43
44 return React.createElement("div", _extends({}, elementProps, {
45 className: classNames(className, classes)
46 }));
47 };
48
49 return MediaLeft;
50}(React.Component);
51
52MediaLeft.propTypes = propTypes;
53export default bsClass('media-left', MediaLeft);
\No newline at end of file