Merge pull request #2 from aleleba/PR-666412

PR-666412: fixing List functions.
This commit is contained in:
Alejandro Lembke Barrientos 2023-10-11 22:44:11 -06:00 committed by GitHub
commit c632f7f01c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

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

View File

@ -23,11 +23,11 @@ type TListProps = {
/**
* 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.
*/
handleChangeState?: ChangeEventHandler<HTMLInputElement>
handleChangeState?: ((index: number) => void)
};
const List: FC<TListProps> = ({
@ -44,12 +44,12 @@ const List: FC<TListProps> = ({
<tbody>
{ list !== undefined && list.map((item, 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>
<div className="delete-button-container">
<Button
type={ButtonTypes.REMOVE}
onClick={onClickRemoveItem}
onClick={ () => onClickRemoveItem !== undefined ? onClickRemoveItem(index) : undefined }
/>
</div>
</td>