import _extends from "@babel/runtime/helpers/extends";
// Copyright 1999-2020. Plesk International GmbH. All rights reserved.
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';

/**
 * Figure component.
 * @since 0.0.42
 */
const Figure = ({
  baseClassName,
  className,
  href,
  caption,
  children,
  ...props
}) => /*#__PURE__*/React.createElement("figure", _extends({
  className: classNames(baseClassName, className)
}, props), children, href && /*#__PURE__*/React.createElement("a", {
  href: href,
  className: classNames("".concat(baseClassName, "__overlay"), "".concat(baseClassName, "__overlay--cover"), "".concat(baseClassName, "__action"))
}), caption && /*#__PURE__*/React.createElement("figcaption", {
  className: classNames("".concat(baseClassName, "__overlay"), "".concat(baseClassName, "__overlay--bottom"))
}, caption));

Figure.propTypes = {
  /**
   * @since 0.0.47
   */
  href: PropTypes.string,

  /**
   * @since 0.0.47
   */
  caption: PropTypes.any,

  /**
   * Content of the figure
   * @since 0.0.42
   */
  children: PropTypes.node,

  /**
   * @ignore
   */
  className: PropTypes.string,

  /**
   * @ignore
   */
  baseClassName: PropTypes.string
};
Figure.defaultProps = {
  href: null,
  caption: null,
  children: null,
  className: null,
  baseClassName: "".concat(CLS_PREFIX, "figure")
};
export default Figure;