import { clsx } from 'clsx/lite'; import { ReactNode, useState } from 'react'; import { LuChevronRight, LuChevronsDownUp, LuChevronsUpDown, } from 'react-icons/lu'; import LinkWithStatus from './LinkWithStatus'; import Spinner from './Spinner'; const expandAccessoryClasses = clsx( 'flex items-center justify-center', 'w-9 h-8', '*:shrink-0', ); export default function ScoreCardRow({ icon, content, expandContent, expandPath, className, }: { icon: ReactNode content: ReactNode | ((isExpanded?: boolean) => ReactNode) expandContent?: ReactNode expandPath?: string className?: string }) { const [isExpanded, setIsExpanded] = useState(false); return (
{icon}
{typeof content === 'function' ? content(isExpanded) : content}
{isExpanded &&
{expandContent}
}
{expandContent && } {expandPath && {({ isLoading }) => <> {isLoading ? : } } }
); }