import { type ReactNode, useMemo } from "react"; import { cn } from "@/lib/utils"; import { type MotionStyle, type PlaceholderVariant, pickPiece } from "./ascii-pool"; import { DEFAULT_MESSAGES } from "./messages"; import "./Placeholder.css"; interface PlaceholderProps { variant: PlaceholderVariant; message?: string; children?: ReactNode; className?: string; } const MOTION_CLASS: Record = { bob: "placeholder-motion-bob", flutter: "placeholder-motion-flutter", none: "", }; const Placeholder = ({ variant, message, children, className }: PlaceholderProps) => { const piece = useMemo(() => pickPiece(variant), [variant]); const resolvedMessage = message ?? DEFAULT_MESSAGES[variant]; const isLoading = variant === "loading"; return (

{resolvedMessage}

{children &&
{children}
}
); }; export default Placeholder;