Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New profile drawer merge #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
355 changes: 193 additions & 162 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import {
Avatar,
Box,
Expand All @@ -19,198 +19,229 @@ import PasswordRoundedIcon from '../images/Key.svg';
import SettingsIcon from '../images/Settings.svg';

const Navbar = ({ user, open, toggleDrawer }) => {
const [xl, set_xl] = useState(window.innerWidth >= 1200 ? true : false);
const [lg, set_lg] = useState(window.innerWidth >= 787 ? true : false);
const [sm, set_sm] = useState(window.innerWidth < 360 ? true : false);

useEffect(() => {
window.addEventListener('resize', () => {
if (window.innerWidth >= 1200) {
set_xl(true);
} else {
set_xl(false);
}

if (window.innerWidth >= 787) {
set_lg(true);
} else {
set_lg(false);
}

if (window.innerWidth < 360) {
set_sm(true);
} else {
set_sm(false);
}
});
}, []);

return (
<>
<Grid
sx={{
width: '100vw',
<div
style={{
backgroundColor: '#fff',
width: xl ? '30vw' : lg ? '45vw' : '100vw',
height: '10vh',
elevation: 30,
zIndex: 1201,
zIndex: '1201',
position: 'fixed',
top: open ? '0' : '-10vh',
transition: 'all 0.25s',
top: !lg ? (open ? '0' : '-10vh') : 0,
left: xl ? (open ? '0' : '-30vw') : lg ? (open ? '0' : '-45vw') : '0',
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
paddingLeft: '16px',
paddingRight: '16px',
transition: 'all 0.5s',
}}
container
rowSpacing={3}
>
<IconButton onClick={toggleDrawer} size="medium">
<CloseRoundedIcon style={{ color: '#000', fontSize: '28px' }} />
</IconButton>
<Typography
sx={{ width: '100%', textAlign: 'center', fontSize: '20px' }}
variant="h4"
>
Profile
</Typography>
<IconButton size="medium">
<LogoutRoundedIcon sx={{ color: '#000', fontSize: '28px' }} />
</IconButton>
</div>
<div
style={{
position: 'fixed',
left: open
? '0'
: xl
? 'calc(-30vw - 5px)'
: lg
? 'calc(-45vw - 5px)'
: 'calc(-70vw - 5px)',
top: '0',
zIndex: '3',
height: '100vh',
width: xl ? '30vw' : lg ? '45vw' : '70vw',
display: 'flex',
alignItems: 'flex-end',
flexDirection: 'column',
backgroundColor: '#fff',
paddingTop: '10vh',
paddingLeft: '24px',
transition: 'all 0.5s',
}}
>
<Grid
item
xs={2}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
<Avatar
src={user.avatar}
sx={{
width: 69,
height: 69,
}}
>
<IconButton onClick={toggleDrawer} size="large">
<CloseRoundedIcon fontSize="large" sx={{ color: '#000' }} />
</IconButton>
</Grid>
<Grid
item
xs={8}
sx={{ textAlign: 'center' }}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Typography
sx={{ width: '100%', height: '5vh', textAlign: 'center' }}
variant="h4"
>
Profile
</Typography>
</Grid>
<Grid xs={2} sx={{ paddingBottom: 1 }}>
<IconButton size="large">
<LogoutRoundedIcon fontSize="large" sx={{ color: '#000' }} />
</IconButton>
</Grid>
</Grid>
<Drawer variant="temporary" open={open} onClose={toggleDrawer}>
<Box sx={{ width: '70vw', marginTop: '10vh', paddingLeft: 7 }}>
<Avatar
src={user.avatar}
sx={{
width: 69,
height: 69,
}}
/>
<Typography variant="h4" sx={{ marginTop: 3 }}>
{user.firstName + ' ' + user.lastName}
</Typography>
<Typography variant="subtitle2">
{user.firstName.toLowerCase() + '.' + user.lastName.toLowerCase()}
@gmail.com
</Typography>
<List sx={{ marginTop: 8, marginLeft: 0, paddingLeft: 0 }}>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
sx={{ marginTop: 1 }}
/>
<Typography variant="h4" sx={{ marginTop: 3 }}>
{user.firstName + ' ' + user.lastName}
</Typography>
<Typography variant="subtitle2" sx={{ fontSize: '13px' }}>
{user.firstName.toLowerCase() + '.' + user.lastName.toLowerCase()}
@gmail.com
</Typography>
<List sx={{ marginTop: 4, marginLeft: 0, paddingLeft: 0 }}>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
sx={{ marginTop: 1 }}
style={{
display: 'flex',
alignItems: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<HistoryRoundedIcon />
</Box>
<Typography
variant="h6"
sx={{ paddingLeft: 6, fontSize: '1rem' }}
>
Transaction History
</Typography>
</Stack>
</ListItem>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
<HistoryRoundedIcon style={{ fontSize: '20px' }} />
</Box>
<Typography
variant="h6"
sx={{ paddingLeft: 4, fontSize: '16px' }}
>
Transaction History
</Typography>
</Stack>
</ListItem>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
style={{
display: 'flex',
alignItems: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<WalletRoundedIcon />
</Box>
<Typography variant="h6" sx={{ paddingLeft: 6 }}>
All Wallets
</Typography>
</Stack>
</ListItem>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
<WalletRoundedIcon style={{ fontSize: '20px' }} />
</Box>
<Typography
variant="h6"
sx={{ paddingLeft: 4, fontSize: '16px' }}
>
All Wallets
</Typography>
</Stack>
</ListItem>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
style={{
display: 'flex',
alignItems: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<PasswordRoundedIcon />
</Box>
<Typography variant="h6" sx={{ paddingLeft: 6 }}>
Change Password
</Typography>
</Stack>
</ListItem>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
<PasswordRoundedIcon style={{ fontSize: '20px' }} />
</Box>
<Typography
variant="h6"
sx={{ paddingLeft: 4, fontSize: '16px' }}
>
Change Password
</Typography>
</Stack>
</ListItem>
<ListItem sx={{ marginLeft: 0, paddingLeft: 0 }}>
<Stack
direction="row"
style={{
display: 'flex',
alignItems: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Box
sx={{
width: 43,
height: 43,
backgroundColor: '#F1F5FF',
borderRadius: '50%',
}}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<SettingsIcon />
</Box>
<Typography variant="h6" sx={{ paddingLeft: 6 }}>
Settings
</Typography>
</Stack>
</ListItem>
</List>
</Box>
</Drawer>
<SettingsIcon style={{ fontSize: '20px' }} />
</Box>
<Typography
variant="h6"
sx={{ paddingLeft: 4, fontSize: '16px' }}
>
Settings
</Typography>
</Stack>
</ListItem>
</List>
</div>
</>
);
};
Expand Down
Loading