import React, { useContext } from 'react';
import cls from 'clsx';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';
import { BORDER_BOTTOM, BORDER_TOP } from '../utils/constant';
export var CardHeader = function CardHeader(props) {
  var _cls;

  var _useContext = useContext(ConfigProviderContext),
      prefixCls = _useContext.prefixCls,
      createNamespace = _useContext.createNamespace;

  var _createNamespace = createNamespace('card-header', prefixCls),
      bem = _createNamespace[0];

  return /*#__PURE__*/React.createElement("div", {
    className: cls(props.className, bem(), (_cls = {}, _cls[BORDER_BOTTOM] = props.border, _cls)),
    style: props.style,
    onClick: props.onClick
  }, /*#__PURE__*/React.createElement("div", {
    className: cls(bem('content'))
  }, props.children), props.extra && /*#__PURE__*/React.createElement("div", {
    className: cls(bem('extra'))
  }, props.extra));
};
export var CardBody = function CardBody(props) {
  var _useContext2 = useContext(ConfigProviderContext),
      prefixCls = _useContext2.prefixCls,
      createNamespace = _useContext2.createNamespace;

  var _createNamespace2 = createNamespace('card-body', prefixCls),
      bem = _createNamespace2[0];

  return /*#__PURE__*/React.createElement("div", {
    className: cls(props.className, bem()),
    style: props.style,
    onClick: props.onClick
  }, props.children);
};
export var CardFooter = function CardFooter(props) {
  var _cls2;

  var _useContext3 = useContext(ConfigProviderContext),
      prefixCls = _useContext3.prefixCls,
      createNamespace = _useContext3.createNamespace;

  var _createNamespace3 = createNamespace('card-footer', prefixCls),
      bem = _createNamespace3[0];

  return /*#__PURE__*/React.createElement("div", {
    className: cls(props.className, bem({
      compact: props.compact
    }), (_cls2 = {}, _cls2[BORDER_TOP] = props.border, _cls2)),
    style: props.style,
    onClick: props.onClick
  }, props.children);
};
export var CardCover = function CardCover(props) {
  var _useContext4 = useContext(ConfigProviderContext),
      prefixCls = _useContext4.prefixCls,
      createNamespace = _useContext4.createNamespace;

  var _createNamespace4 = createNamespace('card-cover', prefixCls),
      bem = _createNamespace4[0];

  return /*#__PURE__*/React.createElement("div", {
    className: cls(props.className, bem()),
    style: props.style,
    onClick: props.onClick
  }, props.children);
};

var Card = function Card(props) {
  var _useContext5 = useContext(ConfigProviderContext),
      prefixCls = _useContext5.prefixCls,
      createNamespace = _useContext5.createNamespace;

  var _createNamespace5 = createNamespace('card', prefixCls),
      bem = _createNamespace5[0];

  var className = props.className,
      style = props.style,
      round = props.round,
      border = props.border,
      children = props.children;
  return /*#__PURE__*/React.createElement("div", {
    className: cls(bem({
      round: round,
      border: border
    }), className),
    style: style,
    onClick: props.onClick
  }, children);
}; // defaultProps defined if need


Card.defaultProps = {};
export default Card;