update connect btn view

connect-component
Ryukemeister 2023-09-29 12:18:02 +05:30
parent c492c389f3
commit 3f793acd0e
1 changed files with 22 additions and 2 deletions

View File

@ -1,7 +1,27 @@
export default function ConnectBtn() {
import { useState } from "react";
import type { ConnectButtonProps } from "types";
import type { AtomsGlobalConfigProps } from "types";
// TODO: add default styling
// also a cssClassAssembler function for custom styling
export default function Connect({ buttonText, onButtonClick }: ConnectButtonProps & AtomsGlobalConfigProps) {
const [isProcessing, setIsProcessing] = useState<boolean>(false);
const [errMsg, setErrMsg] = useState<string>("");
function handleSubmit(e: Event) {
e.preventDefault();
setIsProcessing(true);
onButtonClick();
}
return (
<div>
<button>Connect button</button>
<button onClick={(event) => handleSubmit(event)} disabled={!isProcessing} type="button">
{buttonText || "Install App"}
</button>
{!!errMsg ? <span>{errMsg}</span> : null}
</div>
);
}