1- import classNames from 'classnames' ;
2- import { ConnectWallet } from '@coinbase/onchainkit/wallet' ;
31import { Button , ButtonSizes , ButtonVariants } from 'apps/web/src/components/Button/Button' ;
4- import { useAccount } from 'wagmi ' ;
2+ import { ConnectButton , useConnectModal } from '@rainbow-me/rainbowkit ' ;
53
64type RenewalButtonProps = {
75 correctChain : boolean ;
@@ -18,33 +16,43 @@ export function RenewalButton({
1816 disabled,
1917 isLoading,
2018} : RenewalButtonProps ) {
21- const { isConnected } = useAccount ( ) ;
22-
23- if ( ! isConnected ) {
24- return (
25- < ConnectWallet
26- className = { classNames (
27- 'bg-button-black text-white hover:bg-button-blackHover active:bg-button-blackActive' ,
28- 'px-10 py-3.5 text-sm md:text-lg' ,
29- 'rounded-full' ,
30- ) }
31- disconnectedLabel = "Connect wallet"
32- />
33- ) ;
34- }
19+ const { openConnectModal } = useConnectModal ( ) ;
3520
3621 return (
37- < Button
38- onClick = { correctChain ? renewNameCallback : switchToIntendedNetwork }
39- type = "button"
40- variant = { ButtonVariants . Black }
41- size = { ButtonSizes . Medium }
42- disabled = { disabled || isLoading }
43- isLoading = { isLoading }
44- rounded
45- fullWidth
46- >
47- { correctChain ? 'Extend registration' : 'Switch to Base' }
48- </ Button >
22+ < ConnectButton . Custom >
23+ { ( { account, chain, mounted } ) => {
24+ const ready = mounted ;
25+ const connected = ready && account && chain ;
26+
27+ if ( ! connected ) {
28+ return (
29+ < Button
30+ type = "button"
31+ variant = { ButtonVariants . Black }
32+ size = { ButtonSizes . Medium }
33+ onClick = { openConnectModal }
34+ rounded
35+ >
36+ Connect wallet
37+ </ Button >
38+ ) ;
39+ }
40+
41+ return (
42+ < Button
43+ onClick = { correctChain ? renewNameCallback : switchToIntendedNetwork }
44+ type = "button"
45+ variant = { ButtonVariants . Black }
46+ size = { ButtonSizes . Medium }
47+ disabled = { disabled }
48+ isLoading = { isLoading }
49+ rounded
50+ fullWidth
51+ >
52+ { correctChain ? 'Renew name' : 'Switch to Base' }
53+ </ Button >
54+ ) ;
55+ } }
56+ </ ConnectButton . Custom >
4957 ) ;
5058}
0 commit comments