flockstr/app/(app)/_layout/BottomNav.tsx

54 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-10-27 14:55:53 -04:00
"use client";
2023-10-13 19:02:59 -04:00
import Link from "next/link";
import {
2023-10-27 17:48:49 -04:00
RiCalendarEventFill,
2023-10-13 19:02:59 -04:00
RiCompass3Fill,
RiQuestionAnswerFill,
} from "react-icons/ri";
import { cn } from "@/lib/utils";
2023-10-27 14:55:53 -04:00
import { usePathname } from "next/navigation";
2023-10-13 19:02:59 -04:00
export default function BottomNav() {
2023-10-27 14:55:53 -04:00
const pathname = usePathname();
2023-10-13 19:02:59 -04:00
const navigationItems = [
{
2023-10-27 14:55:53 -04:00
href: "/explore",
2023-10-13 19:02:59 -04:00
name: "explore",
icon: RiCompass3Fill,
},
2023-10-27 17:48:49 -04:00
{
href: "/events",
name: "events",
icon: RiCalendarEventFill,
},
2023-10-13 19:02:59 -04:00
{
href: "",
name: "messages",
icon: RiQuestionAnswerFill,
},
];
return (
2023-10-15 00:14:22 -04:00
<footer className="z-header- flex h-[var(--bottom-nav-height)] w-full sm:hidden">
2023-10-15 00:18:08 -04:00
<div className="bottom-tabs fixed inset-x-0 bottom-0 flex h-[var(--bottom-nav-height)] flex-1 items-stretch justify-between border-t bg-background px-4">
2023-10-14 23:41:59 -04:00
{navigationItems.map((item) => (
2023-10-15 12:11:39 -04:00
<Link
key={item.name}
href={item.href}
className="center group group flex-1"
>
2023-10-14 23:41:59 -04:00
<item.icon
className={cn(
2023-10-27 14:55:53 -04:00
pathname === item.href
2023-10-14 23:41:59 -04:00
? "text-foreground"
: "text-muted-foreground group-hover:text-foreground",
"h-6 w-6 shrink-0",
)}
aria-hidden="true"
/>
</Link>
))}
2023-10-13 19:02:59 -04:00
</div>
</footer>
);
}