Commit 80edf5a0 authored by lynn's avatar lynn Committed by GitHub

fix: follow custom design for token selector scrollbar (#5952)

* fix

* remove unused styled component

* update snapshot

* disable scroll on larger currency search modal

* update snapshot
parent 96f69291
...@@ -105,6 +105,10 @@ exports[`renders currency rows correctly when currencies list is non-empty 1`] = ...@@ -105,6 +105,10 @@ exports[`renders currency rows correctly when currencies list is non-empty 1`] =
} }
<div <div
style="padding-right: 8px; padding-top: 8px;"
>
<div
class="CurrencyList_scrollbarStyle__1pi21y70"
style="position: relative; height: 10px; width: 100%; overflow: auto; will-change: transform; direction: ltr;" style="position: relative; height: 10px; width: 100%; overflow: auto; will-change: transform; direction: ltr;"
> >
<div <div
...@@ -337,6 +341,7 @@ exports[`renders currency rows correctly when currencies list is non-empty 1`] = ...@@ -337,6 +341,7 @@ exports[`renders currency rows correctly when currencies list is non-empty 1`] =
</div> </div>
</div> </div>
</div> </div>
</div>
</DocumentFragment> </DocumentFragment>
`; `;
...@@ -383,6 +388,10 @@ exports[`renders loading rows when isLoading is true 1`] = ` ...@@ -383,6 +388,10 @@ exports[`renders loading rows when isLoading is true 1`] = `
} }
<div <div
style="padding-right: 8px; padding-top: 8px;"
>
<div
class="CurrencyList_scrollbarStyle__1pi21y70"
style="position: relative; height: 10px; width: 100%; overflow: auto; will-change: transform; direction: ltr;" style="position: relative; height: 10px; width: 100%; overflow: auto; will-change: transform; direction: ltr;"
> >
<div <div
...@@ -411,5 +420,6 @@ exports[`renders loading rows when isLoading is true 1`] = ` ...@@ -411,5 +420,6 @@ exports[`renders loading rows when isLoading is true 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</DocumentFragment> </DocumentFragment>
`; `;
import { style } from '@vanilla-extract/css'
import { themeVars } from 'nft/css/sprinkles.css'
export const scrollbarStyle = style([
{
scrollbarWidth: 'thin',
scrollbarColor: `${themeVars.colors.backgroundOutline} transparent`,
height: '100%',
selectors: {
'&::-webkit-scrollbar': {
background: 'transparent',
width: '4px',
},
'&::-webkit-scrollbar-thumb': {
background: `${themeVars.colors.backgroundOutline}`,
borderRadius: '8px',
},
},
},
])
...@@ -20,6 +20,7 @@ import CurrencyLogo from '../../Logo/CurrencyLogo' ...@@ -20,6 +20,7 @@ import CurrencyLogo from '../../Logo/CurrencyLogo'
import Row, { RowFixed } from '../../Row' import Row, { RowFixed } from '../../Row'
import { MouseoverTooltip } from '../../Tooltip' import { MouseoverTooltip } from '../../Tooltip'
import { LoadingRows, MenuItem } from '../styleds' import { LoadingRows, MenuItem } from '../styleds'
import * as styles from './index.css'
function currencyKey(currency: Currency): string { function currencyKey(currency: Currency): string {
return currency.isToken ? currency.address : 'ETHER' return currency.isToken ? currency.address : 'ETHER'
...@@ -288,12 +289,23 @@ export default function CurrencyList({ ...@@ -288,12 +289,23 @@ export default function CurrencyList({
return currencyKey(currency) return currencyKey(currency)
}, []) }, [])
return isLoading ? ( return (
<FixedSizeList height={height} ref={fixedListRef as any} width="100%" itemData={[]} itemCount={10} itemSize={56}> <div style={{ paddingRight: '8px', paddingTop: '8px' }}>
{isLoading ? (
<FixedSizeList
className={styles.scrollbarStyle}
height={height}
ref={fixedListRef as any}
width="100%"
itemData={[]}
itemCount={10}
itemSize={56}
>
{LoadingRow} {LoadingRow}
</FixedSizeList> </FixedSizeList>
) : ( ) : (
<FixedSizeList <FixedSizeList
className={styles.scrollbarStyle}
height={height} height={height}
ref={fixedListRef as any} ref={fixedListRef as any}
width="100%" width="100%"
...@@ -304,5 +316,7 @@ export default function CurrencyList({ ...@@ -304,5 +316,7 @@ export default function CurrencyList({
> >
{Row} {Row}
</FixedSizeList> </FixedSizeList>
)}
</div>
) )
} }
...@@ -32,6 +32,7 @@ import { PaddedColumn, SearchInput, Separator } from './styleds' ...@@ -32,6 +32,7 @@ import { PaddedColumn, SearchInput, Separator } from './styleds'
const ContentWrapper = styled(Column)` const ContentWrapper = styled(Column)`
background-color: ${({ theme }) => theme.backgroundSurface}; background-color: ${({ theme }) => theme.backgroundSurface};
width: 100%; width: 100%;
overflow: hidden;
flex: 1 1; flex: 1 1;
position: relative; position: relative;
` `
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment