Skip to content

Commit

Permalink
Merge pull request #536 from entur/fix/fix-menu-mobile-when-few-items
Browse files Browse the repository at this point in the history
Gjør at bunnmenyen forblir synlig på mobil ved innlasting
  • Loading branch information
magnusrand authored Nov 22, 2021
2 parents a3dcaab + 490f89f commit ea1b431
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/containers/DashboardWrapper/BottomMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function BottomMenu({ className }: Props): JSX.Element {
const user = useUser()
const width = useWindowWidth()
const [settings] = useSettingsContext()
const [menuHiddenByScroll, setMenuHiddenByScroll] = useState(true)
const [menuHiddenByScroll, setMenuHiddenByScroll] = useState(false)
const [isMobileWidth, setIsMobileWidth] = useState<boolean>(
document.body.clientWidth <= 900,
)
Expand Down Expand Up @@ -134,10 +134,8 @@ function BottomMenu({ className }: Props): JSX.Element {
}, [width])

useEffect(() => {
if (menuRef.current) {
isMobileWidth
? menuRef.current.classList.add('hidden-menu')
: menuRef.current.classList.remove('hidden-menu')
if (menuRef.current && !isMobileWidth) {
menuRef.current.classList.remove('hidden-menu')
}
}, [isMobileWidth])

Expand Down

0 comments on commit ea1b431

Please sign in to comment.