Files
explore/ui/address/contract/methods/form/ContractMethodArrayButton.tsx
tom goriunovandGitHub fcdf8d987e New styles for pagination and "Add / Remove" buttons (#2791)
* update styles for add / remove buttons

* update pagination styles

* change border color for filled inputs

* change row gap for alerts

* update icons and screenshots

* fix tests

* update buttons for contract method form

* update screenshot
2025-06-23 12:15:24 +02:00

32 lines
824 B
TypeScript

import React from 'react';
import type { IconButtonProps } from 'toolkit/chakra/icon-button';
import AddButton from 'toolkit/components/buttons/AddButton';
import RemoveButton from 'toolkit/components/buttons/RemoveButton';
interface Props extends Omit<IconButtonProps, 'type'> {
index: number;
type: 'add' | 'remove';
}
const ContractMethodArrayButton = ({ type, index, onClick, ...props }: Props) => {
const handleClick = React.useCallback((event: React.MouseEvent<HTMLButtonElement>) => {
event.stopPropagation();
onClick?.(event);
}, [ onClick ]);
const Button = type === 'add' ? AddButton : RemoveButton;
return (
<Button
data-index={ index }
size="2xs_alt"
onClick={ handleClick }
{ ...props }
/>
);
};
export default React.memo(ContractMethodArrayButton);