PR-666412: fixing List functions.
This commit is contained in:
parent
033a71c80c
commit
6775ec83d8
@ -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": {
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user