UNPKG

1.96 kBJavaScriptView Raw
1import _extends from 'babel-runtime/helpers/extends';
2import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
4import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
5import _inherits from 'babel-runtime/helpers/inherits';
6import classNames from 'classnames';
7import React from 'react';
8import elementType from 'prop-types-extra/lib/elementType';
9
10import MediaBody from './MediaBody';
11import MediaHeading from './MediaHeading';
12import MediaLeft from './MediaLeft';
13import MediaList from './MediaList';
14import MediaListItem from './MediaListItem';
15import MediaRight from './MediaRight';
16import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
17
18var propTypes = {
19 componentClass: elementType
20};
21
22var defaultProps = {
23 componentClass: 'div'
24};
25
26var Media = function (_React$Component) {
27 _inherits(Media, _React$Component);
28
29 function Media() {
30 _classCallCheck(this, Media);
31
32 return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
33 }
34
35 Media.prototype.render = function render() {
36 var _props = this.props,
37 Component = _props.componentClass,
38 className = _props.className,
39 props = _objectWithoutProperties(_props, ['componentClass', 'className']);
40
41 var _splitBsProps = splitBsProps(props),
42 bsProps = _splitBsProps[0],
43 elementProps = _splitBsProps[1];
44
45 var classes = getClassSet(bsProps);
46
47 return React.createElement(Component, _extends({}, elementProps, { className: classNames(className, classes) }));
48 };
49
50 return Media;
51}(React.Component);
52
53Media.propTypes = propTypes;
54Media.defaultProps = defaultProps;
55
56Media.Heading = MediaHeading;
57Media.Body = MediaBody;
58Media.Left = MediaLeft;
59Media.Right = MediaRight;
60Media.List = MediaList;
61Media.ListItem = MediaListItem;
62
63export default bsClass('media', Media);
\No newline at end of file