import { __ } from '@wordpress/i18n'; import type { ComponentType, DragEventHandler } from 'react'; import Button from './Button'; import ModuleTraitIcons from './ModuleTraitIcons'; import { type IconProps } from './Icons'; import Toggle from './Toggle'; import type { ModuleTraits } from '../types/modules'; type Tier = 'starter' | 'expert' | null; type ModuleCardProps = { title: string; description: string; Icon: ComponentType; enabled: boolean; onToggle: ( next: boolean ) => void; onOpenSettings?: () => void; showSettingsButton?: boolean; settingsLabel?: string; disabled?: boolean; traits?: ModuleTraits; traitLabels?: { background: string; markup: string; sidebar: string; tool: string; }; tier?: Tier; id?: string; draggable?: boolean; onDragStart?: DragEventHandler; onDragOver?: DragEventHandler; onDrop?: DragEventHandler; onDragEnd?: DragEventHandler; className?: string; }; const ModuleCard = ( { title, description, Icon, enabled, onToggle, onOpenSettings, showSettingsButton = true, settingsLabel, disabled = false, traits, traitLabels, id, draggable = false, onDragStart, onDragOver, onDrop, onDragEnd, className = '', }: ModuleCardProps ) => { const resolvedTraitLabels = traitLabels ?? { background: __( 'Background Process', 'airygen-seo' ), markup: __( 'Front-end output', 'airygen-seo' ), sidebar: __( 'Editor Sidebar', 'airygen-seo' ), tool: __( 'Tool', 'airygen-seo' ), }; return (
{ traits ? ( ) : null }
{ title }

{ description }

{ showSettingsButton && onOpenSettings ? ( ) : null }
); }; export default ModuleCard;