import * as React from "react";
import { Card, Spinner } from "@sparkle/components";
import { cn } from "@sparkle/lib/utils";
interface CardRootProps {
children: React.ReactNode;
className?: string;
}
const Root = ({ className, children }: CardRootProps) => (
{children}
);
interface CardHeaderProps {
children: React.ReactNode;
className?: string;
}
const Header = ({ className, children }: CardHeaderProps) => (
{children}
);
interface CardTitleProps {
children: React.ReactNode;
className?: string;
}
const Title = ({ className, children }: CardTitleProps) => (
{children}
);
interface CardSubtitleProps {
children: React.ReactNode;
className?: string;
}
const Subtitle = ({ className, children }: CardSubtitleProps) => (
{children}
);
interface CardContentProps {
children?: React.ReactNode;
className?: string;
isLoading?: boolean;
}
const Content = ({
className,
children,
isLoading = false,
}: CardContentProps) => {
if (isLoading) {
return (
);
}
return (
{children}
);
};
interface CardFooterProps {
children: React.ReactNode;
className?: string;
}
const Footer = ({ className, children }: CardFooterProps) => (
{children}
);
interface CardProps {
title: string;
subtitle?: string;
content: React.ReactNode;
footer?: React.ReactNode;
isLoading?: boolean;
className?: string;
}
export const ValueCard = ({
title,
subtitle,
content,
footer,
isLoading = false,
className,
}: CardProps) => {
return (
{title}
{subtitle && {subtitle}}
{content}
{footer && }
);
};
export const ComposableCard = {
Root,
Header,
Title,
Subtitle,
Content,
Footer,
};