import React, { useState } from 'react'; import { Category } from '../types'; interface CategoryEditModalProps { category?: Category; edit: boolean; onClose: () => void; onSave: (name: string) => void; onDelete: () => void; } const CategoryEditModal: React.FC = ({ category, edit, onClose, onSave, onDelete }) => { const [name, setName] = useState(category ? category.name : ''); const handleSave = () => { onSave(name); }; const handleOverlayClick = (e: React.MouseEvent) => { if (e.target === e.currentTarget) { onClose(); } }; return (

{edit ? 'Edit Category' : 'Add Category'}

setName(e.target.value)} className="bg-white/10 p-3 rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-400" />
{edit && ( )}
); }; export default CategoryEditModal;