/** * A single Font Library table row: family name, source, styles, a toggleable * status pill, added-on date, and edit/delete actions. Mirrors PairingCard's * icon-button and ConfirmDialog conventions for consistency. */ import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { Button } from '@wordpress/components'; import { Pencil, Trash2, Check, X } from 'lucide-react'; import ConfirmDialog from '../../confirm-dialog'; import TextField from '../../controls/text-field'; import type { FontLibraryEntry } from '../../types'; interface FontLibraryRowProps { item: FontLibraryEntry; onChange: ( item: FontLibraryEntry ) => void; onDelete: () => void; } const formatDate = ( timestamp: number ): string => { if ( ! timestamp ) { return '—'; } return new Date( timestamp * 1000 ).toLocaleDateString( undefined, { year: 'numeric', month: 'short', day: '2-digit', } ); }; export default function FontLibraryRow( { item, onChange, onDelete, }: FontLibraryRowProps ) { const [ editing, setEditing ] = useState( false ); const [ confirmingDelete, setConfirmingDelete ] = useState( false ); const [ draftFamily, setDraftFamily ] = useState( item.family ); const toggleStatus = () => onChange( { ...item, status: 'active' === item.status ? 'inactive' : 'active', } ); const saveFamily = () => { onChange( { ...item, family: draftFamily.trim() || item.family } ); setEditing( false ); }; return (