import clsx from "clsx"; import type { ReactNode, ElementType } from "react"; import styles from "./index.module.scss"; import { type Props as CardProps, Card } from "../Card/index.js"; type OwnPropsSingle = { header: ReactNode; stat: ReactNode; miniStat?: ReactNode | undefined; corner?: ReactNode | undefined; small?: boolean | undefined; }; type OwnPropsDual = { header1: ReactNode; header2: ReactNode; stat1: ReactNode; stat2: ReactNode; miniStat1?: ReactNode | undefined; miniStat2?: ReactNode | undefined; }; type Props = Omit< CardProps, | keyof OwnPropsSingle | keyof OwnPropsDual | "title" | "toolbar" | "icon" | "footer" > & (OwnPropsSingle | OwnPropsDual); export const StatCard = ({ className, children, ...props }: Props) => { const { /* eslint-disable @typescript-eslint/no-unused-vars */ header, stat, miniStat, corner, small, header1, header2, stat1, stat2, miniStat1, miniStat2, /* eslint-enable @typescript-eslint/no-unused-vars */ ...cardProps } = props; return (
{"header" in props ? ( <> {props.corner && (
{props.corner}
)}

{props.header}

{props.stat}
{props.miniStat && (
{props.miniStat}
)}
) : ( <>

{props.header1}

{props.header2}

{props.stat1}
{props.miniStat1 && (
{props.miniStat1}
)}
{props.miniStat2 && (
{props.miniStat2}
)}
{props.stat2}
)}
{children &&
{children}
}
); };