import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useContext } from 'react';
import cls from 'clsx';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';
import { BORDER_BOTTOM, BORDER_TOP } from '../utils/constant';
export const CardHeader = props => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace('card-header', prefixCls);
  return _jsxs("div", Object.assign({
    className: cls(props.className, bem(), {
      [BORDER_BOTTOM]: props.border
    }),
    style: props.style,
    onClick: props.onClick
  }, {
    children: [_jsx("div", Object.assign({
      className: cls(bem('content'))
    }, {
      children: props.children
    })), props.extra && _jsx("div", Object.assign({
      className: cls(bem('extra'))
    }, {
      children: props.extra
    }))]
  }));
};
export const CardBody = props => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace('card-body', prefixCls);
  return _jsx("div", Object.assign({
    className: cls(props.className, bem()),
    style: props.style,
    onClick: props.onClick
  }, {
    children: props.children
  }));
};
export const CardFooter = props => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace('card-footer', prefixCls);
  return _jsx("div", Object.assign({
    className: cls(props.className, bem({
      compact: props.compact
    }), {
      [BORDER_TOP]: props.border
    }),
    style: props.style,
    onClick: props.onClick
  }, {
    children: props.children
  }));
};
export const CardCover = props => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace('card-cover', prefixCls);
  return _jsx("div", Object.assign({
    className: cls(props.className, bem()),
    style: props.style,
    onClick: props.onClick
  }, {
    children: props.children
  }));
};

const Card = props => {
  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace('card', prefixCls);
  const {
    className,
    style,
    round,
    border,
    children
  } = props;
  return _jsx("div", Object.assign({
    className: cls(bem({
      round,
      border
    }), className),
    style: style,
    onClick: props.onClick
  }, {
    children: children
  }));
}; // defaultProps defined if need


Card.defaultProps = {};
export default Card;