File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed
packages/thirdweb/src/react/web/ui/TransactionButton Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " thirdweb " : patch
3
+ ---
4
+
5
+ Fix TransactionButton layout shift while loading
Original file line number Diff line number Diff line change @@ -111,7 +111,6 @@ export function TransactionButton(props: TransactionButtonProps) {
111
111
return (
112
112
< Button
113
113
gap = "xs"
114
- { ...buttonProps }
115
114
disabled = { ! account || disabled }
116
115
variant = { "primary" }
117
116
data-is-loading = { isPending }
@@ -146,9 +145,11 @@ export function TransactionButton(props: TransactionButtonProps) {
146
145
}
147
146
} }
148
147
style = { {
149
- ...buttonProps . style ,
150
148
opacity : ! account || disabled ? 0.5 : 1 ,
149
+ minWidth : "150px" ,
150
+ ...buttonProps . style ,
151
151
} }
152
+ { ...buttonProps }
152
153
>
153
154
{ children }
154
155
</ Button >
@@ -157,15 +158,29 @@ export function TransactionButton(props: TransactionButtonProps) {
157
158
158
159
return (
159
160
< Button
160
- { ...buttonProps }
161
161
disabled = { true }
162
162
variant = { "primary" }
163
163
style = { {
164
- ... buttonProps . style ,
164
+ opacity : ! account || disabled ? 0.5 : 1 ,
165
165
minWidth : "150px" ,
166
+ position : "relative" ,
167
+ ...buttonProps . style ,
166
168
} }
169
+ { ...buttonProps }
167
170
>
168
- < Spinner size = "md" color = "primaryButtonText" />
171
+ < div
172
+ style = { {
173
+ position : "absolute" ,
174
+ display : "flex" ,
175
+ alignItems : "center" ,
176
+ height : "100%" ,
177
+ top : 0 ,
178
+ bottom : 0 ,
179
+ margin : "auto" ,
180
+ } }
181
+ >
182
+ < Spinner size = "md" color = "primaryButtonText" />
183
+ </ div >
169
184
</ Button >
170
185
) ;
171
186
}
You can’t perform that action at this time.
0 commit comments