Skip to content

feat: navbar #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import Navbar from "@/components/navbar";

const geistSans = Geist({
variable: "--font-geist-sans",
Expand All @@ -27,6 +28,7 @@ export default function RootLayout({
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<Navbar />
{children}
</body>
</html>
Expand Down
65 changes: 65 additions & 0 deletions src/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";

interface ITabProps {
id: string;
name: string;
icon: string;
href: string;
}

export default function Navbar() {
const tabs = [
{ id: "/", name: "Eventos", icon: "calendar_month", href: "/" },
{
id: "/calendar",
name: "Calendário",
icon: "schedule",
href: "/calendar",
},
{ id: "/swap", name: "SWAP", icon: "sync_alt", href: "/" },
];

const currentPage = usePathname();

function Tab({ id, name, icon, href }: ITabProps) {
return (
<Link
className={`inline-flex items-center gap-2 rounded-full px-4 py-2.5 transition-all duration-200 ease-in-out ${
id === currentPage
? "bg-primary text-white shadow-sm"
: "text-gray-600 hover:bg-gray-100 hover:text-gray-900"
}`}
href={href}
aria-current={id === currentPage ? "page" : undefined}
>
<span className="material-symbols-outlined">{icon}</span>
<p>{name}</p>
</Link>
);
}

return (
<nav className="flex w-full justify-between px-8 py-4">
{/* Logo */}
<div className="flex items-center justify-center px-4">LOGO</div>

<menu className="bg-dark/5 flex h-13 items-center gap-0.5 rounded-full p-1">
{tabs.map((tab) => (
<Tab
key={tab.id}
id={tab.id}
name={tab.name}
icon={tab.icon}
href={tab.href}
/>
))}
</menu>

{/* User dropdown */}
<div className="flex items-center justify-center px-4">Profile</div>
</nav>
);
}