Files
vision-start/components/CategoryEditModal.tsx
T
ivanch 99dbea0615
Build and Release to Staging / Build Vision Start (push) Successful in 40s
Build and Release to Staging / Build Vision Start Image (push) Successful in 1m8s
Build and Release to Staging / Deploy Vision Start (staging) (push) Successful in 16s
fixing small issues in the project
2026-10-10 23:25:20 -03:00

36 lines
947 B
TypeScript

import { useState } from 'react';
import { Category } from '../types';
import ModalShell from './ModalShell';
interface CategoryEditModalProps {
category?: Category;
edit: boolean;
onClose: () => void;
onSave: (name: string) => void;
onDelete: () => void;
}
const CategoryEditModal: React.FC<CategoryEditModalProps> = ({ category, edit, onClose, onSave, onDelete }) => {
const [name, setName] = useState(category ? category.name : '');
return (
<ModalShell
title={edit ? 'Edit Category' : 'Add Category'}
edit={edit}
onClose={onClose}
onSave={() => onSave(name.trim())}
canSave={name.trim() !== ''}
onDelete={edit ? onDelete : undefined}
>
<input
type="text"
placeholder="Category Name"
value={name}
onChange={(e) => setName(e.target.value)}
className="liquid-input p-3"
/>
</ModalShell>
);
};
export default CategoryEditModal;