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 Media from './Media';
|
12 | import { bsClass, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils';
|
13 |
|
14 | var propTypes = {
|
15 | |
16 |
|
17 |
|
18 | align: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
19 |
|
20 | componentClass: elementType
|
21 | };
|
22 |
|
23 | var defaultProps = {
|
24 | componentClass: 'div'
|
25 | };
|
26 |
|
27 | var MediaBody = function (_React$Component) {
|
28 | _inherits(MediaBody, _React$Component);
|
29 |
|
30 | function MediaBody() {
|
31 | _classCallCheck(this, MediaBody);
|
32 |
|
33 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
34 | }
|
35 |
|
36 | MediaBody.prototype.render = function render() {
|
37 | var _props = this.props,
|
38 | Component = _props.componentClass,
|
39 | align = _props.align,
|
40 | className = _props.className,
|
41 | props = _objectWithoutProperties(_props, ['componentClass', 'align', 'className']);
|
42 |
|
43 | var _splitBsProps = splitBsProps(props),
|
44 | bsProps = _splitBsProps[0],
|
45 | elementProps = _splitBsProps[1];
|
46 |
|
47 | var classes = getClassSet(bsProps);
|
48 |
|
49 | if (align) {
|
50 |
|
51 | classes[prefix(Media.defaultProps, align)] = true;
|
52 | }
|
53 |
|
54 | return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) }));
|
55 | };
|
56 |
|
57 | return MediaBody;
|
58 | }(React.Component);
|
59 |
|
60 | MediaBody.propTypes = propTypes;
|
61 | MediaBody.defaultProps = defaultProps;
|
62 |
|
63 | export default bsClass('media-body', MediaBody); |
\ | No newline at end of file |