|
| 1 | +'use client'; |
| 2 | + |
| 3 | +import { Quote, Info, AlertTriangle, Lightbulb } from 'lucide-react'; |
| 4 | +import { cn } from '@/lib/utils'; |
| 5 | +import type { CalloutProps } from './Callout.types'; |
| 6 | + |
| 7 | +const typeConfig = { |
| 8 | + quote: { icon: Quote, label: 'Quote' }, |
| 9 | + info: { icon: Info, label: 'Info' }, |
| 10 | + warning: { icon: AlertTriangle, label: 'Warning' }, |
| 11 | + tip: { icon: Lightbulb, label: 'Tip' }, |
| 12 | +}; |
| 13 | + |
| 14 | +/** |
| 15 | + * Callout Component - Styled Quote/Info Box |
| 16 | + * Neo-Brutalist callout with secondary-colored header |
| 17 | + * Uses bg-elevated for content, secondary for accents |
| 18 | + * Supports author attribution for quote type |
| 19 | + */ |
| 20 | +export function Callout({ children, author, role, type = 'quote', className }: CalloutProps) { |
| 21 | + const config = typeConfig[type]; |
| 22 | + const IconComponent = config.icon; |
| 23 | + |
| 24 | + return ( |
| 25 | + <div |
| 26 | + className={cn( |
| 27 | + 'my-8 overflow-hidden rounded-none border-[4px] border-foreground bg-bg-elevated shadow-[8px_8px_0px_0px] shadow-black', |
| 28 | + className |
| 29 | + )} |
| 30 | + > |
| 31 | + {/* Header bar */} |
| 32 | + <div className="flex items-center gap-2 px-4 py-2 border-b-[4px] border-foreground bg-secondary"> |
| 33 | + <IconComponent size={14} className="text-secondary-text" strokeWidth={3} /> |
| 34 | + <span className="font-mono text-[10px] font-bold uppercase tracking-widest text-secondary-text"> |
| 35 | + {config.label} |
| 36 | + </span> |
| 37 | + </div> |
| 38 | + |
| 39 | + {/* Content */} |
| 40 | + <div className="border-l-[6px] border-l-secondary p-4 sm:p-6"> |
| 41 | + <p className="text-sm sm:text-base leading-relaxed text-foreground italic"> |
| 42 | + “{children}” |
| 43 | + </p> |
| 44 | + |
| 45 | + {author && ( |
| 46 | + <div className="mt-4 flex items-center gap-3 border-t-[2px] border-foreground pt-3"> |
| 47 | + <div className="h-8 w-8 flex items-center justify-center border-[2px] border-foreground bg-secondary font-mono text-xs font-black text-secondary-text"> |
| 48 | + {author.charAt(0).toUpperCase()} |
| 49 | + </div> |
| 50 | + <div> |
| 51 | + <span className="font-mono text-xs font-bold uppercase tracking-wider text-foreground block"> |
| 52 | + {author} |
| 53 | + </span> |
| 54 | + {role && ( |
| 55 | + <span className="font-mono text-[10px] text-muted uppercase tracking-wider"> |
| 56 | + {role} |
| 57 | + </span> |
| 58 | + )} |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + )} |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + ); |
| 65 | +} |
0 commit comments