generated from muhtadeetaron/nextjs-template
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
// app/tabs/layout.tsx
|
|
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { ReactNode } from "react";
|
|
import { usePathname } from "next/navigation";
|
|
import clsx from "clsx";
|
|
import {
|
|
House,
|
|
LayoutGrid,
|
|
Bookmark,
|
|
CircleUser,
|
|
Settings,
|
|
} from "lucide-react";
|
|
|
|
const tabs = [
|
|
{ name: "Home", href: "/home", component: <House size={30} /> },
|
|
{ name: "Unit", href: "/unit", component: <LayoutGrid size={30} /> },
|
|
{ name: "Bookmark", href: "/bookmark", component: <Bookmark size={30} /> },
|
|
{ name: "Settings", href: "/settings", component: <Settings size={30} /> },
|
|
];
|
|
|
|
export default function TabsLayout({ children }: { children: ReactNode }) {
|
|
const pathname = usePathname();
|
|
|
|
return (
|
|
<div className="min-h-screen flex flex-col">
|
|
<main className="flex-1">{children}</main>
|
|
|
|
<nav className="h-[70px] w-full flex justify-around items-center border-t border-t-neutral-400 p-4 rounded-t-4xl bg-white fixed bottom-0">
|
|
{tabs.map((tab) => (
|
|
<Link
|
|
key={tab.name}
|
|
href={tab.href}
|
|
className={clsx(
|
|
"text-center text-sm font-medium",
|
|
pathname === tab.href ? "text-blue-600" : "text-gray-500"
|
|
)}
|
|
>
|
|
{tab.component}
|
|
</Link>
|
|
))}
|
|
</nav>
|
|
</div>
|
|
);
|
|
}
|