2
0

fix(editor): 🐛 FIx Webhook settings debounce

This commit is contained in:
Baptiste Arnaud
2022-03-10 17:32:14 +01:00
parent 6cf89d8d9c
commit 31298e39c1
11 changed files with 50 additions and 15 deletions

View File

@ -10,13 +10,15 @@ type ItemWithId<T> = T & { id: string }
export type TableListItemProps<T> = {
item: T
debounceTimeout?: number
onItemChange: (item: T) => void
}
type Props<T> = {
initialItems: ItemWithId<T>[]
onItemsChange: (items: ItemWithId<T>[]) => void
addLabel?: string
debounceTimeout?: number
onItemsChange: (items: ItemWithId<T>[]) => void
Item: (props: TableListItemProps<T>) => JSX.Element
ComponentBetweenItems?: (props: unknown) => JSX.Element
}
@ -25,6 +27,7 @@ export const TableList = <T,>({
initialItems,
onItemsChange,
addLabel = 'Add',
debounceTimeout,
Item,
ComponentBetweenItems = () => <></>,
}: Props<T>) => {
@ -75,7 +78,11 @@ export const TableList = <T,>({
onMouseLeave={handleMouseLeave}
mt={itemIndex !== 0 && ComponentBetweenItems ? 4 : 0}
>
<Item item={item} onItemChange={handleCellChange(itemIndex)} />
<Item
item={item}
onItemChange={handleCellChange(itemIndex)}
debounceTimeout={debounceTimeout}
/>
<Fade in={showDeleteIndex === itemIndex}>
<IconButton
icon={<TrashIcon />}