Skip to content

Commit f563179

Browse files
committed
Do not open menu on small screens
1 parent 8bcf5d2 commit f563179

File tree

1 file changed

+4
-1
lines changed
  • packages/react-renderer-demo/src/app/src/components

1 file changed

+4
-1
lines changed

packages/react-renderer-demo/src/app/src/components/layout.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const useStyles = makeStyles((theme) => ({
131131
const Layout = ({ children }) => {
132132
const router = useRouter();
133133
const classes = useStyles();
134-
const [open, setOpen] = useState(router.pathname !== '/');
134+
const [open, setOpen] = useState(false);
135135
const [links, setLinks] = useState({});
136136
const searchRef = useRef(null);
137137
const anchorRef = useRef(null);
@@ -140,6 +140,9 @@ const Layout = ({ children }) => {
140140

141141
useEffect(() => {
142142
setLinks(findConnectedLinks(router.asPath, flatSchema) || {});
143+
if (window && window.innerWidth > 960 && router.pathname !== '/') {
144+
setOpen(true);
145+
}
143146
}, [router.asPath]);
144147

145148
const handleDrawerOpen = () => {

0 commit comments

Comments
 (0)