2023-04-06 00:48:07 +02:00
|
|
|
import { ReactNode, useState } from "react";
|
2022-02-28 22:00:32 +01:00
|
|
|
import { Link } from "react-router-dom";
|
2023-04-24 17:41:54 +02:00
|
|
|
|
2022-12-13 23:50:13 +01:00
|
|
|
import { IconPatch } from "@/components/buttons/IconPatch";
|
|
|
|
import { Icons } from "@/components/Icon";
|
2023-02-24 21:45:14 +01:00
|
|
|
import { useBannerSize } from "@/hooks/useBanner";
|
2023-04-24 17:41:54 +02:00
|
|
|
import { conf } from "@/setup/config";
|
2023-04-06 00:48:07 +02:00
|
|
|
import SettingsModal from "@/views/SettingsModal";
|
2023-04-24 17:41:54 +02:00
|
|
|
|
2022-02-25 21:50:36 +01:00
|
|
|
import { BrandPill } from "./BrandPill";
|
|
|
|
|
2022-02-28 00:08:20 +01:00
|
|
|
export interface NavigationProps {
|
|
|
|
children?: ReactNode;
|
2023-01-07 21:36:18 +01:00
|
|
|
bg?: boolean;
|
2022-02-28 00:08:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function Navigation(props: NavigationProps) {
|
2023-02-24 21:45:14 +01:00
|
|
|
const bannerHeight = useBannerSize();
|
2023-04-06 00:48:07 +02:00
|
|
|
const [showModal, setShowModal] = useState(false);
|
2022-02-25 21:50:36 +01:00
|
|
|
return (
|
2023-02-24 21:45:14 +01:00
|
|
|
<div
|
|
|
|
className="fixed left-0 right-0 top-0 z-20 min-h-[150px] bg-gradient-to-b from-denim-300 via-denim-300 to-transparent sm:from-transparent"
|
|
|
|
style={{
|
|
|
|
top: `${bannerHeight}px`,
|
|
|
|
}}
|
|
|
|
>
|
2023-02-20 03:44:27 +01:00
|
|
|
<div className="fixed left-0 right-0 flex items-center justify-between py-5 px-7">
|
2023-02-20 03:42:52 +01:00
|
|
|
<div
|
|
|
|
className={`${
|
|
|
|
props.bg ? "opacity-100" : "opacity-0"
|
|
|
|
} absolute inset-0 block bg-denim-100 transition-opacity duration-300`}
|
2022-02-28 22:00:32 +01:00
|
|
|
>
|
2023-02-20 03:42:52 +01:00
|
|
|
<div className="pointer-events-none absolute -bottom-24 h-24 w-full bg-gradient-to-b from-denim-100 to-transparent" />
|
|
|
|
</div>
|
|
|
|
<div className="relative flex w-full items-center justify-center sm:w-fit">
|
|
|
|
<div className="mr-auto sm:mr-6">
|
|
|
|
<Link to="/">
|
|
|
|
<BrandPill clickable />
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
{props.children}
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
className={`${
|
|
|
|
props.children ? "hidden sm:flex" : "flex"
|
|
|
|
} relative flex-row gap-4`}
|
2022-02-28 22:00:32 +01:00
|
|
|
>
|
2023-04-06 00:48:07 +02:00
|
|
|
<IconPatch
|
|
|
|
className="text-2xl text-white"
|
|
|
|
icon={Icons.GEAR}
|
|
|
|
clickable
|
|
|
|
onClick={() => {
|
|
|
|
setShowModal(true);
|
|
|
|
}}
|
|
|
|
/>
|
2023-02-20 03:42:52 +01:00
|
|
|
<a
|
|
|
|
href={conf().DISCORD_LINK}
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
|
|
|
className="text-2xl text-white"
|
|
|
|
>
|
|
|
|
<IconPatch icon={Icons.DISCORD} clickable />
|
|
|
|
</a>
|
|
|
|
<a
|
|
|
|
href={conf().GITHUB_LINK}
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
|
|
|
className="text-2xl text-white"
|
|
|
|
>
|
|
|
|
<IconPatch icon={Icons.GITHUB} clickable />
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-02-25 21:50:36 +01:00
|
|
|
</div>
|
2023-04-06 00:48:07 +02:00
|
|
|
<SettingsModal show={showModal} onClose={() => setShowModal(false)} />
|
2022-02-25 21:50:36 +01:00
|
|
|
</div>
|
2022-02-28 22:00:32 +01:00
|
|
|
);
|
2022-02-25 21:50:36 +01:00
|
|
|
}
|