import _extends from "@babel/runtime/helpers/extends";
import * as React from 'react';
import { cnCreate, convert } from '@megafon/ui-helpers';
import { setRelAttribute } from "../../../helpers/setRelAttribute";
import "./DarkGradientCard.css";
var cn = cnCreate('mfui-9-dark-gradient-card');
var DarkGradientCard = function DarkGradientCard(_ref) {
  var imageSrc = _ref.imageSrc,
    title = _ref.title,
    subtitle = _ref.subtitle,
    moreIcon = _ref.moreIcon,
    moreText = _ref.moreText,
    href = _ref.href,
    _ref$target = _ref.target,
    target = _ref$target === void 0 ? '_self' : _ref$target,
    rel = _ref.rel,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? 'small' : _ref$size,
    className = _ref.className,
    _ref$classes = _ref.classes,
    classes = _ref$classes === void 0 ? {} : _ref$classes,
    dataAttrs = _ref.dataAttrs;
  var isLink = !!href;
  var ElementType = isLink ? 'a' : 'div';
  var currentRel = setRelAttribute(rel, target);
  return /*#__PURE__*/React.createElement(ElementType, _extends({
    className: cn({
      size: size,
      active: isLink
    }, [className, classes.root])
  }, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root, {
    href: href,
    target: isLink ? target : undefined,
    rel: isLink ? currentRel : undefined,
    style: {
      backgroundImage: "url(".concat(imageSrc, ")")
    }
  }), /*#__PURE__*/React.createElement("div", {
    className: cn('inner')
  }, /*#__PURE__*/React.createElement("div", {
    className: cn('title', [classes.title])
  }, convert(title, {})), subtitle && /*#__PURE__*/React.createElement("div", {
    className: cn('subtitle')
  }, convert(subtitle, {})), !!moreText && /*#__PURE__*/React.createElement("div", {
    className: cn('more')
  }, !!moreIcon && /*#__PURE__*/React.createElement("div", {
    className: cn('more-icon')
  }, moreIcon), convert(moreText, {}))));
};
export default DarkGradientCard;