Skip to content

Commit

Permalink
update styles for account list
Browse files Browse the repository at this point in the history
  • Loading branch information
TopETH committed Apr 23, 2024
1 parent 4508f20 commit a9943cd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/components/Header/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
}

.listWrapper {
border-radius: 100px;
width: 240px;
display: flex;
flex-direction: column;
width: 15rem;
gap: 0;
}

.accountsWrapper {
Expand All @@ -36,6 +38,7 @@
.accountsList {
max-height: 300px;
overflow-y: auto;
padding-bottom: 0;
}

.accountsList::-webkit-scrollbar {
Expand Down
34 changes: 28 additions & 6 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,32 @@ export const Header = () => {
borderBottom: `1px solid ${theme.palette.divider}`,
}}
>
<div className={styles.menu}>
<Box className={styles.menu}>
{activeAccount ? (
<List component='div' className={styles.listWrapper}>
{!accountsOpen && (
<ListItemButton
onClick={() => openAccounts(true)}
sx={{ justifyContent: 'space-between' }}
sx={{
justifyContent: 'space-between',
background: theme.palette.background.default,
borderRadius: 4,
}}
>
{activeAccount.name}
<ExpandMore />
</ListItemButton>
)}

<Collapse in={accountsOpen} className={styles.accountsWrapper}>
<Collapse
in={accountsOpen}
sx={{
position: 'absolute',
borderRadius: '0.5rem',
top: 0,
width: '100%',
}}
>
<List component='div' className={styles.accountsList}>
{accounts?.map(
(account, index) =>
Expand All @@ -61,14 +73,24 @@ export const Header = () => {
setActiveAccount && setActiveAccount(account);
openAccounts(false);
}}
sx={{
borderRadius: '0.5rem',
background: theme.palette.grey['100'],
}}
>
{account.name}
</ListItemButton>
)
)}
</List>
<Divider />
<ListItemButton onClick={onDisconnect}>
<Divider sx={{ borderColor: theme.palette.common.white }} />
<ListItemButton
onClick={onDisconnect}
sx={{
borderRadius: '0.5rem',
background: theme.palette.grey['100'],
}}
>
Disconnect
</ListItemButton>
</Collapse>
Expand All @@ -82,7 +104,7 @@ export const Header = () => {
Connect Wallet
</Button>
)}
</div>
</Box>
</Box>
<WalletModal
open={walletModalOpen}
Expand Down

0 comments on commit a9943cd

Please sign in to comment.