import React, { FC, MouseEventHandler, ChangeEventHandler } from 'react'; import { TItem, Item, ButtonTypes, Button, Input } from '@components'; import './style.scss'; import { on } from 'events'; type TListProps = { /** * Is this the list of items as an array. */ list: TItem[] /** * Is this the text of the placeholder of the input of the List. */ placeholderInput?: string /** * Is this the text of the value of the input of the List. */ valueInput?: string /** * Is this the onChange event of the input to add */ onChangeInput?: ChangeEventHandler /** * Is this the onClick Event of the button to add an item. */ onClickAddItem?: MouseEventHandler | undefined /** * Is this the onClick Event of the button to Remove a Item. */ onClickRemoveItem?: ((index: number) => void) /** * Is this the on Event triggered by the checkbox. */ handleChangeState?: ((index: number) => void) }; const List: FC = ({ list, placeholderInput, valueInput = '', onChangeInput, onClickAddItem, onClickRemoveItem, handleChangeState }) => { return (
{ list !== undefined && list.map((item, index) => ( ))}
handleChangeState !== undefined ? handleChangeState(index) : undefined} />
); }; export { List, TListProps }