File tree Expand file tree Collapse file tree 2 files changed +19
-13
lines changed
components/primitives/Button Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,16 @@ const Button = (
96
96
) ;
97
97
}
98
98
99
- const boxChildren = isLoading && isLoadingText ? isLoadingText : children ;
100
-
101
99
const spinnerElement = spinner ? (
102
100
spinner
103
101
) : (
104
102
< Spinner color = { _text ?. color } { ..._spinner } />
105
103
) ;
106
104
105
+ const boxChildren = ( child : any ) => {
106
+ return < Box _text = { _text } > { child } </ Box > ;
107
+ } ;
108
+
107
109
return (
108
110
< Pressable
109
111
disabled = { isDisabled || isLoading }
@@ -127,14 +129,15 @@ const Button = (
127
129
{ ...resolvedProps }
128
130
accessibilityRole = { props . accessibilityRole ?? 'button' }
129
131
>
130
- < HStack { ..._stack } >
132
+ < HStack { ..._stack } test = { true } >
131
133
{ startIcon && ! isLoading ? startIcon : null }
132
134
{ isLoading && spinnerPlacement === 'start' ? spinnerElement : null }
133
- { boxChildren ? (
134
- < Box _text = { _text } >
135
- { isLoading && isLoadingText ? isLoadingText : children }
136
- </ Box >
137
- ) : null }
135
+ { isLoading
136
+ ? isLoadingText
137
+ ? boxChildren ( isLoadingText )
138
+ : null
139
+ : boxChildren ( children ) }
140
+
138
141
{ endIcon && ! isLoading ? endIcon : null }
139
142
{ isLoading && spinnerPlacement === 'end' ? spinnerElement : null }
140
143
</ HStack >
Original file line number Diff line number Diff line change @@ -17,12 +17,15 @@ const baseStyle = (props: any) => {
17
17
flexDirection : 'row' ,
18
18
justifyContent : 'center' ,
19
19
alignItems : 'center' ,
20
+
20
21
_web : {
21
- cursor : props . isDisabled
22
- ? 'not-allowed'
23
- : props . isLoading
24
- ? 'default'
25
- : 'pointer' ,
22
+ _disabled : {
23
+ cursor : 'not-allowed' ,
24
+ } ,
25
+ _loading : {
26
+ cursor : 'not-allowed' ,
27
+ } ,
28
+ cursor : 'pointer' ,
26
29
} ,
27
30
_text : {
28
31
fontWeight : 'medium' ,
You can’t perform that action at this time.
0 commit comments