import _Button from "@alifd/next/es/button";
import _extends from "@babel/runtime/helpers/extends";
import * as React from 'react';
import "./index.scss";
var PortalCard = function PortalCard(props) {
  var title = props.title,
    description = props.description,
    backgroundImage = props.backgroundImage,
    href = props.href,
    _props$style = props.style,
    propStyle = _props$style === void 0 ? {} : _props$style;
  var _React$useState = React.useState(propStyle),
    style = _React$useState[0],
    setStyle = _React$useState[1];
  var onClick = function onClick() {
    window.open(href);
  };
  var onMouseEnter = function onMouseEnter() {
    setStyle(_extends({}, style, {
      background: "url(" + backgroundImage + ")"
    }));
  };
  var onMouseLeave = function onMouseLeave() {
    setStyle(_extends({}, style, {
      background: null
    }));
  };
  return /*#__PURE__*/React.createElement("div", {
    className: "portal-card",
    style: style,
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
    className: "portal-title"
  }, title), /*#__PURE__*/React.createElement("div", {
    className: "portal-description"
  }, description)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Button, {
    type: "normal",
    onClick: onClick
  }, "\u8BE6\u60C5")));
};
PortalCard.defaultProps = {
  title: 'Title',
  description: 'This is a description'
};
export default PortalCard;