wix-style-react
Version:
35 lines (31 loc) • 1.38 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { st, classes } from './Illustration.st.css';
import { dataHooks } from '../../constants';
import { useBaseModalLayoutContext } from '../../BaseModalLayoutContext';
export var Illustration = function Illustration(_ref) {
var dataHook = _ref.dataHook,
className = _ref.className,
children = _ref.children;
var _useBaseModalLayoutCo = useBaseModalLayoutContext(),
illustrationClassName = _useBaseModalLayoutCo.illustrationClassName,
_useBaseModalLayoutCo2 = _useBaseModalLayoutCo.illustration,
illustration = _useBaseModalLayoutCo2 === void 0 ? children : _useBaseModalLayoutCo2;
return illustration && /*#__PURE__*/React.createElement("div", {
"data-hook": dataHook,
className: st(classes.root, illustrationClassName, className)
}, typeof illustration === 'string' ? /*#__PURE__*/React.createElement("img", {
className: classes.image,
src: illustration,
"data-hook": dataHooks.illustrationSrc
}) : illustration) || null;
};
Illustration.propTypes = {
/** additional css classes */
className: PropTypes.string,
/** data hook for testing */
dataHook: PropTypes.string,
/** The illustration src or the illustration node itself */
illustration: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
};
Illustration.defaultProps = {};