26 lines
637 B
JavaScript
26 lines
637 B
JavaScript
import { useRouter } from 'next/router'
|
|
import DesktopHeader from './desktop/header'
|
|
import MobileHeader from './mobile/header'
|
|
import StickyBar from './sticky-bar'
|
|
|
|
export default function Navigation ({ sub }) {
|
|
const router = useRouter()
|
|
const path = router.asPath.split('?')[0]
|
|
const props = {
|
|
prefix: sub ? `/~${sub}` : '',
|
|
path,
|
|
pathname: router.pathname,
|
|
topNavKey: path.split('/')[sub ? 2 : 1] ?? '',
|
|
dropNavKey: path.split('/').slice(sub ? 2 : 1).join('/'),
|
|
sub
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<DesktopHeader {...props} />
|
|
<MobileHeader {...props} />
|
|
<StickyBar {...props} />
|
|
</>
|
|
)
|
|
}
|