docs(website): sidebar mobile
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user