@talend/react-bootstrap
Version:
Bootstrap 3 components built with React
69 lines (67 loc) • 2.19 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _SafeAnchor = _interopRequireDefault(require("./SafeAnchor"));
var _bootstrapUtils = require("./utils/bootstrapUtils");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/* eslint-disable jsx-a11y/alt-text */
const propTypes = {
/**
* src property that is passed down to the image inside this component
*/
src: _propTypes.default.string,
/**
* alt property that is passed down to the image inside this component
*/
alt: _propTypes.default.string,
/**
* href property that is passed down to the image inside this component
*/
href: _propTypes.default.string,
/**
* onError callback that is passed down to the image inside this component
*/
onError: _propTypes.default.func,
/**
* onLoad callback that is passed down to the image inside this component
*/
onLoad: _propTypes.default.func
};
class Thumbnail extends _react.default.Component {
render() {
const {
src,
alt,
onError,
onLoad,
className,
children,
...props
} = this.props;
const [bsProps, elementProps] = (0, _bootstrapUtils.splitBsProps)(props);
const Component = elementProps.href ? _SafeAnchor.default : 'div';
const classes = (0, _bootstrapUtils.getClassSet)(bsProps);
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
...elementProps,
className: (0, _classnames.default)(className, classes),
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
src,
alt,
onError,
onLoad
}), children && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
className: "caption",
children: children
})]
});
}
}
Thumbnail.propTypes = propTypes;
var _default = exports.default = (0, _bootstrapUtils.bsClass)('thumbnail', Thumbnail);
//# sourceMappingURL=Thumbnail.js.map