2024-02-23 15:32:20 +00:00
|
|
|
import { useRouter } from 'next/router'
|
|
|
|
import DesktopHeader from './desktop/header'
|
|
|
|
import MobileHeader from './mobile/header'
|
|
|
|
import StickyBar from './sticky-bar'
|
2024-12-10 01:06:46 +00:00
|
|
|
import { PriceCarouselProvider } from './price-carousel'
|
2024-02-23 15:32:20 +00:00
|
|
|
|
|
|
|
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 (
|
2024-12-10 01:06:46 +00:00
|
|
|
<PriceCarouselProvider>
|
2024-02-23 15:32:20 +00:00
|
|
|
<DesktopHeader {...props} />
|
|
|
|
<MobileHeader {...props} />
|
|
|
|
<StickyBar {...props} />
|
2024-12-10 01:06:46 +00:00
|
|
|
</PriceCarouselProvider>
|
2024-02-23 15:32:20 +00:00
|
|
|
)
|
|
|
|
}
|