GoScrobble/web/node_modules/reactstrap/lib/Media.js

84 lines
2.5 KiB
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _utils = require("./utils");
var propTypes = {
body: _propTypes.default.bool,
bottom: _propTypes.default.bool,
children: _propTypes.default.node,
className: _propTypes.default.string,
cssModule: _propTypes.default.object,
heading: _propTypes.default.bool,
left: _propTypes.default.bool,
list: _propTypes.default.bool,
middle: _propTypes.default.bool,
object: _propTypes.default.bool,
right: _propTypes.default.bool,
tag: _utils.tagPropType,
top: _propTypes.default.bool
};
var Media = function Media(props) {
var body = props.body,
bottom = props.bottom,
className = props.className,
cssModule = props.cssModule,
heading = props.heading,
left = props.left,
list = props.list,
middle = props.middle,
object = props.object,
right = props.right,
tag = props.tag,
top = props.top,
attributes = (0, _objectWithoutPropertiesLoose2.default)(props, ["body", "bottom", "className", "cssModule", "heading", "left", "list", "middle", "object", "right", "tag", "top"]);
var defaultTag;
if (heading) {
defaultTag = 'h4';
} else if (attributes.href) {
defaultTag = 'a';
} else if (attributes.src || object) {
defaultTag = 'img';
} else if (list) {
defaultTag = 'ul';
} else {
defaultTag = 'div';
}
var Tag = tag || defaultTag;
var classes = (0, _utils.mapToCssModules)((0, _classnames.default)(className, {
'media-body': body,
'media-heading': heading,
'media-left': left,
'media-right': right,
'media-top': top,
'media-bottom': bottom,
'media-middle': middle,
'media-object': object,
'media-list': list,
media: !body && !heading && !left && !right && !top && !bottom && !middle && !object && !list
}), cssModule);
return /*#__PURE__*/_react.default.createElement(Tag, (0, _extends2.default)({}, attributes, {
className: classes
}));
};
Media.propTypes = propTypes;
var _default = Media;
exports.default = _default;