import React from 'react'; import { TextField, Typography, IconButton, Box } from '@mui/material'; import DeleteIcon from '@mui/icons-material/Delete'; import VisibilityIcon from '@mui/icons-material/Visibility'; interface EditorProps { label: string; values: string[]; onValuesChange: (values: string[]) => void; onFocusQuestion?: (index: number) => void; } const Editor: React.FC = ({ label, values, onValuesChange, onFocusQuestion }) => { const handleChange = (index: number) => (event: React.ChangeEvent) => { const newValues = [...values]; newValues[index] = event.target.value; onValuesChange(newValues); }; const handleDeleteQuestion = (index: number) => () => { const newValues = values.filter((_, i) => i !== index); // Remove the question at the specified index onValuesChange(newValues); }; const handleFocusQuestion = (index: number) => () => { if (onFocusQuestion) { onFocusQuestion(index); // Call the focus function if provided } } return (
{label} {values.map((value, index) => ( Question {index + 1} {/* Focus (Eye) Button */} {/* Delete Button */} ))}
); }; export default Editor;