-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
components: add ConnectWalletButton, AddressView #10
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
{!address && ( | ||
renderButton | ||
? renderButton({ text: "Connect Wallet", onClick: () => setOpen(true) }) | ||
: <button onClick={() => setOpen(true)}>Connect Wallet</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use <Button variant="contained" />
from @mui by default since it's already dependent on this UI library
* @param isShort - If true, the address is displayed in short format: 0xff...abcd | ||
* @returns {JSX.Element} | ||
*/ | ||
export const AddressView = ({ isShort = true }: Props): JSX.Element => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to style <AddressView />
? Consider wrapping in @mui <Box />
and passing styling props: sx
, style
, className
: <button onClick={() => setOpen(true)}>Connect Wallet</button> | ||
)} | ||
|
||
{showDisconnect && address && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
navigator.clipboard.writeText(address) | ||
|
||
// TODO: show a snackbar | ||
window.alert("Address copied to clipboard") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still prefer having a simple |
<AddressView /> | ||
</Typography>} | ||
|
||
{showDisconnect && address && (renderButton({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Popup might also be better from a UX perspective because users can accidentally log out if this button is so visible. I heard stories of 10x difference in log out rates because of unaware users who just click on things. Can be added in the future release
Added connect wallet component that keeps track of the modal state open/closed. Use like this: