This commit is contained in:
hu xiaotong
2025-04-17 17:17:56 +08:00
parent 16eed5ff46
commit 2847df6340
9 changed files with 275 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
import React, { useState } from "react";
import { Link, useLocation } from "react-router-dom";
interface NavbarProps {
onLoginClick: () => void;
@@ -6,6 +7,7 @@ interface NavbarProps {
const Navbar: React.FC<NavbarProps> = ({ onLoginClick }) => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
const location = useLocation();
return (
<nav className="fixed top-0 left-0 right-0 z-50 bg-[#1A1412]/95 backdrop-blur-md border-b border-[#C17F59]/30">
@@ -13,48 +15,72 @@ const Navbar: React.FC<NavbarProps> = ({ onLoginClick }) => {
<div className="flex items-center justify-between h-16">
<div className="flex items-center">
<div className="flex-shrink-0">
<span className="text-2xl font-bold text-[#E6B17E]">
<Link to="/" className="text-2xl font-bold text-[#E6B17E]">
</span>
</Link>
</div>
<div className="hidden md:block ml-10">
<div className="flex items-baseline space-x-4">
<a
href="#"
className="px-3 py-2 rounded-md text-sm font-medium text-[#E6B17E] bg-[#2A211E] hover:bg-[#3A2E2A] !rounded-button whitespace-nowrap cursor-pointer"
<Link
to="/"
className={`px-3 py-2 rounded-md text-sm font-medium ${
location.pathname === "/"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="px-3 py-2 rounded-md text-sm font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/characters"
className={`px-3 py-2 rounded-md text-sm font-medium ${
location.pathname === "/characters"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="px-3 py-2 rounded-md text-sm font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/builds"
className={`px-3 py-2 rounded-md text-sm font-medium ${
location.pathname === "/builds"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="px-3 py-2 rounded-md text-sm font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/battles"
className={`px-3 py-2 rounded-md text-sm font-medium ${
location.pathname === "/battles"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="px-3 py-2 rounded-md text-sm font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/news"
className={`px-3 py-2 rounded-md text-sm font-medium ${
location.pathname === "/news"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="px-3 py-2 rounded-md text-sm font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/community"
className={`px-3 py-2 rounded-md text-sm font-medium ${
location.pathname === "/community"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
</Link>
</div>
</div>
</div>
@@ -81,42 +107,66 @@ const Navbar: React.FC<NavbarProps> = ({ onLoginClick }) => {
{isMenuOpen && (
<div className="md:hidden bg-[#1A1412] border-t border-[#C17F59]/30">
<div className="px-2 pt-2 pb-3 space-y-1 sm:px-3">
<a
href="#"
className="block px-3 py-2 rounded-md text-base font-medium text-[#E6B17E] bg-[#2A211E] !rounded-button whitespace-nowrap cursor-pointer"
<Link
to="/"
className={`block px-3 py-2 rounded-md text-base font-medium ${
location.pathname === "/"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="block px-3 py-2 rounded-md text-base font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/characters"
className={`block px-3 py-2 rounded-md text-base font-medium ${
location.pathname === "/characters"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="block px-3 py-2 rounded-md text-base font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/builds"
className={`block px-3 py-2 rounded-md text-base font-medium ${
location.pathname === "/builds"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="block px-3 py-2 rounded-md text-base font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/battles"
className={`block px-3 py-2 rounded-md text-base font-medium ${
location.pathname === "/battles"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="block px-3 py-2 rounded-md text-base font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/news"
className={`block px-3 py-2 rounded-md text-base font-medium ${
location.pathname === "/news"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
<a
href="#"
className="block px-3 py-2 rounded-md text-base font-medium text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E] !rounded-button whitespace-nowrap cursor-pointer"
</Link>
<Link
to="/community"
className={`block px-3 py-2 rounded-md text-base font-medium ${
location.pathname === "/community"
? "text-[#E6B17E] bg-[#2A211E]"
: "text-[#C17F59] hover:bg-[#2A211E] hover:text-[#E6B17E]"
} !rounded-button whitespace-nowrap cursor-pointer`}
>
</a>
</Link>
<button
onClick={onLoginClick}
className="block w-full text-left px-3 py-2 rounded-md text-base font-medium text-[#1A1412] bg-[#E6B17E] hover:bg-[#C17F59] !rounded-button whitespace-nowrap cursor-pointer transition-colors duration-200"