import type { ReactNode } from 'react'; import { CircleCheck, CircleX, Lightbulb, TriangleAlert } from 'lucide-react'; import { cn } from '@/lib/utils'; type CalloutType = 'info' | 'warn' | 'warning' | 'error' | 'success' | 'tip' | 'idea'; interface CalloutProps { type?: CalloutType; title?: ReactNode; children?: ReactNode; className?: string; } type ResolvedType = 'info' | 'warning' | 'error' | 'success' | 'idea'; function resolveType(type: CalloutType = 'info'): ResolvedType { if (type === 'warn') return 'warning'; if (type === 'tip') return 'info'; return type; } const variants: Record< ResolvedType, { container: string; icon?: typeof TriangleAlert; iconClass?: string } > = { info: { container: 'border-fd-border/40 bg-fd-muted/35 text-fd-muted-foreground', }, warning: { container: 'border-amber-600/15 bg-amber-500/[0.04] text-fd-muted-foreground', icon: TriangleAlert, iconClass: 'text-amber-600/60', }, error: { container: 'border-red-500/15 bg-red-500/[0.04] text-fd-muted-foreground', icon: CircleX, iconClass: 'text-red-500/60', }, success: { container: 'border-emerald-600/15 bg-emerald-500/[0.04] text-fd-muted-foreground', icon: CircleCheck, iconClass: 'text-emerald-600/60', }, idea: { container: 'border-fd-border/40 bg-fd-muted/35 text-fd-muted-foreground', icon: Lightbulb, iconClass: 'text-fd-muted-foreground/70', }, }; export function Callout({ type = 'info', title, children, className }: CalloutProps) { const resolved = resolveType(type); const variant = variants[resolved]; const Icon = variant.icon; return (
{Icon ? ( ) : null}
{title ?

{title}

: null}
{children}
); }