@mui/material#Hidden JavaScript Examples
The following examples show how to use
@mui/material#Hidden.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Drawer.js From admin-web with GNU Affero General Public License v3.0 | 6 votes |
function ResponsiveDrawer(props) {
const { classes, domains, expanded } = props;
return (
<nav className={classes.drawer} aria-label="navigation">
<Hidden mdUp implementation="css">
<Drawer
variant="temporary"
anchor={"left"}
open={expanded}
onClose={props.toggleExpansion}
classes={{
paper: classes.drawerPaper,
}}
ModalProps={{
keepMounted: true, // Better open performance on mobile.
}}
>
<NavigationLinks domains={domains}/>
</Drawer>
</Hidden>
<Hidden lgDown implementation="css">
<Drawer
classes={{
paper: classes.drawerPaper,
}}
variant="permanent"
open
>
<NavigationLinks domains={domains}/>
</Drawer>
</Hidden>
</nav>
);
}
Example #2
Source File: Breadcrumb.jsx From matx-react with MIT License | 6 votes |
Breadcrumb = ({ routeSegments }) => {
const theme = useTheme();
const hint = theme.palette.text.hint;
return (
<BreadcrumbRoot>
{routeSegments ? (
<Hidden xsDown>
<BreadcrumbName>{routeSegments[routeSegments.length - 1]['name']}</BreadcrumbName>
<Separator>|</Separator>
</Hidden>
) : null}
<Breadcrumbs
separator={<Icon sx={{ color: hint }}>navigate_next</Icon>}
sx={{ display: 'flex', alignItems: 'center', position: 'relative' }}
>
<NavLink to="/">
<StyledIcon color="primary">home</StyledIcon>
</NavLink>
{routeSegments
? routeSegments.map((route, index) => {
return index !== routeSegments.length - 1 ? (
<NavLink key={index} to={route.path}>
<SubName>{route.name}</SubName>
</NavLink>
) : (
<SubName key={index}>{route.name}</SubName>
);
})
: null}
</Breadcrumbs>
</BreadcrumbRoot>
);
}
Example #3
Source File: HeadSection.js From react-saas-template with MIT License | 5 votes |
function HeadSection(props) {
const { classes, theme } = props;
const isWidthUpLg = useMediaQuery(theme.breakpoints.up("lg"));
return (
<Fragment>
<div className={classNames("lg-p-top", classes.wrapper)}>
<div className={classNames("container-fluid", classes.container)}>
<Box display="flex" justifyContent="center" className="row">
<Card
className={classes.card}
data-aos-delay="200"
data-aos="zoom-in"
>
<div className={classNames(classes.containerFix, "container")}>
<Box justifyContent="space-between" className="row">
<Grid item xs={12} md={5}>
<Box
display="flex"
flexDirection="column"
justifyContent="space-between"
height="100%"
>
<Box mb={4}>
<Typography variant={isWidthUpLg ? "h3" : "h4"}>
Free Template for building a SaaS app using
Material-UI
</Typography>
</Box>
<div>
<Box mb={2}>
<Typography
variant={isWidthUpLg ? "h6" : "body1"}
color="textSecondary"
>
Lorem ipsum dolor sit amet, consetetur sadipscing
elitr, sed diam nonumy eirmod tempor invidunt
</Typography>
</Box>
<Button
variant="contained"
color="secondary"
fullWidth
className={classes.extraLargeButton}
classes={{ label: classes.extraLargeButtonLabel }}
href="https://github.com/dunky11/react-saas-template"
>
Download from GitHub
</Button>
</div>
</Box>
</Grid>
<Hidden mdDown>
<Grid item md={6}>
<ZoomImage
src={`${process.env.PUBLIC_URL}/images/logged_out/headerImage.jpg`}
className={classes.image}
alt="header example"
/>
</Grid>
</Hidden>
</Box>
</div>
</Card>
</Box>
</div>
</div>
<WaveBorder
upperColor={theme.palette.secondary.main}
lowerColor="#FFFFFF"
className={classes.waveBorder}
animationNegativeDelay={2}
/>
</Fragment>
);
}
Example #4
Source File: Layout1Sidenav.jsx From matx-react with MIT License | 5 votes |
Layout1Sidenav = () => {
const theme = useTheme();
const { settings, updateSettings } = useSettings();
const leftSidebar = settings.layout1Settings.leftSidebar;
const { mode, bgImgURL } = leftSidebar;
const getSidenavWidth = () => {
switch (mode) {
case 'compact':
return sidenavCompactWidth;
default:
return sideNavWidth;
}
};
const primaryRGB = convertHexToRGB(theme.palette.primary.main);
const updateSidebarMode = (sidebarSettings) => {
updateSettings({
layout1Settings: {
leftSidebar: {
...sidebarSettings,
},
},
});
};
const handleSidenavToggle = () => {
updateSidebarMode({ mode: mode === 'compact' ? 'full' : 'compact' });
};
return (
<SidebarNavRoot bgImgURL={bgImgURL} primaryBg={primaryRGB} width={getSidenavWidth()}>
<NavListBox>
<Brand>
<Hidden smDown>
<Switch
onChange={handleSidenavToggle}
checked={leftSidebar.mode !== 'full'}
color="secondary"
size="small"
/>
</Hidden>
</Brand>
<Sidenav />
</NavListBox>
</SidebarNavRoot>
);
}
Example #5
Source File: RowCards.jsx From matx-react with MIT License | 5 votes |
RowCards = () => {
const { palette } = useTheme();
const textMuted = palette.text.secondary;
return [1, 2, 3, 4].map((id) => (
<Fragment key={id}>
<Card sx={{ py: 1, px: 2 }} className="project-card">
<Grid container alignItems="center">
<Grid item md={5} xs={7}>
<Box display="flex" alignItems="center">
<Checkbox />
<Hidden smDown>
{id % 2 === 1 ? (
<StarOutline size="small">
<Icon>star_outline</Icon>
</StarOutline>
) : (
<DateRange size="small">
<Icon>date_range</Icon>
</DateRange>
)}
</Hidden>
<ProjectName>Project {id}</ProjectName>
</Box>
</Grid>
<Grid item md={3} xs={4}>
<Box color={textMuted}>{format(new Date().getTime(), 'MM/dd/yyyy hh:mma')}</Box>
</Grid>
<Hidden smDown>
<Grid item xs={3}>
<Box display="flex" position="relative" marginLeft="-0.875rem !important">
<StyledAvatar src="/assets/images/face-4.jpg" />
<StyledAvatar src="/assets/images/face-4.jpg" />
<StyledAvatar src="/assets/images/face-4.jpg" />
<StyledAvatar sx={{ fontSize: '14px' }}>+3</StyledAvatar>
</Box>
</Grid>
</Hidden>
<Grid item xs={1}>
<Box display="flex" justifyContent="flex-end">
<IconButton>
<Icon>more_vert</Icon>
</IconButton>
</Box>
</Grid>
</Grid>
</Card>
<Box py={1} />
</Fragment>
));
}
Example #6
Source File: NavBar.js From react-saas-template with MIT License | 4 votes |
function NavBar(props) {
const { selectedTab, messages, classes, openAddBalanceDialog, theme } = props;
// Will be use to make website more accessible by screen readers
const links = useRef([]);
const [isMobileOpen, setIsMobileOpen] = useState(false);
const [isSideDrawerOpen, setIsSideDrawerOpen] = useState(false);
const isWidthUpSm = useMediaQuery(theme.breakpoints.up("sm"));
const openMobileDrawer = useCallback(() => {
setIsMobileOpen(true);
}, [setIsMobileOpen]);
const closeMobileDrawer = useCallback(() => {
setIsMobileOpen(false);
}, [setIsMobileOpen]);
const openDrawer = useCallback(() => {
setIsSideDrawerOpen(true);
}, [setIsSideDrawerOpen]);
const closeDrawer = useCallback(() => {
setIsSideDrawerOpen(false);
}, [setIsSideDrawerOpen]);
const menuItems = [
{
link: "/c/dashboard",
name: "Dashboard",
onClick: closeMobileDrawer,
icon: {
desktop: (
<DashboardIcon
className={
selectedTab === "Dashboard" ? classes.textPrimary : "text-white"
}
fontSize="small"
/>
),
mobile: <DashboardIcon className="text-white" />,
},
},
{
link: "/c/posts",
name: "Posts",
onClick: closeMobileDrawer,
icon: {
desktop: (
<ImageIcon
className={
selectedTab === "Posts" ? classes.textPrimary : "text-white"
}
fontSize="small"
/>
),
mobile: <ImageIcon className="text-white" />,
},
},
{
link: "/c/subscription",
name: "Subscription",
onClick: closeMobileDrawer,
icon: {
desktop: (
<AccountBalanceIcon
className={
selectedTab === "Subscription"
? classes.textPrimary
: "text-white"
}
fontSize="small"
/>
),
mobile: <AccountBalanceIcon className="text-white" />,
},
},
{
link: "/",
name: "Logout",
icon: {
desktop: (
<PowerSettingsNewIcon className="text-white" fontSize="small" />
),
mobile: <PowerSettingsNewIcon className="text-white" />,
},
},
];
return (
<Fragment>
<AppBar position="sticky" className={classes.appBar}>
<Toolbar className={classes.appBarToolbar}>
<Box display="flex" alignItems="center">
<Hidden smUp>
<Box mr={1}>
<IconButton
aria-label="Open Navigation"
onClick={openMobileDrawer}
color="primary"
size="large"
>
<MenuIcon />
</IconButton>
</Box>
</Hidden>
<Hidden smDown>
<Typography
variant="h4"
className={classes.brandText}
display="inline"
color="primary"
>
Wa
</Typography>
<Typography
variant="h4"
className={classes.brandText}
display="inline"
color="secondary"
>
Ver
</Typography>
</Hidden>
</Box>
<Box
display="flex"
justifyContent="flex-end"
alignItems="center"
width="100%"
>
{isWidthUpSm && (
<Box mr={3}>
<Balance
balance={2573}
openAddBalanceDialog={openAddBalanceDialog}
/>
</Box>
)}
<MessagePopperButton messages={messages} />
<ListItem
disableGutters
className={classNames(classes.iconListItem, classes.smBordered)}
>
<Avatar
alt="profile picture"
src={`${process.env.PUBLIC_URL}/images/logged_in/profilePicture.jpg`}
className={classNames(classes.accountAvatar)}
/>
{isWidthUpSm && (
<ListItemText
className={classes.username}
primary={
<Typography color="textPrimary">Username</Typography>
}
/>
)}
</ListItem>
</Box>
<IconButton
onClick={openDrawer}
color="primary"
aria-label="Open Sidedrawer"
size="large"
>
<SupervisorAccountIcon />
</IconButton>
<SideDrawer open={isSideDrawerOpen} onClose={closeDrawer} />
</Toolbar>
</AppBar>
<Hidden smDown>
<Drawer // both drawers can be combined into one for performance
variant="permanent"
classes={{
paper: classes.drawerPaper,
}}
open={false}
>
<List>
{menuItems.map((element, index) => (
<Link
to={element.link}
className={classes.menuLink}
onClick={element.onClick}
key={index}
ref={(node) => {
links.current[index] = node;
}}
>
<Tooltip
title={element.name}
placement="right"
key={element.name}
>
<ListItem
selected={selectedTab === element.name}
button
divider={index !== menuItems.length - 1}
className={classes.permanentDrawerListItem}
onClick={() => {
links.current[index].click();
}}
aria-label={
element.name === "Logout"
? "Logout"
: `Go to ${element.name}`
}
>
<ListItemIcon className={classes.justifyCenter}>
{element.icon.desktop}
</ListItemIcon>
</ListItem>
</Tooltip>
</Link>
))}
</List>
</Drawer>
</Hidden>
<NavigationDrawer
menuItems={menuItems.map((element) => ({
link: element.link,
name: element.name,
icon: element.icon.mobile,
onClick: element.onClick,
}))}
anchor="left"
open={isMobileOpen}
selectedItem={selectedTab}
onClose={closeMobileDrawer}
/>
</Fragment>
);
}
Example #7
Source File: Footer.js From react-saas-template with MIT License | 4 votes |
function Footer(props) {
const { classes, theme } = props;
const isWidthUpMd = useMediaQuery(theme.breakpoints.up("md"));
return (
<footer className="lg-p-top">
<WaveBorder
upperColor="#FFFFFF"
lowerColor={theme.palette.common.darkBlack}
animationNegativeDelay={4}
/>
<div className={classes.footerInner}>
<Grid container spacing={isWidthUpMd ? 10 : 5}>
<Grid item xs={12} md={6} lg={4}>
<form>
<Box display="flex" flexDirection="column">
<Box mb={1}>
<TextField
variant="outlined"
multiline
placeholder="Get in touch with us"
InputProps={{
className: classes.whiteBg,
"aria-label": "Get in Touch",
}}
rows={4}
fullWidth
required
/>
</Box>
<ColoredButton
color={theme.palette.common.white}
variant="outlined"
type="submit"
>
Send Message
</ColoredButton>
</Box>
</form>
</Grid>
<Hidden lgDown>
<Grid item xs={12} md={6} lg={4}>
<Box display="flex" justifyContent="center">
<div>
{infos.map((info, index) => (
<Box display="flex" mb={1} key={index}>
<Box mr={2}>
<IconButton
className={classes.infoIcon}
tabIndex={-1}
disabled
size="large"
>
{info.icon}
</IconButton>
</Box>
<Box
display="flex"
flexDirection="column"
justifyContent="center"
>
<Typography variant="h6" className="text-white">
{info.description}
</Typography>
</Box>
</Box>
))}
</div>
</Box>
</Grid>
</Hidden>
<Grid item xs={12} md={6} lg={4}>
<Typography variant="h6" paragraph className="text-white">
About the Company
</Typography>
<Typography style={{ color: "#8f9296" }} paragraph>
Lorem ipsum dolor sit amet, consectateur adispicing elit. Fusce
euismod convallis velit, eu auctor lacus vehicula sit amet.
</Typography>
<Box display="flex">
{socialIcons.map((socialIcon, index) => (
<Box key={index} mr={index !== socialIcons.length - 1 ? 1 : 0}>
<IconButton
aria-label={socialIcon.label}
className={classes.socialIcon}
href={socialIcon.href}
size="large"
>
{socialIcon.icon}
</IconButton>
</Box>
))}
</Box>
</Grid>
</Grid>
</div>
</footer>
);
}
Example #8
Source File: NavBar.js From react-saas-template with MIT License | 4 votes |
function NavBar(props) {
const {
classes,
openRegisterDialog,
openLoginDialog,
handleMobileDrawerOpen,
handleMobileDrawerClose,
mobileDrawerOpen,
selectedTab
} = props;
const menuItems = [
{
link: "/",
name: "Home",
icon: <HomeIcon className="text-white" />
},
{
link: "/blog",
name: "Blog",
icon: <BookIcon className="text-white" />
},
{
name: "Register",
onClick: openRegisterDialog,
icon: <HowToRegIcon className="text-white" />
},
{
name: "Login",
onClick: openLoginDialog,
icon: <LockOpenIcon className="text-white" />
}
];
return (
<div className={classes.root}>
<AppBar position="fixed" className={classes.appBar}>
<Toolbar className={classes.toolbar}>
<div>
<Typography
variant="h4"
className={classes.brandText}
display="inline"
color="primary"
>
Wa
</Typography>
<Typography
variant="h4"
className={classes.brandText}
display="inline"
color="secondary"
>
Ver
</Typography>
</div>
<div>
<Hidden mdUp>
<IconButton
className={classes.menuButton}
onClick={handleMobileDrawerOpen}
aria-label="Open Navigation"
size="large">
<MenuIcon color="primary" />
</IconButton>
</Hidden>
<Hidden mdDown>
{menuItems.map(element => {
if (element.link) {
return (
<Link
key={element.name}
to={element.link}
className={classes.noDecoration}
onClick={handleMobileDrawerClose}
>
<Button
color="secondary"
size="large"
classes={{ text: classes.menuButtonText }}
>
{element.name}
</Button>
</Link>
);
}
return (
<Button
color="secondary"
size="large"
onClick={element.onClick}
classes={{ text: classes.menuButtonText }}
key={element.name}
>
{element.name}
</Button>
);
})}
</Hidden>
</div>
</Toolbar>
</AppBar>
<NavigationDrawer
menuItems={menuItems}
anchor="right"
open={mobileDrawerOpen}
selectedItem={selectedTab}
onClose={handleMobileDrawerClose}
/>
</div>
);
}
Example #9
Source File: TopBar.js From admin-web with GNU Affero General Public License v3.0 | 4 votes |
render() {
const { classes, t, profile, title, onAdd, fetching, settings, license } = this.props;
const { menuAnchorEl } = this.state;
const licenseVisible = this.context.includes(SYSTEM_ADMIN_WRITE);
return (
<AppBar position="fixed" className={classes.root}>
<Toolbar className={classes.root}>
<Hidden lgUp>
<IconButton color="inherit" onClick={this.handleMenuToggle} size="large">
<Burger />
</IconButton>
</Hidden>
{this.links.map((link, idx) =>
<Tooltip
placement="bottom"
title={t(link.title) + (!config[link.key] ? ` (${t("Not configured")})` : '')} key={idx}
>
<span>
<IconButton
href={config[link.key]}
disabled={!config[link.key]}
target="_blank"
className={classes.iconButton}
size="large">
<link.icon />
</IconButton>
</span>
</Tooltip>
)}
{title && <Typography className={classes.title} variant="h6">{title}</Typography>}
<div className={classes.flexEndContainer}>
<Box className={classes.profileButton} onClick={this.handleMenuOpen('menuAnchorEl')}>
<Typography className={classes.username}>{profile.Profile.user.username}</Typography>
<AccountCircleIcon className={classes.profileIcon}></AccountCircleIcon>
</Box>
{licenseVisible && <LicenseIcon
activated={license.product && license.product !== "Community"}
handleNavigation={this.handleNavigation}
/>}
<img
src={settings.language === 'en-US' ? german : english}
alt=""
width={35}
height={44}
className={classes.flag}
onClick={this.handleLangChange}
/>
<Menu
id="simple-menu"
anchorEl={menuAnchorEl}
keepMounted
open={Boolean(menuAnchorEl)}
onClose={this.handleMenuClose('menuAnchorEl')}
>
<MenuItem onClick={this.handleNavigation('settings')}>
{t('Settings')}
</MenuItem>
<MenuItem onClick={this.handleNavigation('changePassword')}>
{t('Change password')}
</MenuItem>
<MenuItem onClick={this.handleLogout}>
{t('Logout')}
</MenuItem>
</Menu>
</div>
{onAdd && <div className={classes.divider}></div>}
{onAdd && <Button onClick={onAdd} color="inherit" className={classes.add}>
<Add />{t('Add')}
</Button>}
</Toolbar>
<Fade
in={fetching}
style={{
transitionDelay: '500ms',
}}
>
<LinearProgress variant="indeterminate" color="primary"/>
</Fade>
</AppBar>
);
}
Example #10
Source File: Layout1Topbar.jsx From matx-react with MIT License | 4 votes |
Layout1Topbar = () => {
const theme = useTheme();
const { settings, updateSettings } = useSettings();
const { logout, user } = useAuth();
const isMdScreen = useMediaQuery(theme.breakpoints.down('md'));
const updateSidebarMode = (sidebarSettings) => {
updateSettings({
layout1Settings: { leftSidebar: { ...sidebarSettings } },
});
};
const handleSidebarToggle = () => {
let { layout1Settings } = settings;
let mode;
if (isMdScreen) {
mode = layout1Settings.leftSidebar.mode === 'close' ? 'mobile' : 'close';
} else {
mode = layout1Settings.leftSidebar.mode === 'full' ? 'close' : 'full';
}
updateSidebarMode({ mode });
};
return (
<TopbarRoot>
<TopbarContainer>
<Box display="flex">
<StyledIconButton onClick={handleSidebarToggle}>
<Icon>menu</Icon>
</StyledIconButton>
<IconBox>
<StyledIconButton>
<Icon>mail_outline</Icon>
</StyledIconButton>
<StyledIconButton>
<Icon>web_asset</Icon>
</StyledIconButton>
<StyledIconButton>
<Icon>star_outline</Icon>
</StyledIconButton>
</IconBox>
</Box>
<Box display="flex" alignItems="center">
<MatxSearchBox />
<NotificationProvider>
<NotificationBar />
</NotificationProvider>
<ShoppingCart />
<MatxMenu
menuButton={
<UserMenu>
<Hidden xsDown>
<Span>
Hi <strong>{user.name}</strong>
</Span>
</Hidden>
<Avatar src={user.avatar} sx={{ cursor: 'pointer' }} />
</UserMenu>
}
>
<StyledItem>
<Link to="/">
<Icon> home </Icon>
<Span> Home </Span>
</Link>
</StyledItem>
<StyledItem>
<Link to="/page-layouts/user-profile">
<Icon> person </Icon>
<Span> Profile </Span>
</Link>
</StyledItem>
<StyledItem>
<Icon> settings </Icon>
<Span> Settings </Span>
</StyledItem>
<StyledItem onClick={logout}>
<Icon> power_settings_new </Icon>
<Span> Logout </Span>
</StyledItem>
</MatxMenu>
</Box>
</TopbarContainer>
</TopbarRoot>
);
}