replace handleClick with generic onClick for button component

connect-component
Ryukemeister 2023-10-27 18:19:15 +05:30
parent 7c2c94bf27
commit 36f9e6671c
1 changed files with 2 additions and 3 deletions

View File

@ -8,14 +8,13 @@ import type { AtomsGlobalConfigProps } from "../types";
interface ConnectButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
buttonText?: string;
icon?: JSX.Element;
handleClick: () => void;
onSuccess?: () => void;
onError: () => void;
}
export function ConnectButton({
buttonText,
handleClick,
onClick,
onSuccess,
onError,
className,
@ -29,7 +28,7 @@ export function ConnectButton({
try {
setIsProcessing(true);
handleClick && handleClick();
onClick && onClick(e);
// if user wants to handle onSuccess inside handleClick then it makes no sense to have a separate handler
// otherwise only if the user explicitly passes an onSuccess handler this gets triggered