docs(website): sidebar mobile

This commit is contained in:
moklick
2020-10-05 18:42:51 +02:00
parent 2b0ac017c3
commit 7c460dcf9d
48 changed files with 211 additions and 326 deletions
+23
View File
@@ -0,0 +1,23 @@
import { useState, useEffect } from 'react';
const getInnerHeight = () => {
return typeof window !== 'undefined' ? window.innerHeight : 0;
};
export default function useMenuHeight() {
const [menuHeight, setMenuHeight] = useState(getInnerHeight());
useEffect(() => {
const onResize = () => {
setMenuHeight(getInnerHeight());
};
window.addEventListener('resize', onResize);
return () => {
window.removeEventListener('resize', onResize);
};
});
return menuHeight;
}