@@ -36,6 +36,7 @@ export function WalletWidget(props: WalletWidgetProps) {
3636 )
3737
3838 const getStartIcon = ( ) => {
39+ if ( 'startIcon' in props ) return props . startIcon
3940 if ( ! isConnected ) return < Wallet size = { 20 } />
4041
4142 if ( ! ! iconSrc )
@@ -56,32 +57,42 @@ export function WalletWidget(props: WalletWidgetProps) {
5657 }
5758
5859 const getEndIcon = ( ) => {
60+ if ( 'endIcon' in props ) return props . endIcon
5961 if ( ! ! isConnected && ! ! text ) return < Pointer size = { 20 } />
6062
6163 return null
6264 }
6365
6466 const getChildren = ( ) => {
6567 if ( ! isConnected ) return 'Connect Wallet'
66-
6768 if ( ! ! text ) return text
6869
6970 return compressAddress ( address )
7071 }
7172
73+ const color = ( ( ) => {
74+ if ( 'color' in props ) return props . color
75+ if ( ! isConnected || ! ! text || isUnsupportedChain ) return 'primary'
76+ return ''
77+ } ) ( )
78+
79+ const variant = ( ( ) => {
80+ if ( 'variant' in props ) return props . variant
81+ if ( isConnected ) return 'outline'
82+ return 'default'
83+ } ) ( )
84+
7285 return (
7386 < Button
74- { ...rest }
75- { ...( ( ! isConnected || ! ! text || isUnsupportedChain ) && {
76- color : 'primary' ,
77- } ) }
87+ color = { color }
88+ variant = { variant }
7889 startIcon = { getStartIcon ( ) }
7990 endIcon = { getEndIcon ( ) }
8091 className = { cn ( className , 'in--leading-[unset]' ) }
81- type = " button"
82- size = { ! size ? 'sm' : size }
92+ type = { props . type ?? ' button' }
93+ size = { size ?? 'sm' }
8394 onClick = { setShowWalletWidget }
84- { ...( isConnected && { variant : 'outline' } ) }
95+ { ...rest }
8596 >
8697 { getChildren ( ) }
8798 </ Button >
0 commit comments