Skip to content

Commit d7a3d11

Browse files
committed
fix(v3-uplift): align the delegation rows to the label's first line
The radio and the amount both centred against the whole label, so on the combined AAVE + stkAAVE + aAAVE row — the only one that wraps — they sat between its two lines. The amount takes align="flex-start". The radio needs more than that: switching FormControlLabel to flex-start puts the radio's box top at the label's top, but the control is 36px (an 18px icon inside SwitchBase's unconditional 9px padding, which size="small" does not shrink once the theme substitutes a fixed icon) against a 20px text line, so the glyph would sit 8px low. The label carries that 8px as a top margin instead, which centres the first line on the glyph. The single-token rows render identically — centring a 20px label in a 36px box already put its top at 8px. Also stops the wrap splitting a token from its icon. The icon, the label and the "+" were three sibling flex items, so each was its own break opportunity and aAAVE's icon stayed behind on the first line. Each icon+label pair is now one item; the "+" still breaks freely.
1 parent f3c10a1 commit d7a3d11

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

src/components/transactions/GovDelegation/DelegationTokenSelector.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DelegationType } from '@aave/contract-helpers';
2-
import { FormControlLabel, Radio, RadioGroup, Typography } from '@mui/material';
2+
import { Box, FormControlLabel, Radio, RadioGroup, Typography } from '@mui/material';
33
import FormControl from '@mui/material/FormControl';
44
import { Fragment, useEffect } from 'react';
55
import { FormattedNumber } from 'src/components/primitives/FormattedNumber';
@@ -43,16 +43,19 @@ export const TokenRow: React.FC<TokenRowProps> = ({ symbol, amount }) => {
4343

4444
return (
4545
<Row
46+
align="flex-start"
4647
sx={{ width: '100%' }}
4748
captionSx={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 2 }}
4849
caption={symbols.map((token, index) => (
4950
<Fragment key={token}>
50-
<TokenIcon
51-
aToken={token === 'aAAVE'}
52-
symbol={token === 'aAAVE' ? 'aave' : token}
53-
sx={{ width: 16, height: 16 }}
54-
/>
55-
<Typography variant="subheader1">{token}</Typography>
51+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
52+
<TokenIcon
53+
aToken={token === 'aAAVE'}
54+
symbol={token === 'aAAVE' ? 'aave' : token}
55+
sx={{ width: 16, height: 16 }}
56+
/>
57+
<Typography variant="subheader1">{token}</Typography>
58+
</Box>
5659
{index < symbols.length - 1 && <Typography variant="subheader1">+</Typography>}
5760
</Fragment>
5861
))}
@@ -106,8 +109,8 @@ export const DelegationTokenSelector = ({
106109
setDelegationTokenType(Number(e.target.value) as unknown as DelegationTokenType)
107110
}
108111
sx={{
109-
'& .MuiFormControlLabel-root': { mr: 0 },
110-
'& .MuiFormControlLabel-label': { width: '100%', minWidth: 0 },
112+
'& .MuiFormControlLabel-root': { mr: 0, alignItems: 'flex-start' },
113+
'& .MuiFormControlLabel-label': { width: '100%', minWidth: 0, mt: '0.5rem' },
111114
}}
112115
>
113116
<FormControlLabel

0 commit comments

Comments
 (0)