/** * Provenance badge for a module, section, or area. * * A small chip beside a name, so it's obvious at a glance which switches come with * the theme and which arrive with a companion plugin. The slugs are a closed set on * the PHP side (see Admin_Panel::badge()), which is why this can pair each with a * fixed icon and label. */ import { __ } from '@wordpress/i18n'; import { Crown, Sparkles, FlaskConical } from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; const BADGES: Record< string, { Icon: LucideIcon; label: string } > = { pro: { Icon: Crown, label: __( 'Pro', 'aureon' ) }, beta: { Icon: FlaskConical, label: __( 'Beta', 'aureon' ) }, new: { Icon: Sparkles, label: __( 'New', 'aureon' ) }, }; interface BadgeProps { badge?: string; /** Icon only, for tight spots like a nav entry. */ compact?: boolean; } export default function Badge( { badge, compact = false }: BadgeProps ) { const match = badge ? BADGES[ badge ] : undefined; if ( ! match ) { return null; } const { Icon, label } = match; return ( ); }