import type { ReactNode } from 'react'; import { Notice as WPNotice } from '@wordpress/components'; import { CircleAlert, CircleCheck, Info, TriangleAlert } from 'lucide-react'; import { cn } from '@/lib/utils'; const TONES = { info: { icon: Info, box: 'wtofe:border-primary/20 wtofe:bg-primary-light wtofe:text-ink', iconClass: 'wtofe:text-primary' }, success: { icon: CircleCheck, box: 'wtofe:border-green-200 wtofe:bg-green-50 wtofe:text-green-900', iconClass: 'wtofe:text-green-600' }, warning: { icon: TriangleAlert, box: 'wtofe:border-amber-200 wtofe:bg-amber-50 wtofe:text-ink', iconClass: 'wtofe:text-amber-600' }, error: { icon: CircleAlert, box: 'wtofe:border-red-200 wtofe:bg-red-50 wtofe:text-red-900', iconClass: 'wtofe:text-red-600' }, }; interface NoticeProps { tone?: keyof typeof TONES; /** Read the message out to screen readers when it appears (results, not static notes). */ announce?: boolean; className?: string; children: ReactNode; } /** * WordPress's Notice, not dismissible, with the app's message box drawn * inside it (components.css clears WordPress's own frame). */ export default function Notice( { tone = 'info', announce = false, className, children }: NoticeProps ) { const { icon: Icon, box, iconClass } = TONES[ tone ]; return (
); }