1 | import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
4 |
|
5 |
|
6 | import classNames from 'classnames';
|
7 | import React from 'react';
|
8 | import PropTypes from 'prop-types';
|
9 | import SafeAnchor from './SafeAnchor';
|
10 | import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
|
11 | var propTypes = {
|
12 | |
13 |
|
14 |
|
15 | src: PropTypes.string,
|
16 |
|
17 | |
18 |
|
19 |
|
20 | alt: PropTypes.string,
|
21 |
|
22 | |
23 |
|
24 |
|
25 | href: PropTypes.string,
|
26 |
|
27 | |
28 |
|
29 |
|
30 | onError: PropTypes.func,
|
31 |
|
32 | |
33 |
|
34 |
|
35 | onLoad: PropTypes.func
|
36 | };
|
37 |
|
38 | var Thumbnail =
|
39 |
|
40 | function (_React$Component) {
|
41 | _inheritsLoose(Thumbnail, _React$Component);
|
42 |
|
43 | function Thumbnail() {
|
44 | return _React$Component.apply(this, arguments) || this;
|
45 | }
|
46 |
|
47 | var _proto = Thumbnail.prototype;
|
48 |
|
49 | _proto.render = function render() {
|
50 | var _this$props = this.props,
|
51 | src = _this$props.src,
|
52 | alt = _this$props.alt,
|
53 | onError = _this$props.onError,
|
54 | onLoad = _this$props.onLoad,
|
55 | className = _this$props.className,
|
56 | children = _this$props.children,
|
57 | props = _objectWithoutPropertiesLoose(_this$props, ["src", "alt", "onError", "onLoad", "className", "children"]);
|
58 |
|
59 | var _splitBsProps = splitBsProps(props),
|
60 | bsProps = _splitBsProps[0],
|
61 | elementProps = _splitBsProps[1];
|
62 |
|
63 | var Component = elementProps.href ? SafeAnchor : 'div';
|
64 | var classes = getClassSet(bsProps);
|
65 | return React.createElement(Component, _extends({}, elementProps, {
|
66 | className: classNames(className, classes)
|
67 | }), React.createElement("img", {
|
68 | src: src,
|
69 | alt: alt,
|
70 | onError: onError,
|
71 | onLoad: onLoad
|
72 | }), children && React.createElement("div", {
|
73 | className: "caption"
|
74 | }, children));
|
75 | };
|
76 |
|
77 | return Thumbnail;
|
78 | }(React.Component);
|
79 |
|
80 | Thumbnail.propTypes = propTypes;
|
81 | export default bsClass('thumbnail', Thumbnail); |
\ | No newline at end of file |