File tree 2 files changed +44
-18
lines changed
packages/ui/src/composites 2 files changed +44
-18
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,7 @@ export const getThemedTextStyle = (
38
38
disabled ?: boolean
39
39
) : StyleProp < any > => {
40
40
if ( disabled ) {
41
- return variant === 'fill'
42
- ? { color : theme [ 'gray-glass-020' ] }
43
- : { color : theme [ 'gray-glass-020' ] } ;
41
+ return { color : theme [ 'gray-glass-020' ] } ;
44
42
}
45
43
46
44
return variant === 'fill'
Original file line number Diff line number Diff line change @@ -47,24 +47,52 @@ export function NetworkButton({
47
47
onPressOut = { setStartValue }
48
48
disabled = { disabled }
49
49
>
50
- { loading ? (
51
- < LoadingSpinner size = "md" style = { styles . loader } />
52
- ) : imageSrc ? (
53
- < Image
54
- style = { [
55
- styles . image ,
56
- { borderColor : Theme [ 'gray-glass-005' ] } ,
57
- disabled && styles . imageDisabled
58
- ] }
59
- source = { imageSrc }
60
- headers = { imageHeaders }
61
- />
62
- ) : (
63
- < IconBox icon = "networkPlaceholder" background iconColor = { textColor } size = "sm" />
64
- ) }
50
+ < LoaderComponent loading = { loading } />
51
+ < ImageComponent
52
+ loading = { loading }
53
+ disabled = { disabled }
54
+ imageSrc = { imageSrc }
55
+ imageHeaders = { imageHeaders }
56
+ borderColor = { Theme [ 'gray-glass-005' ] }
57
+ />
65
58
< Text style = { styles . text } variant = "paragraph-600" color = { textColor } >
66
59
{ children }
67
60
</ Text >
68
61
</ AnimatedPressable >
69
62
) ;
70
63
}
64
+
65
+ function LoaderComponent ( { loading } : { loading ?: boolean } ) {
66
+ if ( ! loading ) return null ;
67
+
68
+ return < LoadingSpinner size = "md" style = { styles . loader } /> ;
69
+ }
70
+
71
+ function ImageComponent ( {
72
+ loading,
73
+ disabled,
74
+ imageSrc,
75
+ imageHeaders,
76
+ borderColor
77
+ } : {
78
+ loading ?: boolean ;
79
+ disabled ?: boolean ;
80
+ imageSrc ?: string ;
81
+ imageHeaders ?: Record < string , string > ;
82
+ borderColor : string ;
83
+ } ) {
84
+ if ( loading ) return null ;
85
+
86
+ const textColor = disabled ? 'fg-300' : 'fg-100' ;
87
+ if ( ! imageSrc ) {
88
+ return < IconBox icon = "networkPlaceholder" background iconColor = { textColor } size = "sm" /> ;
89
+ }
90
+
91
+ return (
92
+ < Image
93
+ style = { [ styles . image , { borderColor } , disabled && styles . imageDisabled ] }
94
+ source = { imageSrc }
95
+ headers = { imageHeaders }
96
+ />
97
+ ) ;
98
+ }
You can’t perform that action at this time.
0 commit comments