diff --git a/frontend/packages/app/src/App.tsx b/frontend/packages/app/src/App.tsx index 3e52d6ca2b..036a52b2e1 100644 --- a/frontend/packages/app/src/App.tsx +++ b/frontend/packages/app/src/App.tsx @@ -36,7 +36,7 @@ const useStyles = makeStyles(theme => ({ root: { display: 'grid', // FIXME: Don't used a fixed width here - gridTemplateColumns: '224px auto', + gridTemplateColumns: '64px auto', gridTemplateRows: 'auto 1fr', width: '100%', height: '100vh', diff --git a/frontend/packages/app/src/components/SideBar/SideBar.tsx b/frontend/packages/app/src/components/SideBar/SideBar.tsx index 4bf19afcf1..395ae45410 100644 --- a/frontend/packages/app/src/components/SideBar/SideBar.tsx +++ b/frontend/packages/app/src/components/SideBar/SideBar.tsx @@ -1,60 +1,221 @@ -import Avatar from '@material-ui/core/Avatar'; -import Grid from '@material-ui/core/Grid'; -import Link from '@material-ui/core/Link'; -import List from '@material-ui/core/List'; -import ListItem from '@material-ui/core/ListItem'; -import ListItemText from '@material-ui/core/ListItemText'; -import { makeStyles } from '@material-ui/core/styles'; -import Typography from '@material-ui/core/Typography'; -import React, { FC } from 'react'; +import React, { FC, useState, createContext, useContext } from 'react'; +import clsx from 'clsx'; +import { + makeStyles, + SvgIcon, + Typography, + Link, + styled, +} from '@material-ui/core'; + +import HomeIcon from '@material-ui/icons/Home'; +import ServiceIcon from '@material-ui/icons/DeviceHub'; +import WebIcon from '@material-ui/icons/Language'; +import LibIcon from '@material-ui/icons/LocalLibrary'; +import CreateIcon from '@material-ui/icons/AddCircleOutline'; + +const drawerWidthClosed = 64; +const drawerWidthOpen = 220; + +const Context = createContext(false); + +const useSidebarItemStyles = makeStyles({ + root: { + color: '#b5b5b5', + display: 'flex', + flexFlow: 'row nowrap', + alignItems: 'center', + height: 40, + cursor: 'pointer', + }, + closed: { + width: drawerWidthClosed, + justifyContent: 'center', + }, + open: { + width: drawerWidthOpen, + }, + iconContainer: { + height: '100%', + width: drawerWidthClosed, + marginRight: -16, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + }, +}); + +type SidebarItemProps = { + icon: typeof SvgIcon; + text: string; + to?: string; + onClick?: () => void; +}; + +const SidebarItem: FC = ({ + icon: Icon, + text, + to, + onClick, +}) => { + const classes = useSidebarItemStyles(); + const open = useContext(Context); + + if (!open) { + return ( + + + + ); + } + + return ( + +
+ +
+ {text} + + ); +}; + +const useSidebarLogoStyles = makeStyles({ + root: { + height: drawerWidthClosed, + color: '#fff', + display: 'flex', + flexFlow: 'row nowrap', + alignItems: 'center', + }, + logoContainer: { + width: drawerWidthClosed, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + }, + logo: { + fontSize: 32, + }, + title: { + fontSize: 24, + fontWeight: 'bold', + marginLeft: 22, + whiteSpace: 'nowrap', + }, + titleDot: { + color: '#1DB954', + }, +}); + +const SidebarLogo: FC<{}> = () => { + const classes = useSidebarLogoStyles(); + const open = useContext(Context); + + return ( +
+ + {open ? 'Backstage' : 'B'} + . + +
+ ); +}; + +const Space = styled('div')({ + flex: 1, +}); + +const Spacer = styled('div')({ + height: 8, +}); + +const Divider = styled('hr')({ + height: 1, + width: '100%', + background: '#383838', + border: 'none', +}); const useStyles = makeStyles(theme => ({ root: { - background: '#181818', - color: 'white', + zIndex: 1000, + position: 'relative', + overflow: 'visible', + width: theme.spacing(7) + 1, height: '100vh', - paddingLeft: theme.spacing(2), - paddingTop: theme.spacing(2), + }, + drawer: { + display: 'flex', + flexFlow: 'column nowrap', + alignItems: 'flex-start', + position: 'absolute', + left: 0, + top: 0, + bottom: 0, + padding: 0, + background: '#171717', + overflowX: 'hidden', + width: drawerWidthClosed, + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.shortest, + }), + }, + drawerOpen: { + width: drawerWidthOpen, + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.shorter, + }), }, })); const SideBar: FC<{}> = () => { const classes = useStyles(); + const [open, setOpen] = useState(false); + + const handleOpen = () => { + setOpen(true); + }; + + const handleClose = () => { + setOpen(false); + }; return ( -
- - [Co-brand Logo] - - - - - - - - - - - - - - - - - - - - - A - - $userName - +
+ +
+ + + + + + + + + + + +
+
); }; diff --git a/frontend/packages/core/src/layout/Header/Header.js b/frontend/packages/core/src/layout/Header/Header.js index f78e43ee76..5ddb7865e4 100644 --- a/frontend/packages/core/src/layout/Header/Header.js +++ b/frontend/packages/core/src/layout/Header/Header.js @@ -26,9 +26,9 @@ class Header extends Component { return typeLink ? ( // - {type} - // + {type} ) : ( + // {type} ); } @@ -69,12 +69,17 @@ class Header extends Component { const { title, pageTitleOverride, children, style, classes } = this.props; const pageTitle = pageTitleOverride || title; if (typeof pageTitle !== 'string') { - console.warn('
title prop is not a string, pageTitleOverride should be provided.'); + console.warn( + '
title prop is not a string, pageTitleOverride should be provided.', + ); } return ( - + {theme => (
@@ -98,7 +103,7 @@ const styles = theme => ({ gridArea: 'pageHeader', padding: theme.spacing(3), minHeight: 118, - width: 'calc(100vw - 224px)', + width: '100vw', boxShadow: '0 0 8px 3px rgba(20, 20, 20, 0.3)', position: 'relative', zIndex: 100, @@ -117,6 +122,7 @@ const styles = theme => ({ flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', + marginRight: theme.spacing(6), }, title: { color: theme.palette.bursts.fontColor,