feat: add Callout component with note/tip/warning/danger variants

This commit is contained in:
kbot
2026-06-03 21:48:39 -05:00
parent c617ee4438
commit 7c653f3852
3 changed files with 84 additions and 0 deletions

39
components/ui/Callout.tsx Normal file
View File

@@ -0,0 +1,39 @@
'use client';
import type { ReactNode } from 'react';
interface CalloutProps {
type?: 'note' | 'tip' | 'warning' | 'danger';
title?: string;
children: ReactNode;
}
const iconMap: Record<string, string> = {
note: '',
tip: '💡',
warning: '⚠️',
danger: '🚫',
};
const typeClasses: Record<string, string> = {
note: 'callout-note',
tip: 'callout-tip',
warning: 'callout-warning',
danger: 'callout-danger',
};
export function Callout({ type = 'note', title, children }: CalloutProps) {
const className = `callout ${typeClasses[type] || typeClasses.note}`;
return (
<div className={className} role="note">
{title && (
<div className="callout-title">
<span className="callout-icon">{iconMap[type] || iconMap.note}</span>
<span>{title}</span>
</div>
)}
<div className="callout-content">{children}</div>
</div>
);
}