Skip to content

Commit

Permalink
#44 new window component init
Browse files Browse the repository at this point in the history
  • Loading branch information
emekauja committed Nov 4, 2022
1 parent d8db6a5 commit 56a7e41
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 24 deletions.
1 change: 1 addition & 0 deletions src/assets/styles/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const vars = {
listBorderColor: 'rgba(0, 0, 0, 0.04)',

headerBorderColor: '#E7E7E7',
dialogBorderColor: 'rgba(0, 0, 0, 0.1)',
dividerColor: 'rgba(118, 120, 125, 0.12)',

dropdownBg: 'rgba(246, 246, 248, 0.8)',
Expand Down
123 changes: 99 additions & 24 deletions src/components/common/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ import { Button, Chip, List, ListItemButton, Typography } from '@mui/material';
import PSYLOGO from '../../assets/svg/new-logo.svg';
import vars from '../../assets/styles/variables';
import { CustomBreadcrumbsWithMenu } from './Breadcrumbs';
import Dialog from '@mui/material/Dialog';
import UndoIcon from '@mui/icons-material/Undo';

const { textWhite, listSelectedTextColor, headerBorderColor } = vars;
const {
textWhite,
listSelectedTextColor,
breadcrumbTextColor,
dialogBorderColor,
headerBorderColor,
} = vars;

const useStyles = makeStyles(() => ({
root: {
Expand Down Expand Up @@ -98,32 +106,99 @@ const breadcrumbs = [

const Header = () => {
const classes = useStyles();
const [anchorEl, setAnchorEl] = React.useState(null);
const open = Boolean(anchorEl);

return (
<Box className={classes.root}>
<Box className={classes.leftSection}>
<img src={PSYLOGO} alt="new-logo" aria-describedby="logo" />
const handleClick = (event) => {
if (event) {
setAnchorEl(event.currentTarget);
}
};

<CustomBreadcrumbsWithMenu breadcrumbs={breadcrumbs} />
</Box>
<Box className={classes.middleSection}>
<List className="headerSwitch" component="nav">
<ListItemButton disableRipple selected>
<Typography>Build</Typography>
</ListItemButton>
<ListItemButton disableRipple disabled>
<Typography>Test</Typography>
<Chip label="SOON" />
</ListItemButton>
</List>
</Box>
<Box className={classes.rightSection}>
<Button disabled disableElevation variant="contained">
Share
<Chip label="SOON" color="primary" />
</Button>
const handleClose = () => {
setAnchorEl(null);
};
const id = open ? 'composition-popper' : undefined;

return (
<>
<Dialog
id={id}
open={open}
hideBackdrop
PaperProps={{
sx: {
position: 'fixed',
top: 96,
left: 60,
width: 'calc(100VW - 24.25rem)',
maxWidth: 'calc(100VW - 24.25rem)',
height: 'calc(100Vh - 11rem)',
border: `2px solid ${dialogBorderColor}`,
background: headerBorderColor,
borderRadius: '0.75rem',
m: 0,
},
}}
aria-labelledby="composition-popper"
>
<Typography>Composition 2</Typography>
</Dialog>
<Box className={classes.root}>
<Box className={classes.leftSection}>
<img src={PSYLOGO} alt="new-logo" aria-describedby="logo" />

<CustomBreadcrumbsWithMenu breadcrumbs={breadcrumbs} />
</Box>
<Box className={classes.middleSection}>
<List className="headerSwitch" component="nav">
<ListItemButton disableRipple selected>
<Typography>Build</Typography>
</ListItemButton>
<ListItemButton disableRipple disabled>
<Typography>Test</Typography>
<Chip label="SOON" />
</ListItemButton>

{/* modal button TODO remover later */}
<ListItemButton disableRipple onClick={handleClick}>
<Typography>Composition</Typography>
</ListItemButton>
</List>
</Box>
<Box className={classes.rightSection}>
<Button disabled disableElevation variant="contained">
Share
<Chip label="SOON" color="primary" />
</Button>
</Box>
</Box>
</Box>
{open && (
<Box
sx={{
position: 'absolute',
bottom: '1rem',
left: 'calc(50% - 153px/2 + 0.5px)',
zIndex: 9999,
}}
>
<Button
startIcon={<UndoIcon fontSize="small" />}
size="small"
variant="contained"
sx={{
backgroundColor: breadcrumbTextColor,
'&:hover': {
backgroundColor: listSelectedTextColor,
},
}}
onClick={handleClose}
>
Return to parent
</Button>
</Box>
)}
</>
);
};

Expand Down

0 comments on commit 56a7e41

Please sign in to comment.