Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Scrollbar styles (#2421)
Browse files Browse the repository at this point in the history
  • Loading branch information
alongoni authored Feb 21, 2022
1 parent e4364cb commit 6dc3d57
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 13 deletions.
17 changes: 16 additions & 1 deletion src/custom/components/SearchModal/CommonBases/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const AutoColumn = styled(AutoColumnUni)`

export const MobileWrapper = styled(AutoColumn)`
${({ theme }) => theme.mediaWidth.upToSmall`
isplay: none;
/* isplay: none; */
`};
`

Expand All @@ -45,6 +45,21 @@ export const CommonBasesRow = styled(AutoRow)`
overflow-x: scroll;
padding: 0 100px 0 0;
position: relative;
scrollbar-color: ${({ theme }) => theme.scrollbarThumb} ${({ theme }) => theme.scrollbarBg};
scroll-behavior: smooth;
&::-webkit-scrollbar {
height: 10px;
background: ${({ theme }) => theme.scrollbarBg};
border-radius: 10px;
}
&::-webkit-scrollbar-thumb {
background: ${({ theme }) => theme.scrollbarThumb};
border: 3px solid transparent;
border-radius: 10px;
background-clip: padding-box;
}
`}
`

Expand Down
42 changes: 31 additions & 11 deletions src/custom/components/SearchModal/CurrencyList/CurrencyListMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ export const TokenListLogoWrapper = styled.img`
height: 20px;
`

export const StyledScrollarea = styled.div`
div:first-of-type {
overflow-y: auto;
scrollbar-color: ${({ theme }) => `${theme.card.border} ${theme.card.background2}`};
scroll-behavior: smooth;
&::-webkit-scrollbar {
width: 10px;
background: ${({ theme }) => `${theme.card.background2}`} !important;
}
&::-webkit-scrollbar-thumb {
background: ${({ theme }) => `${theme.card.border}`} !important;
border: 3px solid transparent;
border-radius: 14px;
background-clip: padding-box;
}
`

function TokenTags({ currency }: { currency: Currency }) {
if (!(currency instanceof WrappedTokenInfo)) {
return <span />
Expand Down Expand Up @@ -299,16 +317,18 @@ export default function CurrencyList({
}, [])

return (
<FixedSizeList
height={height}
ref={fixedListRef as any}
width="100%"
itemData={itemData}
itemCount={itemData.length}
itemSize={56}
itemKey={itemKey}
>
{Row}
</FixedSizeList>
<StyledScrollarea>
<FixedSizeList
height={height}
ref={fixedListRef as any}
width="100%"
itemData={itemData}
itemCount={itemData.length}
itemSize={56}
itemKey={itemKey}
>
{Row}
</FixedSizeList>
</StyledScrollarea>
)
}
15 changes: 14 additions & 1 deletion src/custom/components/SearchModal/ManageLists/ManageListsMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,21 @@ ListRowProps & { listUrl: string }) {
export const ListContainer = styled.div`
padding: 1rem;
height: 100%;
overflow: auto;
padding-bottom: 80px;
overflow-y: auto;
scrollbar-color: ${({ theme }) => `${theme.card.border} ${theme.card.background2}`};
scroll-behavior: smooth;
&::-webkit-scrollbar {
width: 10px;
background: ${({ theme }) => `${theme.card.background2}`} !important;
}
&::-webkit-scrollbar-thumb {
background: ${({ theme }) => `${theme.card.border}`} !important;
border: 3px solid transparent;
border-radius: 14px;
background-clip: padding-box;
}
`

export function ManageLists({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ const Wrapper = styled.div`
display: flex; /* MOD */
flex-flow: column nowrap; /* MOD */
overflow-y: auto; /* MOD */
scrollbar-color: ${({ theme }) => `${theme.card.border} ${theme.card.background2}`};
scroll-behavior: smooth;
&::-webkit-scrollbar {
width: 14px;
background: ${({ theme }) => `${theme.card.background2}`};
}
&::-webkit-scrollbar-thumb {
background: ${({ theme }) => `${theme.card.border}`};
border: 3px solid transparent;
border-radius: 14px;
background-clip: padding-box;
}
&::-webkit-resizer,
&::-webkit-scrollbar-button,
&::-webkit-scrollbar-corner {
height: 6px;
}
`
const Section = styled(AutoColumn)<{ inline?: boolean }>`
padding: ${({ inline }) => (inline ? '0' : '0')};
Expand Down
17 changes: 17 additions & 0 deletions src/custom/theme/baseTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export function colors(darkMode: boolean): Colors {
textLink: darkMode ? '#ffffff' : '#AE2C00',
shimmer1: darkMode ? 'rgb(22 56 97 / 20%)' : 'rgb(175 203 218 / 20%)',
shimmer2: darkMode ? 'rgb(22 56 97 / 50%)' : 'rgb(175 203 218 / 40%)',
scrollbarBg: darkMode ? '#01182a' : '#d5e8f0',
scrollbarThumb: darkMode ? '#152c3e' : '#adc2ce',

// table styles
tableHeadBG: darkMode ? '#021E34' : 'rgb(2 30 52 / 15%)',
Expand All @@ -115,6 +117,7 @@ export function themeVariables(darkMode: boolean, colorsTheme: Colors) {
: 'linear-gradient(180deg,rgba(164, 211, 227, 1) 5%, rgba(255, 255, 255, 1) 40%)'};
background-attachment: fixed;
backdrop-filter: blur(40px);
scrollbar-color: ${colorsTheme.scrollbarThumb} ${colorsTheme.scrollbarBg};
`,
},
logo: {
Expand Down Expand Up @@ -335,6 +338,20 @@ export const UniThemedGlobalStyle = css`
1,
theme.bg1
)} 100%)`};
scrollbar-color: ${({ theme }) => `${theme.card.border} ${theme.card.background2}`};
scroll-behavior: smooth;
&::-webkit-scrollbar {
width: 14px;
background: ${({ theme }) => `${theme.card.background2}`};
}
&::-webkit-scrollbar-thumb {
background: ${({ theme }) => `${theme.card.border}`};
border: 3px solid transparent;
border-radius: 14px;
background-clip: padding-box;
}
}
`

Expand Down
2 changes: 2 additions & 0 deletions src/custom/theme/styled.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export interface Colors extends ColorsUniswap {
disabled: Color
shimmer1: Color
shimmer2: color
scrollbarBg: Color
scrollbarThumb: Color
tableHeadBG: Color
tableRowBG: Color
info: Color
Expand Down

0 comments on commit 6dc3d57

Please sign in to comment.