PR-666412: fixing List functions. #2

Merged
aleleba merged 1 commits from PR-666412 into master 2023-10-11 22:44:11 -06:00
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "react-list-ui-library", "name": "react-list-ui-library",
"version": "1.0.0", "version": "1.0.1",
"description": "A Library with storybook for a list app", "description": "A Library with storybook for a list app",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {

View File

@ -23,11 +23,11 @@ type TListProps = {
/** /**
* Is this the onClick Event of the button. * Is this the onClick Event of the button.
*/ */
onClickRemoveItem?: MouseEventHandler<HTMLButtonElement> |undefined onClickRemoveItem?: ((index: number) => void)
/** /**
* Is this the on Event triggered by the checkbox. * Is this the on Event triggered by the checkbox.
*/ */
handleChangeState?: ChangeEventHandler<HTMLInputElement> handleChangeState?: ((index: number) => void)
}; };
const List: FC<TListProps> = ({ const List: FC<TListProps> = ({
@ -44,12 +44,12 @@ const List: FC<TListProps> = ({
<tbody> <tbody>
{ list !== undefined && list.map((item, index) => ( { list !== undefined && list.map((item, index) => (
<tr key={index}> <tr key={index}>
<td><Item name={item.name} status={item.status} handleChange={handleChangeState} /></td> <td><Item name={item.name} status={item.status} handleChange={ () => handleChangeState !== undefined ? handleChangeState(index) : undefined} /></td>
<td> <td>
<div className="delete-button-container"> <div className="delete-button-container">
<Button <Button
type={ButtonTypes.REMOVE} type={ButtonTypes.REMOVE}
onClick={onClickRemoveItem} onClick={ () => onClickRemoveItem !== undefined ? onClickRemoveItem(index) : undefined }
/> />
</div> </div>
</td> </td>