diff --git a/frontend/src/components/generic/IconButton/index.js b/frontend/src/components/generic/IconButton/index.js index 3f910ab47..82bee9e49 100644 --- a/frontend/src/components/generic/IconButton/index.js +++ b/frontend/src/components/generic/IconButton/index.js @@ -1,87 +1,42 @@ import React from 'react' import { IconButton as MuiButton, CircularProgress } from '@mui/material' -import clsx from 'clsx' +import { styled } from '@mui/material/styles' -const baseStyles = strong => ({ - 'rounded-md px-4 py-1.5 text-base tracking-wide leading-tight': true, - 'font-bold uppercase': strong, - 'font-normal normal-case': !strong, -}) +const baseStyles = () => { + return { + boxSizing: 'border-box', + boxShadow: 'none', + '&:focus': { + boxShadow: 'none', + }, + outline: 'none', + } +} -const variantStyles = (variant, color) => { +const variantStyles = (theme, variant, color) => { + const colorPalette = theme.palette[color] switch (variant) { - case 'contained': - return { - 'bg-current text-white border-2 border-current hover:bg-current': true, - [`bg-${color}-600 border-${color}-600 hover:bg-${color}-700`]: true, - 'disabled:bg-current disabled:text-white disabled:opacity-50': true, - [`disabled:bg-${color}-700`]: true, - } - case 'containedNew': - return { - 'text-current underline uppercase text-center': true, - 'hover:no-underline': true, - [`text-${color}-600`]: true, - 'disabled:bg-transparent disabled:opacity-50': true, - } - case 'applicationsClosed': - return { - 'text-current mt-6 uppercase text-lg text-center': true, - [`text-${color}-600`]: true, - 'hover:no-underline': true, - 'disabled:bg-transparent disabled:opacity-50': true, - } - case 'containedCard': - return { - 'bg-current text-white rounded-tl-lg rounded-br-lg uppercase text-sm opacity-75 hover:opacity-100': true, - [`bg-${color}-600`]: true, - 'disabled:bg-transparent disabled:opacity-100': true, - } - case 'outlined': - return { - 'bg-transparent text-current border-2': true, - [`text-${color}-600 border-${color}-800`]: true, - } - case 'outlinedNew': - return { - 'bg-transparent text-current border-2 rounded-full h-12 w-52 mt-6': true, - [`text-${color}-600 border-${color}-800`]: true, - } - case 'contained-large': - return { - 'bg-current text-white border-2 border-current h-12 text-2xl': true, - [`bg-${color}-600 border-${color}-600 hover:bg-${color}-700`]: true, - 'disabled:bg-current disabled:text-white disabled:opacity-50': true, - [`disabled:bg-${color}-700`]: true, - } - case 'jOutlined': - return { - 'bg-transparent text-current border-2 rounded-full px-4 py-1': true, - [`text-${color}-600 border-${color}-800`]: true, - } - case 'jContained': - return { - 'bg-current text-white border-2 border-current rounded-md px-4 py-1': true, - [`bg-${color}-600 border-${color}-600 hover:bg-${color}-700 hover:border-${color}-700`]: true, - 'disabled:bg-current disabled:text-white disabled:opacity-50': true, - [`disabled:bg-${color}-700`]: true, - } - case 'jOutlinedBox': - return { - 'bg-current text-white border border-light rounded-md px-4 py-2 w-full': true, - [`bg-${color}-600 border-${color}-200`]: true, - } case 'roundedBlack': return { - 'bg-black text-current border-2 rounded-full px-4 py-1': true, - [`text-${color}-600 border-${color}-600 hover:text-black hover:bg-${color}-700 hover:border-${color}-700`]: true, - 'disabled:bg-current disabled:text-white disabled:opacity-50': true, - [`disabled:bg-${color}-700`]: true, + backgroundColor: 'black', + color: colorPalette.main, + border: `2px solid ${colorPalette.main}`, + borderRadius: '50%', + '&:hover': { + color: 'black', + background: colorPalette.dark, + border: `2px solid ${colorPalette.dark}`, + }, + '&.Mui-disabled': { + backgroundColor: colorPalette.dark, + color: colorPalette.contrastText, + opacity: 0.5, + }, } default: return { - 'rounded-none text-current': true, - [`text-${color}-600`]: true, + borderRadius: 0, + color: colorPalette.main, } } } @@ -92,17 +47,18 @@ const IconButton = ({ loading = false, ...props }) => { - const baseClasses = baseStyles(strong) - const variantClasses = variantStyles(props.variant, color) + const CustomIconButton = styled(MuiButton, { + // MUI IconButtons don't have variants so no point in forwarding them + shouldForwardProp: prop => prop !== 'variant', + })(({ theme }) => ({ + ...baseStyles(), + ...variantStyles(theme, props.variant, color), + })) return ( - + {loading ? : props.children} - + ) } diff --git a/frontend/src/components/layouts/SidebarLayout/index.js b/frontend/src/components/layouts/SidebarLayout/index.js index 419668577..84b84f33e 100644 --- a/frontend/src/components/layouts/SidebarLayout/index.js +++ b/frontend/src/components/layouts/SidebarLayout/index.js @@ -3,7 +3,6 @@ import { useDispatch } from 'react-redux' import { findIndex } from 'lodash-es' import { Routes, Route, Navigate, useNavigate, Link } from 'react-router-dom' -import Container from 'components/generic/Container/index' import MenuIcon from '@mui/icons-material/Menu' import LockIcon from '@mui/icons-material/Lock' import StorageIcon from '@mui/icons-material/Storage' @@ -13,13 +12,15 @@ import { Drawer, List, ListItem, + ListItemButton, ListItemIcon, ListItemText, - Hidden, Box, } from '@mui/material' +import { styled } from '@mui/material/styles' import PlatformLogo from 'assets/logos/JO_wordmark_white.png' +import Container from 'components/generic/Container/index' import IconButton from 'components/generic/IconButton' import EventsPage from 'pages/_dashboard/renderDashboard/default/events' import ProfilePage from 'pages/_account/profile' //TODO: fix the profile view @@ -27,6 +28,62 @@ import ProfilePage from 'pages/_account/profile' //TODO: fix the profile view import config from 'constants/config' import { useTranslation } from 'react-i18next' +const SIDEBAR_WIDTH = '300px' + +const Logo = styled('img')({ + height: '70px', + margin: '0 auto', + padding: '5px', + backgroundColor: 'black', +}) + +const RouteList = styled(List)({ + color: 'rgba(255,255,255,0.6)', + '& .MuiListItem-root': { + padding: 0, + }, + '& .MuiListItemButton-root': { + '&.Mui-selected': { + color: 'white', + backgroundColor: 'black', + }, + }, + '& .MuiListItemIcon-root': { + color: 'inherit', + }, +}) + +const MenuButtonBox = styled(Box, { + // This specifies which props should not get passed down to the DOM, will throw a console error if you do. + shouldForwardProp: prop => prop !== 'desktopOpen', +})(({ theme, desktopOpen }) => ({ + position: 'fixed', + top: '0.5rem', + left: '0.5rem', + zIndex: 100, // to make sure the text boxes doesn't go over the button + [theme.breakpoints.up('md')]: { + top: '0.75rem', + transition: 'all 225ms cubic-bezier(0, 0, 0.2, 1) 0ms', + left: desktopOpen ? `calc(${SIDEBAR_WIDTH} + 0.5rem)` : '0.5rem', + transform: desktopOpen ? 'rotate(-90deg)' : 'rotate(0)', + }, +})) + +const LineDivider = styled('hr')({ + margin: '2rem auto', + width: '80%', + height: '1px', +}) + +const Main = styled('main', { + shouldForwardProp: prop => prop !== 'desktopOpen', +})(({ theme, desktopOpen }) => ({ + [theme.breakpoints.up('md')]: { + marginLeft: desktopOpen ? SIDEBAR_WIDTH : 0, + }, + transition: 'margin-left 225ms cubic-bezier(0, 0, 0.2, 1) 0ms', +})) + export default React.memo( ({ topContent, @@ -111,162 +168,140 @@ export default React.memo( } const drawerContent = ( - <> - - - {config.PLATFORM_OWNER_NAME - - - {sidebarTopContent} - + + + + + {sidebarTopContent} + {routes .filter(route => !route.hidden) .map((route, index) => { return ( - - pushRoute( - route?.onClickPath || route.path, - ) - } - > - - {route.locked ? ( - - ) : ( - route.icon - )} - - + + pushRoute( + route?.onClickPath || + route.path, + ) } - /> + > + + {route.locked ? ( + + ) : ( + route.icon + )} + + + ) })} -
-
- + + { pushRoute('/events') }} > - + - - - + + + + pushRoute('/profile')} > - + - - - + + + + navigate('/logout')} > - + - - -
-
- + + + + + ) return (
- {/* + {/* Menu button for small screens */} + - - + + {/* Menu button for bigger screens */} + - + - - -
) }, diff --git a/frontend/src/components/navbars/BasicNavBar/index.js b/frontend/src/components/navbars/BasicNavBar/index.js index 9144f7cfc..37ae0e0b2 100644 --- a/frontend/src/components/navbars/BasicNavBar/index.js +++ b/frontend/src/components/navbars/BasicNavBar/index.js @@ -1,15 +1,27 @@ import React from 'react' + +import { styled } from '@mui/material/styles' + +import WavePattern from 'assets/images/nawbar_waves.svg' import UserAvatar from 'components/UserAvatar' import LanguageMenu from 'components/LanguageMenu' +const NavbarWrapper = styled('div')({ + width: '100%', + background: `url(${WavePattern})`, + backgroundColor: 'black', + display: 'flex', + alignItems: 'center', + justifyContent: 'end', + padding: '0.5rem', +}) + const BasicNavBar = () => { return ( -
-
- - -
-
+ + + + ) }