-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
import { Sheet, SheetClose, SheetContent, SheetTrigger } from "@/components/ui/sheet"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import { usePathname } from "next/navigation"; | ||
import { sidebarLinks } from "@/constants"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
type Props = {}; | ||
|
||
const MobileNav = (props: Props) => { | ||
const pathname = usePathname(); | ||
return ( | ||
<section className="w-full max-w-[264px]"> | ||
<Sheet> | ||
<SheetTrigger asChild> | ||
<Image | ||
src={"/icons/hamburger.svg"} | ||
width={36} | ||
height={36} | ||
alt="hamburger icon" | ||
className="cursor-pointer sm:hidden" | ||
/> | ||
</SheetTrigger> | ||
<SheetContent side="left" className="border-none bg-dark-1"> | ||
<Link href="/" className="flex items-center gap-1"> | ||
<Image | ||
src={"/icons/logo.svg"} | ||
width={32} | ||
height={32} | ||
alt="Yoom" | ||
className="max-sm:size-10" | ||
/> | ||
<p className="text-[26px] font-extrabold text-white">Yoom</p> | ||
</Link> | ||
|
||
<div className="flex h-[calc(100vh-72px)] flex-col justify-between overflow-y-auto"> | ||
<SheetClose asChild> | ||
<section className="flex h-full flex-col gap-6 pt-16 text-white"> | ||
{sidebarLinks.map(link => { | ||
const isActive = pathname === link.route || pathname.startsWith(`${link.route}/`); | ||
|
||
return ( | ||
<SheetClose asChild key={link.route}> | ||
<Link | ||
key={link.label} | ||
href={link.route} | ||
className={cn("flex gap-4 items-center p-4 rounded-lg justify-start", { | ||
"bg-blue-1": isActive, | ||
})} | ||
> | ||
<Image src={link.imgUrl} alt={link.label} width={24} height={24} /> | ||
<p className="font-semibold">{link.label}</p> | ||
</Link> | ||
</SheetClose> | ||
); | ||
})} | ||
</section> | ||
</SheetClose> | ||
</div> | ||
</SheetContent> | ||
</Sheet> | ||
</section> | ||
); | ||
}; | ||
|
||
export default MobileNav; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,30 @@ | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import React from "react"; | ||
import MobileNav from "./mobile-nav"; | ||
|
||
type Props = {}; | ||
|
||
const Navbar = (props: Props) => { | ||
return <div>Navbar</div>; | ||
return ( | ||
<nav className="flex-between fixed z-50 w-full bg-dark-1 px-6 py-4 lg:px-10"> | ||
<Link href="/" className="flex items-center gap-1"> | ||
<Image | ||
src={"/icons/logo.svg"} | ||
width={32} | ||
height={32} | ||
alt="Yoom" | ||
className="max-sm:size-10" | ||
/> | ||
<p className="text-[26px] font-extrabold text-white max-sm:hidden">Yoom</p> | ||
</Link> | ||
|
||
<div className="flex-between gap-5"> | ||
{/* Clerk Magic */} | ||
<MobileNav /> | ||
</div> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default Navbar; |