import type { HTMLAttributes, ReactNode } from "react";

type Props = HTMLAttributes<HTMLElement> & {
  title?: string;
  children: ReactNode;
};

export function Card({ title, children, className = "", ...rest }: Props) {
  return (
    <section className={`hb-card ${className}`.trim()} {...rest}>
      {title ? <h2 className="hb-card__title">{title}</h2> : null}
      <div className="hb-card__body">{children}</div>
    </section>
  );
}
