import React from "react"; import { Box, TextField, IconButton } from "@mui/material"; import DeleteOutlineOutlinedIcon from "@mui/icons-material/DeleteOutlineOutlined"; interface CourseAttributes { id: string | number; title: string; institution: string; year: number | string; duration: string; description?: string; } interface Props { data: CourseAttributes; onChange: (data: CourseAttributes) => void; onRemove: () => void; isDeletable: boolean; } export default function CourseForm({ data, onChange, onRemove, isDeletable }: Props) { const handleChange = (field: keyof CourseAttributes, value: any) => { onChange({ ...data, [field]: value }); }; return ( {isDeletable && ( )} handleChange("title", e.target.value)} /> handleChange("institution", e.target.value)} /> handleChange("year", e.target.value)} /> handleChange("duration", e.target.value)} placeholder="مثلاً 40 ساعت" /> handleChange("description", e.target.value)} sx={{ gridColumn: { xs: "1", md: "1 / -1" } }} /> ); }