2023-10-17 11:57:27 +03:00
|
|
|
import Link from "next/link";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { AiFillStar } from "react-icons/ai";
|
|
|
|
import { LuChevronRight } from "react-icons/lu";
|
|
|
|
|
2023-10-20 16:38:35 +03:00
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
|
2023-10-17 11:57:27 +03:00
|
|
|
import { PopoverMenuMobile } from "./components/PopoverMenuMobile";
|
|
|
|
import { QuivrLogo } from "./components/QuivrLogo";
|
2023-10-24 13:12:16 +03:00
|
|
|
import { NavbarItem } from "./types";
|
2023-10-17 11:57:27 +03:00
|
|
|
|
2023-10-20 16:38:35 +03:00
|
|
|
type HomeNavProps = {
|
|
|
|
color?: "white" | "black";
|
|
|
|
};
|
|
|
|
|
|
|
|
export const HomeHeader = ({ color = "white" }: HomeNavProps): JSX.Element => {
|
2023-10-17 11:57:27 +03:00
|
|
|
const { t } = useTranslation("home");
|
2023-10-20 16:38:35 +03:00
|
|
|
const linkStyle = {
|
|
|
|
white: "text-white hover:text-slate-200",
|
|
|
|
black: "text-black",
|
|
|
|
};
|
2023-10-17 11:57:27 +03:00
|
|
|
|
2023-10-24 13:12:16 +03:00
|
|
|
const navItems: NavbarItem[] = [
|
|
|
|
{
|
|
|
|
href: "https://theodo.co.uk",
|
|
|
|
label: `${t("sponsored_by")} Theodo`,
|
|
|
|
rightIcon: null,
|
|
|
|
newTab: true,
|
|
|
|
className: "underline",
|
|
|
|
},
|
2023-10-17 11:57:27 +03:00
|
|
|
{
|
|
|
|
href: "https://github.com/StanGirard/quivr",
|
|
|
|
label: t("star_us"),
|
|
|
|
leftIcon: <AiFillStar size={16} className="hidden md:inline" />,
|
2023-10-24 13:12:16 +03:00
|
|
|
rightIcon: null,
|
2023-10-17 11:57:27 +03:00
|
|
|
},
|
2023-10-24 13:12:16 +03:00
|
|
|
{ href: "/blog", label: t("blog"), rightIcon: null, newTab: true },
|
2023-10-17 11:57:27 +03:00
|
|
|
{ href: "/signup", label: t("sign_up") },
|
|
|
|
{ href: "/login", label: t("sign_in") },
|
|
|
|
];
|
|
|
|
|
2023-10-20 16:38:35 +03:00
|
|
|
const navLinks = (device: "mobile" | "desktop") =>
|
2023-10-24 13:12:16 +03:00
|
|
|
navItems.map(
|
|
|
|
({ href, label, leftIcon, rightIcon, newTab = false, className }) => (
|
|
|
|
<li key={label}>
|
|
|
|
<Link
|
|
|
|
href={href}
|
|
|
|
{...(newTab && { target: "_blank", rel: "noopener noreferrer" })}
|
|
|
|
className={cn(
|
|
|
|
"flex justify-between items-center hover:text-primary p-2 gap-1",
|
|
|
|
device === "desktop" ? linkStyle[color] : null,
|
|
|
|
className
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
{leftIcon}
|
|
|
|
{label}
|
|
|
|
{rightIcon !== null && (rightIcon ?? <LuChevronRight size={16} />)}
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
)
|
|
|
|
);
|
2023-10-20 16:38:35 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<header className="w-screen flex justify-between items-center p-5 min-w-max md:max-w-6xl m-auto">
|
2023-10-17 11:57:27 +03:00
|
|
|
<Link
|
2023-10-20 16:38:35 +03:00
|
|
|
href="/"
|
|
|
|
className={cn(
|
|
|
|
"text-3xl flex gap-2 items-center",
|
|
|
|
linkStyle[color],
|
|
|
|
color === "black" ? "hover:text-black" : "hover:text-white"
|
|
|
|
)}
|
2023-10-17 11:57:27 +03:00
|
|
|
>
|
2023-10-20 16:38:35 +03:00
|
|
|
<QuivrLogo size={64} color={color} />
|
|
|
|
<div>Quivr</div>
|
2023-10-17 11:57:27 +03:00
|
|
|
</Link>
|
2023-10-20 16:38:35 +03:00
|
|
|
<div className="hidden md:flex">
|
|
|
|
<ul className="flex gap-4 items-center">{navLinks("desktop")}</ul>
|
|
|
|
</div>
|
|
|
|
<div className="md:hidden z-10">
|
|
|
|
<PopoverMenuMobile navLinks={navLinks("mobile")} color={color} />
|
|
|
|
</div>
|
|
|
|
</header>
|
2023-10-17 11:57:27 +03:00
|
|
|
);
|
|
|
|
};
|