@@ -13,24 +13,9 @@ import cssStyles from "./WalletButton.module.css"
1313
1414export const WalletButton = ( ) => {
1515 const [ showDisconnectModal , setShowDisconnectModal ] = useState ( false )
16- const [ isWarningTooltipVisible , setIsWarningTooltipVisible ] = useState ( false )
1716 const { address, isPending, balances, walletWarnings } = useWallet ( )
1817 const buttonLabel = isPending ? "Loading..." : "Connect"
1918
20- const warningIconStyles = {
21- display : "flex" ,
22- alignItems : "center" ,
23- justifyContent : "center" ,
24- overflow : "hidden" ,
25- backgroundColor : "var(--color-gray-00, #fff)" ,
26- borderRadius : "50%" ,
27- padding : "3px" ,
28- border : "2px solid var(--color-yellow-60, #f0ad4e)" ,
29- boxShadow : "0 1px 3px rgba(0, 0, 0, 0.2)" ,
30- lineHeight : 0 ,
31- textDecoration : "none" ,
32- } as const
33-
3419 if ( ! address ) {
3520 return (
3621 < Button variant = "primary" size = "md" onClick = { ( ) => void connectWallet ( ) } >
@@ -109,7 +94,7 @@ export const WalletButton = () => {
10994 </ Modal >
11095 </ div >
11196
112- < div style = { { position : "relative" } } >
97+ < div className = { cssStyles . profileWrap } >
11398 < Profile
11499 publicAddress = { address }
115100 size = "md"
@@ -118,45 +103,23 @@ export const WalletButton = () => {
118103 />
119104
120105 { walletWarnings . hasWarnings && (
121- < div
122- onMouseEnter = { ( ) => setIsWarningTooltipVisible ( true ) }
123- onMouseLeave = { ( ) => setIsWarningTooltipVisible ( false ) }
124- style = { {
125- position : "absolute" ,
126- top : "-6px" ,
127- right : "-6px" ,
128- zIndex : 1 ,
129- } }
106+ < Tooltip
107+ placement = "bottom"
108+ triggerEl = { < Icon . AlertTriangle className = { cssStyles . warningIcon } /> }
130109 >
131- < Tooltip
132- isVisible = { isWarningTooltipVisible }
133- isContrast
134- placement = "bottom"
135- triggerEl = { React . createElement (
136- walletWarnings . helpUrl ? "a" : "span" ,
137- walletWarnings . helpUrl
138- ? {
139- href : walletWarnings . helpUrl ,
140- target : "_blank" ,
141- className : cssStyles . warningIcon ,
142- style : warningIconStyles ,
143- }
144- : { style : warningIconStyles } ,
145- < Icon . AlertTriangle
146- style = { {
147- color : "var(--color-yellow-60, #f0ad4e)" ,
148- width : "12px" ,
149- height : "12px" ,
150- } }
151- /> ,
110+ < div style = { { maxWidth : "15em" } } >
111+ { walletWarnings . messages . join ( "" ) }
112+ { walletWarnings . helpUrl && (
113+ < a
114+ className = { cssStyles . learnMore }
115+ href = { walletWarnings . helpUrl }
116+ target = "_blank"
117+ >
118+ Learn more
119+ </ a >
152120 ) }
153- >
154- < div style = { { maxWidth : "15em" } } >
155- { walletWarnings . messages . join ( ". " ) }
156- { walletWarnings . helpUrl ? ". Click to learn more." : "" }
157- </ div >
158- </ Tooltip >
159- </ div >
121+ </ div >
122+ </ Tooltip >
160123 ) }
161124 </ div >
162125 </ div >
0 commit comments