Merge pull request #2 from aleleba/PR-666412
PR-666412: fixing List functions.
This commit is contained in:
commit
c632f7f01c
@ -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": {
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user