Compare commits

...

2 Commits

Author SHA1 Message Date
Gala 469b13dfd9 adding a comment 2022-11-11 08:07:05 +01:00
Gala 53da6512eb second banner version 2022-11-11 07:50:34 +01:00
3 changed files with 15 additions and 16 deletions
+5 -4
View File
@@ -33,6 +33,7 @@ export const MobileNav: React.FC<{ children: React.ReactNode }> = ({ children }:
const theme = useTheme(); const theme = useTheme();
const { navState, updateNavState } = useMainContext(); const { navState, updateNavState } = useMainContext();
const [drawerOpen, setDrawerOpen] = React.useState(false); const [drawerOpen, setDrawerOpen] = React.useState(false);
// Set maintenance banner to false by default to don't display it
const [openMaintenance, setOpenMaintenance] = React.useState(true); const [openMaintenance, setOpenMaintenance] = React.useState(true);
const toggleDrawer = () => { const toggleDrawer = () => {
@@ -53,9 +54,9 @@ export const MobileNav: React.FC<{ children: React.ReactNode }> = ({ children }:
<AppBar <AppBar
sx={{ sx={{
background: theme.palette.nym.networkExplorer.topNav.appBar, background: theme.palette.nym.networkExplorer.topNav.appBar,
borderRadius: 0,
}} }}
> >
<MaintenanceBanner open={openMaintenance} onClick={() => setOpenMaintenance(false)} />
<Toolbar <Toolbar
disableGutters disableGutters
sx={{ sx={{
@@ -155,9 +156,9 @@ export const MobileNav: React.FC<{ children: React.ReactNode }> = ({ children }:
</List> </List>
</Box> </Box>
</Drawer> </Drawer>
<Box>
<Box sx={{ width: '100%', p: 4, mt: 7 }}> <MaintenanceBanner open={openMaintenance} onClick={() => setOpenMaintenance(false)} sx={{ mt: 7 }} />
{children} <Box sx={{ width: '100%', p: 4 }}>{children}</Box>
<Footer /> <Footer />
</Box> </Box>
</Box> </Box>
+3 -5
View File
@@ -25,7 +25,6 @@ import { DarkLightSwitchDesktop } from './Switch';
import { NavOptionType } from '../context/nav'; import { NavOptionType } from '../context/nav';
const drawerWidth = 255; const drawerWidth = 255;
const bannerHeight = 113;
const openedMixin = (theme: Theme): CSSObject => ({ const openedMixin = (theme: Theme): CSSObject => ({
width: drawerWidth, width: drawerWidth,
@@ -272,7 +271,6 @@ export const Nav: React.FC = ({ children }) => {
borderRadius: 0, borderRadius: 0,
}} }}
> >
<MaintenanceBanner open={openMaintenance} onClick={() => setOpenMaintenance(false)} height={bannerHeight} />
<Toolbar <Toolbar
disableGutters disableGutters
sx={{ sx={{
@@ -337,7 +335,6 @@ export const Nav: React.FC = ({ children }) => {
style: { style: {
background: theme.palette.nym.networkExplorer.nav.background, background: theme.palette.nym.networkExplorer.nav.background,
borderRadius: 0, borderRadius: 0,
top: openMaintenance ? bannerHeight : 0,
}, },
}} }}
> >
@@ -376,8 +373,9 @@ export const Nav: React.FC = ({ children }) => {
))} ))}
</List> </List>
</Drawer> </Drawer>
<Box sx={{ width: '100%', py: 5, px: 6, mt: 7 }}> <Box sx={{ width: '100%' }}>
{children} <MaintenanceBanner open={openMaintenance} onClick={() => setOpenMaintenance(false)} sx={{ mt: 8 }} />
<Box sx={{ width: '100%', py: 5, px: 6 }}>{children}</Box>
<Footer /> <Footer />
</Box> </Box>
</Box> </Box>
@@ -1,23 +1,24 @@
import { Box, Collapse, Alert, IconButton, Typography, Divider } from '@mui/material'; import { Box, Collapse, Alert, IconButton, Typography, Divider } from '@mui/material';
import CloseIcon from '@mui/icons-material/Close'; import CloseIcon from '@mui/icons-material/Close';
import { SxProps } from '@mui/system';
export interface BannerProps { export interface BannerProps {
open: boolean; open: boolean;
onClick: () => void; onClick: () => void;
height?: number; sx?: SxProps;
} }
export const MaintenanceBanner = (props: BannerProps) => { export const MaintenanceBanner = (props: BannerProps) => {
const { open, onClick, height } = props; const { open, onClick, sx } = props;
return ( return (
<Box sx={{ width: '100%' }} id="maintenance-banner"> <Box sx={{ width: '100%', ...sx }}>
<Collapse in={open}> <Collapse in={open}>
<Alert <Alert
id="maintenance-banner" id="maintenance-banner"
action={ action={
<IconButton aria-label="close" color="inherit" size="small" onClick={onClick}> <IconButton aria-label="close" color="inherit" size="small" onClick={onClick} sx={{ paddingTop: 1 }}>
<CloseIcon fontSize="inherit" /> <CloseIcon fontSize="inherit" cursor="pointer" />
</IconButton> </IconButton>
} }
severity="success" severity="success"
@@ -27,8 +28,7 @@ export const MaintenanceBanner = (props: BannerProps) => {
backgroundColor: (t) => t.palette.nym.highlight, backgroundColor: (t) => t.palette.nym.highlight,
borderRadius: 0, borderRadius: 0,
color: (t) => t.palette.nym.networkExplorer.nav.text, color: (t) => t.palette.nym.networkExplorer.nav.text,
height: height || 'auto', alignItems: 'flex-start',
alignItems: 'center',
}} }}
> >
<Box display="flex"> <Box display="flex">