fix dropdowns path searcha nd replace

This commit is contained in:
Pascal Fischer
2023-05-23 21:01:55 +02:00
parent 1062925d4d
commit dfb5282eb5

View File

@@ -138,7 +138,7 @@ function NavigationGroup({ group, className, tableOfContents }) {
let router = useRouter() let router = useRouter()
let isActiveGroup = let isActiveGroup =
group.links.findIndex((link) => link.href === router.pathname) !== -1 group.links.findIndex((link) => link.href === router.pathname.replace("ipa", "api")) !== -1
return ( return (
<li className={clsx('relative mt-6', className)}> <li className={clsx('relative mt-6', className)}>
@@ -151,7 +151,7 @@ function NavigationGroup({ group, className, tableOfContents }) {
<div className="relative mt-3 pl-2"> <div className="relative mt-3 pl-2">
<AnimatePresence > <AnimatePresence >
{isActiveGroup && ( {isActiveGroup && (
<VisibleSectionHighlight group={group} pathname={router.pathname} /> <VisibleSectionHighlight group={group} pathname={router.pathname.replace("ipa", "api")} />
)} )}
</AnimatePresence> </AnimatePresence>
<motion.div <motion.div
@@ -160,17 +160,17 @@ function NavigationGroup({ group, className, tableOfContents }) {
/> />
<AnimatePresence initial={false}> <AnimatePresence initial={false}>
{isActiveGroup && ( {isActiveGroup && (
<ActivePageMarker group={group} pathname={router.pathname} /> <ActivePageMarker group={group} pathname={router.pathname.replace("ipa", "api")} />
)} )}
</AnimatePresence> </AnimatePresence>
<ul role="list" className="border-l border-transparent"> <ul role="list" className="border-l border-transparent">
{group.links.map((link) => ( {group.links.map((link) => (
<motion.li key={link.href} layout="position" className="relative"> <motion.li key={link.href} layout="position" className="relative">
<NavLink href={link.href} active={link.href === router.pathname}> <NavLink href={link.href} active={link.href === router.pathname.replace("ipa", "api")}>
{link.title} {link.title}
</NavLink> </NavLink>
<AnimatePresence mode="popLayout" initial={false}> <AnimatePresence mode="popLayout" initial={false}>
{link.href === router.pathname && ( {link.href === router.pathname.replace("ipa", "api") && (
<motion.ul <motion.ul
role="list" role="list"
initial={{ opacity: 0 }} initial={{ opacity: 0 }}