forked from keploy/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropdownNavbarItem.js
More file actions
32 lines (29 loc) · 1.01 KB
/
DropdownNavbarItem.js
File metadata and controls
32 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from "react";
import { useLocation } from "@docusaurus/router";
import DropdownNavbarItem from "@theme-original/NavbarItem/DropdownNavbarItem";
export default function DropdownNavbarItemWrapper(props) {
const { search, hash } = useLocation();
// Update the first item's link dynamically
props.items[0].to = `/server/installation/${search}${hash}`;
return (
<div className="relative group">
<DropdownNavbarItem
{...props}
className="transition duration-300 ease-in-out text-gray-700 hover:text-keploybrightblue"
/>
<div
className="absolute left-0 mt-2 w-48 bg-white shadow-lg rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300 z-50"
>
{props.items.map((item, idx) => (
<a
key={idx}
href={item.to}
className="block px-4 py-2 text-sm text-gray-700 hover:bg-keployblue hover:text-black"
>
{item.label}
</a>
))}
</div>
</div>
);
}