import React from "react";
import cn from "classnames";
import PropTypes from "prop-types";
import ICardContent from "./card-content.d";

interface ICardLink extends ICardContent {
  href?: string;
}

const CardLink: React.FC<ICardLink> = ({ className, children, ...props }) => {
  const dataTestId = props["data-testid"] || "honey-ui-card-link";
  return (
    <a {...props} data-testid={dataTestId} className={cn("card-link", className)}>
      {children}
    </a>
  );
};

CardLink.displayName = "Card Link";
CardLink.propTypes = {
  className: PropTypes.string,
  children: PropTypes.oneOfType([
    PropTypes.arrayOf(PropTypes.node),
    PropTypes.node,
    PropTypes.string
  ]),
  href: PropTypes.string
};

export default CardLink;
