Skip to content

Redesign Navbar Dropdown - Responsive and Styled with TailwindCSS #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"ajv-keywords": "^3.5.2",
"clsx": "^2.0.0",
"lint": "^0.8.19",
"lucide-react": "^0.517.0",
"prism-react-renderer": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -52,20 +53,20 @@
"devDependencies": {
"@docusaurus/plugin-client-redirects": "^3.2.1",
"@tailwindcss/typography": "^0.5.0",
"autoprefixer": "^10.4.0",
"autoprefixer": "^10.4.21",
"docusaurus": "^1.14.7",
"docusaurus-tailwindcss-loader": "file:plugins/docusaurus-tailwindcss-loader",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.23.2",
"husky": "^6.0.0",
"lint-staged": "^11.1.2",
"postcss": "^8.4.4",
"postcss": "^8.5.6",
"postcss-import": "^14.0.2",
"postcss-preset-env": "^7.4.1",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.4",
"rimraf": "^6.0.1",
"tailwindcss": "^3.0.1"
"tailwindcss": "^3.4.17"
},
"engines": {
"node": ">=18.0"
Expand Down
29 changes: 24 additions & 5 deletions src/theme/NavbarItem/DropdownNavbarItem.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
import React from "react";
import {useLocation} from "@docusaurus/router";
import { useLocation } from "@docusaurus/router";
import DropdownNavbarItem from "@theme-original/NavbarItem/DropdownNavbarItem";

export default function DropdownNavbarItemWrapper(props) {
const {search, hash} = useLocation();
const { search, hash } = useLocation();

// Update the first item's link dynamically
props.items[0].to = `/server/installation/${search}${hash}`;

return (
<>
<DropdownNavbarItem {...props} />
</>
<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>
);
}