Skip to content

Commit 001f345

Browse files
committed
fix scroll on tokens
1 parent 5e1a741 commit 001f345

File tree

1 file changed

+47
-45
lines changed

1 file changed

+47
-45
lines changed

src/components/swap/components/select-token-modal.tsx

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -41,52 +41,54 @@ export const SelectTokenModal = (props: SelectTokenModalProps) => {
4141
return (
4242
<Dialog onClose={onClose} open={isOpen} className='relative z-50'>
4343
<DialogBackdrop className='bg-ic-black fixed inset-0 bg-opacity-60 backdrop-blur' />
44-
<div className='fixed inset-0 flex w-screen justify-center overflow-scroll p-4'>
45-
<DialogPanel
46-
className={clsx(
47-
'border-ic-gray-100 dark:border-ic-gray-950 bg-ic-white text-ic-black dark:text-ic-white mx-0 my-4 w-full max-w-sm overflow-scroll rounded-xl border-2 p-0 dark:bg-[#18181b]',
48-
isDarkMode ? 'dark' : '',
49-
)}
50-
>
51-
<DialogTitle className='text-ic-black dark:text-ic-white px-6 py-4 text-xl font-semibold'>
52-
Select a token
53-
</DialogTitle>
54-
<div className='px-0 py-4'>
55-
{showBalances && (
56-
<div className='flex w-full justify-end pr-4'>
57-
<span className='text-ic-black dark:text-ic-white text-sm font-medium'>
58-
Quantity Owned
59-
</span>
60-
</div>
44+
<div className='fixed inset-0 w-screen overflow-y-auto p-4'>
45+
<div className='flex min-h-full items-center justify-center'>
46+
<DialogPanel
47+
className={clsx(
48+
'border-ic-gray-100 dark:border-ic-gray-950 bg-ic-white text-ic-black dark:text-ic-white mx-0 my-4 w-full max-w-sm overflow-scroll rounded-xl border-2 p-0 dark:bg-[#18181b]',
49+
isDarkMode ? 'dark' : '',
6150
)}
62-
{tokens.length > 0 &&
63-
tokens.map((token) => {
64-
const tokenBalance = balances.find((bal) =>
65-
isSameAddress(
66-
bal.token,
67-
getAddressForToken(token.symbol, chainId) ?? '',
68-
),
69-
)
70-
const balanceDisplay = formatAmountFromWei(
71-
tokenBalance?.value ?? BigInt(0),
72-
token.decimals,
73-
3,
74-
)
75-
return (
76-
<TokenItem
77-
balance={showBalances ? balanceDisplay : ''}
78-
key={token.symbol}
79-
extraTitle={undefined}
80-
item={token}
81-
showNetwork={props.showNetworks}
82-
onClick={() =>
83-
onSelectedToken(token.symbol, token.chainId ?? 1)
84-
}
85-
/>
86-
)
87-
})}
88-
</div>
89-
</DialogPanel>
51+
>
52+
<DialogTitle className='text-ic-black dark:text-ic-white px-6 py-4 text-xl font-semibold'>
53+
Select a token
54+
</DialogTitle>
55+
<div className='px-0 py-4'>
56+
{showBalances && (
57+
<div className='flex w-full justify-end pr-4'>
58+
<span className='text-ic-black dark:text-ic-white text-sm font-medium'>
59+
Quantity Owned
60+
</span>
61+
</div>
62+
)}
63+
{tokens.length > 0 &&
64+
tokens.map((token) => {
65+
const tokenBalance = balances.find((bal) =>
66+
isSameAddress(
67+
bal.token,
68+
getAddressForToken(token.symbol, chainId) ?? '',
69+
),
70+
)
71+
const balanceDisplay = formatAmountFromWei(
72+
tokenBalance?.value ?? BigInt(0),
73+
token.decimals,
74+
3,
75+
)
76+
return (
77+
<TokenItem
78+
balance={showBalances ? balanceDisplay : ''}
79+
key={token.symbol}
80+
extraTitle={undefined}
81+
item={token}
82+
showNetwork={props.showNetworks}
83+
onClick={() =>
84+
onSelectedToken(token.symbol, token.chainId ?? 1)
85+
}
86+
/>
87+
)
88+
})}
89+
</div>
90+
</DialogPanel>
91+
</div>
9092
</div>
9193
</Dialog>
9294
)

0 commit comments

Comments
 (0)