@@ -13,6 +13,15 @@ import { WithWrapper } from './WithWrapper'
1313
1414const { Spacing, IconSize } = SizesAndSpaces
1515
16+ /**
17+ * The old familiar issue where Typography default line height is too big when being used in a small component.
18+ * The bottom margin of the text ends up being larger than the top half, messing with the vertical alignment.
19+ * We ought to find a better solution for it one day, but for now this'll do the trick.
20+ */
21+ const VERTICAL_CENTER_TEXT = {
22+ '&' : { lineHeight : 'normal' } ,
23+ }
24+
1625/** Button wrapper for clickable balance text */
1726const BalanceButton = ( {
1827 children,
@@ -109,17 +118,22 @@ export const Balance = <T extends Amount>({
109118 variant = "highlightXs"
110119 color = { disabled ? 'textDisabled' : balance == null ? 'textTertiary' : 'textPrimary' }
111120 data-testid = "balance-value"
121+ sx = { { ...VERTICAL_CENTER_TEXT } }
112122 >
113123 { loading ? '???' : balance == null ? '-' : formatNumber ( balance , { abbreviate : true } ) }
114124 </ Typography >
115125 </ WithSkeleton >
116126
117- < Typography variant = "highlightXs" color = { disabled ? 'textDisabled' : 'textPrimary' } >
127+ < Typography
128+ variant = "highlightXs"
129+ color = { disabled ? 'textDisabled' : 'textPrimary' }
130+ sx = { { ...VERTICAL_CENTER_TEXT } }
131+ >
118132 { symbol }
119133 </ Typography >
120134
121135 { notionalValueUsd != null && ! loading && (
122- < Typography variant = "bodyXsRegular" color = "textTertiary" >
136+ < Typography variant = "bodyXsRegular" color = "textTertiary" sx = { { ... VERTICAL_CENTER_TEXT } } >
123137 { formatNumber ( notionalValueUsd , { unit : 'dollar' , abbreviate : true } ) }
124138 </ Typography >
125139 ) }
0 commit comments