diff --git a/app/globals.css b/app/globals.css index 44690e4..628cbd7 100644 --- a/app/globals.css +++ b/app/globals.css @@ -632,3 +632,46 @@ body, body *, [class*="bg-"], [class*="border-"], [class*="text-"] { outline: 2px solid var(--color-accent); outline-offset: 2px; } + +/* Callout/Admonition styles */ +.callout { + @apply my-6 rounded-lg border p-4 text-sm leading-relaxed; +} +.callout-title { + @apply flex items-center gap-2 font-semibold mb-2; +} +.callout-icon { + @apply text-base; +} +.callout-content { + @apply pl-6; +} + +/* Type variants */ +.callout-note { + @apply border-accent/30 bg-accent/[0.06]; +} +.callout-note .callout-title { + @apply text-accent; +} + +.callout-tip { + @apply border-emerald-500/30 bg-emerald-500/[0.06]; +} +.callout-tip .callout-title { + @apply text-emerald-600 dark:text-emerald-400; +} + +.callout-warning { + @apply border-amber-500/30 bg-amber-500/[0.06]; +} +.callout-warning .callout-title { + @apply text-amber-600 dark:text-amber-400; +} + +.callout-danger { + @apply border-red-500/30 bg-red-500/[0.06]; +} +.callout-danger .callout-title { + @apply text-red-600 dark:text-red-400; +} diff --git a/components/ui/Callout.tsx b/components/ui/Callout.tsx new file mode 100644 index 0000000..8bfb65f --- /dev/null +++ b/components/ui/Callout.tsx @@ -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 = { + note: 'ℹ️', + tip: '💡', + warning: '⚠️', + danger: '🚫', +}; + +const typeClasses: Record = { + 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 ( +
+ {title && ( +
+ {iconMap[type] || iconMap.note} + {title} +
+ )} +
{children}
+
+ ); +} diff --git a/mdx-components.tsx b/mdx-components.tsx index d23fbfe..36359a6 100644 --- a/mdx-components.tsx +++ b/mdx-components.tsx @@ -1,9 +1,11 @@ import type { MDXComponents } from 'mdx/types' +import { Callout } from '@/components/ui/Callout' export function useMDXComponents(components: MDXComponents): MDXComponents { return { ...components, + Callout, // Typography h1: (props) => (