/* eslint-disable react/no-array-index-key */ import React, { FC, useState } from 'react'; import { Typography, Tag } from 'antd'; import { TextField } from './TextField'; import { UpdateArgs } from '../../types/config-section'; import { StatusState } from '../../utils/input-statuses'; import { FormStatusIndicator } from './FormStatusIndicator'; const { Title } = Typography; export const TAG_COLOR = '#5a67d8'; export type EditStringArrayProps = { title: string; description?: string; placeholder: string; maxLength?: number; values: string[]; submitStatus?: StatusState; continuousStatusMessage?: StatusState; handleDeleteIndex: (index: number) => void; handleCreateString: (arg: string) => void; }; export const EditValueArray: FC = ({ title, description, placeholder, maxLength, values, handleDeleteIndex, handleCreateString, submitStatus, continuousStatusMessage, }) => { const [newStringInput, setNewStringInput] = useState(''); const handleInputChange = ({ value }: UpdateArgs) => { setNewStringInput(value); }; const handleSubmitNewString = () => { const newString = newStringInput.trim(); handleCreateString(newString); setNewStringInput(''); }; return (
{title}

{description}

{values?.map((tag, index) => { const handleClose = () => { handleDeleteIndex(index); }; return ( {tag} ); })}
{continuousStatusMessage && (
)}
); }; EditValueArray.defaultProps = { maxLength: 50, description: null, submitStatus: null, continuousStatusMessage: null, };