Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the sidebar from scrolling #4766

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions examples/demo/src/layout/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SettingsIcon from '@material-ui/icons/Settings';
import LabelIcon from '@material-ui/icons/Label';
import { useMediaQuery, Theme } from '@material-ui/core';
import { useTranslate, DashboardMenuItem, MenuItemLink } from 'react-admin';
import { makeStyles } from '@material-ui/core/styles';

import visitors from '../visitors';
import orders from '../orders';
Expand All @@ -22,6 +23,14 @@ interface Props {
onMenuClick: () => void;
}

const useStyles = makeStyles({
sidebarIsFixed: {
position: 'fixed',
top: '4em',
zIndex: 100,
},
});

const Menu: FC<Props> = ({ onMenuClick, dense, logout }) => {
const [state, setState] = useState({
menuCatalog: false,
Expand All @@ -38,9 +47,9 @@ const Menu: FC<Props> = ({ onMenuClick, dense, logout }) => {
const handleToggle = (menu: MenuName) => {
setState(state => ({ ...state, [menu]: !state[menu] }));
};

const classes = useStyles();
return (
<div>
<div className={classes.sidebarIsFixed}>
{' '}
<DashboardMenuItem onClick={onMenuClick} sidebarIsOpen={open} />
<SubMenu
Expand Down