doctor-mail/apps/web/src/components/layout/main/Header.tsx

53 lines
2.0 KiB
TypeScript
Raw Normal View History

2025-01-22 19:24:52 +08:00
import { Link, NavLink } from "react-router-dom";
import { memo } from "react";
import { SearchBar } from "./SearchBar";
2025-01-22 23:19:58 +08:00
import Navigation from "./navigation";
2025-01-23 23:59:49 +08:00
import { useAuth } from "@web/src/providers/auth-provider";
2025-01-24 17:37:51 +08:00
import { UserOutlined } from "@ant-design/icons";
import { UserMenu } from "../element/usermenu";
import { Logo } from "../element/Logo";
2025-01-22 19:24:52 +08:00
interface HeaderProps {
onSearch?: (query: string) => void;
}
export const Header = memo(function Header({ onSearch }: HeaderProps) {
2025-01-23 23:59:49 +08:00
const { isAuthenticated } = useAuth()
2025-01-22 19:24:52 +08:00
return (
<header className="sticky top-0 z-50 bg-[#13294B] text-white shadow-lg">
<div className="container mx-auto px-4">
2025-01-23 23:59:49 +08:00
<div className="py-3">
<div className="flex items-center justify-between gap-4">
2025-01-22 19:24:52 +08:00
<Logo />
2025-01-23 23:59:49 +08:00
<div className="flex-grow max-w-2xl">
<SearchBar onSearch={onSearch} />
</div>
<div className="flex items-center gap-6">
{
!isAuthenticated ? <Link
to="/auth"
className="group flex items-center gap-2 rounded-lg
bg-[#00539B]/90 px-5 py-2.5 font-medium
shadow-lg transition-all duration-300
hover:-translate-y-0.5 hover:bg-[#0063B8]
hover:shadow-xl hover:shadow-[#00539B]/30
focus:outline-none focus:ring-2
focus:ring-[#8EADD4] focus:ring-offset-2
focus:ring-offset-[#13294B]"
aria-label="Login"
>
2025-01-24 17:37:51 +08:00
<UserOutlined className="h-5 w-5 transition-transform
group-hover:scale-110 group-hover:rotate-12"></UserOutlined>
<span></span>
2025-01-23 23:59:49 +08:00
</Link> : <UserMenu />
}
2025-01-22 19:24:52 +08:00
</div>
</div>
</div>
2025-01-23 23:59:49 +08:00
<Navigation />
2025-01-22 19:24:52 +08:00
</div>
</header>
);
2025-01-23 23:59:49 +08:00
});