mirror of
https://github.com/acid-info/logos-press-engine.git
synced 2025-02-22 14:18:14 +00:00
Merge pull request #132 from acid-info/mobile-menu
[#125] fix menu navigation and style issues
This commit is contained in:
commit
f16f364d51
@ -29,9 +29,7 @@ export default function NavBar({ defaultState }: NavBarProps) {
|
|||||||
const state = useNavbarState(defaultState)
|
const state = useNavbarState(defaultState)
|
||||||
const themeState = useThemeState()
|
const themeState = useThemeState()
|
||||||
const { pathname } = useRouter()
|
const { pathname } = useRouter()
|
||||||
const isSearchPage = pathname === '/search'
|
|
||||||
const [hide, setHide] = useState(false)
|
const [hide, setHide] = useState(false)
|
||||||
const scrollDirection = useScrollDirection()
|
|
||||||
const [showMobileMenu, setShowMobileMenu] = useState(false)
|
const [showMobileMenu, setShowMobileMenu] = useState(false)
|
||||||
|
|
||||||
const className = pathname.split('/')[1] + '_page'
|
const className = pathname.split('/')[1] + '_page'
|
||||||
@ -40,6 +38,10 @@ export default function NavBar({ defaultState }: NavBarProps) {
|
|||||||
setShowMobileMenu(!showMobileMenu)
|
setShowMobileMenu(!showMobileMenu)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setShowMobileMenu(false)
|
||||||
|
}, [pathname])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
defaultState && state.state.set((value) => ({ ...value, ...defaultState }))
|
defaultState && state.state.set((value) => ({ ...value, ...defaultState }))
|
||||||
}, [defaultState])
|
}, [defaultState])
|
||||||
|
@ -5,11 +5,21 @@ import { uiConfigs } from '@/configs/ui.configs'
|
|||||||
import { FooterOrgPanel } from '@/components/Footer/Footer.OrgPanel'
|
import { FooterOrgPanel } from '@/components/Footer/Footer.OrgPanel'
|
||||||
import { useThemeState } from '@/states/themeState'
|
import { useThemeState } from '@/states/themeState'
|
||||||
import { ThemeSwitchWithLabel } from '@/components/ThemeSwitch/ThemeSwitch'
|
import { ThemeSwitchWithLabel } from '@/components/ThemeSwitch/ThemeSwitch'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
interface Props {}
|
interface Props {}
|
||||||
|
|
||||||
export const NavbarMobileMenu = (props: Props) => {
|
export const NavbarMobileMenu = (props: Props) => {
|
||||||
const themeState = useThemeState()
|
const themeState = useThemeState()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window === 'undefined') return
|
||||||
|
document.documentElement.style.overflow = 'hidden'
|
||||||
|
return () => {
|
||||||
|
document.documentElement.style.overflow = 'auto'
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavbarMobileMenuContainer>
|
<NavbarMobileMenuContainer>
|
||||||
<InnerContainer>
|
<InnerContainer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user