/** * WordPress dependencies */ import { __experimentalInputControl as InputControl, __experimentalVStack as VStack, __experimentalHStack as HStack, Button, Modal, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useState } from '@wordpress/element'; import type { FontSize } from '@wordpress/global-styles-engine'; interface RenameFontSizeDialogProps { fontSize: FontSize; toggleOpen: () => void; handleRename: ( newName: string ) => void; } function RenameFontSizeDialog( { fontSize, toggleOpen, handleRename, }: RenameFontSizeDialogProps ) { const [ newName, setNewName ] = useState< string | undefined >( fontSize.name ); const handleConfirm = () => { // If the new name is not empty, call the handleRename function if ( newName && newName.trim() ) { handleRename( newName ); } toggleOpen(); }; return (
{ event.preventDefault(); handleConfirm(); toggleOpen(); } } >
); } export default RenameFontSizeDialog;