Navbar 32
NavbarsLogo LeftMenu LeftMega MenuNavbar

Code
relume-navbar32.tsx
"use client";
import { useState } from "react";
import { motion } from "motion/react";
import { Button, type ButtonProps } from "@/components/ui/button";
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet";
import { FacebookLogo, InstagramLogo, LinkedinLogo, YoutubeLogo, XLogo } from "relume-icons";
type ImageProps = {
url?: string;
src: string;
alt?: string;
};
type SocialMediaLink = {
url: string;
icon: React.ReactNode;
};
type NavLink = {
url: string;
title: string;
subMenuLinks?: NavLink[];
};
type NavBottom = {
socialMediaLinks: SocialMediaLink[];
button: ButtonProps & {
url: string;
};
contactInfo: {
phone?: string;
email?: string;
address?: string;
title?: string;
};
};
type Props = {
logo: ImageProps;
navLinks: NavLink[];
button: ButtonProps;
navBottom: NavBottom;
};
export type Navbar32Props = React.ComponentPropsWithoutRef<"section"> & Partial<Props>;
export const Navbar32 = (props: Navbar32Props) => {
const { logo, navLinks, button, navBottom } = {
...Navbar32Defaults,
...props,
};
const [isMenuOpen, setIsMenuOpen] = useState(false);
return (
<section className="relative flex min-h-16 w-full items-center bg-scheme-background px-[5%] md:min-h-18 md:bg-transparent">
<div className="mx-auto flex size-full items-center justify-between">
<a href={logo.url} className="z-[100]">
<img src={logo.src} alt={logo.alt} />
</a>
<div className="flex items-center justify-center gap-2 lg:gap-4">
<Button {...button} className="z-0 mr-12 px-4 py-1 md:px-6 md:py-2 lg:mr-16">
{button.title}
</Button>
<Sheet open={isMenuOpen} onOpenChange={setIsMenuOpen}>
<SheetTrigger asChild>
<button className="absolute top-2 right-2.5 flex size-12 flex-col items-center justify-center justify-self-end sm:right-7 md:top-3 md:right-8 lg:right-19">
<span className="relative flex size-6 flex-col items-center justify-center">
<motion.span
className="absolute top-[3px] h-0.5 w-full bg-neutral-darkest"
animate={isMenuOpen ? "open" : "close"}
variants={topLineVariants}
/>
<motion.span
className="absolute h-0.5 w-full bg-neutral-darkest"
animate={isMenuOpen ? "open" : "close"}
variants={middleLineVariants}
/>
<motion.span
className="absolute h-0.5 w-full bg-neutral-darkest"
animate={isMenuOpen ? "openSecond" : "closeSecond"}
variants={middleLineVariants}
/>
<motion.span
className="absolute bottom-[3px] h-0.5 w-full bg-neutral-darkest"
animate={isMenuOpen ? "open" : "close"}
variants={bottomLineVariants}
/>
</span>
</button>
</SheetTrigger>
<SheetContent
side="left"
className="z-[90] w-full max-w-[75%] border-r border-scheme-border px-[5%] pb-12 data-[state=closed]:duration-100 data-[state=closed]:slide-out-to-right-0 data-[state=open]:duration-500 data-[state=open]:fade-in-50 data-[state=open]:slide-in-from-right-0 md:max-w-[40%] md:px-[5%] lg:max-w-[26rem] lg:px-[5%] lg:pt-18 lg:pb-12"
>
<div className="flex h-full flex-col justify-between overflow-auto">
<div className="grid grid-cols-1 py-8">
{navLinks.map((navLink, index) => (
<a
key={index}
href={navLink.url}
className="py-2 text-2xl leading-[1.2] font-bold lg:text-6xl"
>
{navLink.title}
</a>
))}
</div>
<div>
<p className="mb-2 font-semibold">{navBottom.contactInfo.title}</p>
<p className="mb-1 text-sm">{navBottom.contactInfo.phone}</p>
<p className="mb-1 text-sm">{navBottom.contactInfo.email}</p>
<p className="text-sm">{navBottom.contactInfo.address}</p>
<div className="mt-6 flex items-center gap-3 md:mt-8">
{navBottom.socialMediaLinks.map((link, index) => (
<a key={index} href={link.url}>
{link.icon}
</a>
))}
</div>
</div>
</div>
</SheetContent>
</Sheet>
</div>
</div>
</section>
);
};
export const Navbar32Defaults: Props = {
logo: {
url: "#",
src: "https://d22po4pjz3o32e.cloudfront.net/logo-image.svg",
alt: "Relume placeholder logo",
},
navLinks: [
{
url: "#",
title: "Link One",
},
{
url: "#",
title: "Link Two",
},
{
url: "#",
title: "Link Three",
},
{
url: "#",
title: "Link Four",
},
{
url: "#",
title: "Link Five",
},
],
navBottom: {
button: { title: "Contact", variant: "link", size: "link", url: "#" },
socialMediaLinks: [
{ url: "#", icon: <FacebookLogo className="size-6 text-scheme-text" /> },
{ url: "#", icon: <InstagramLogo className="size-6 text-scheme-text" /> },
{ url: "#", icon: <XLogo className="size-6 text-scheme-text" /> },
{ url: "#", icon: <LinkedinLogo className="size-6 text-scheme-text" /> },
{ url: "#", icon: <YoutubeLogo className="size-6 text-scheme-text" /> },
],
contactInfo: {
phone: "1800 123 4567",
email: "email@example.com",
address: "Level 1, 12 Sample St, Sydney NSW 2000",
title: "Get in touch",
},
},
button: {
title: "Button",
size: "sm",
},
};
const topLineVariants = {
open: {
width: 0,
transition: { duration: 0.1, ease: "easeIn" },
},
close: {
width: "100%",
transition: { duration: 0.1, delay: 0.4, ease: "linear" },
},
};
const middleLineVariants = {
open: {
rotate: 135,
transition: { duration: 0.3, delay: 0.4, ease: "easeInOut" },
},
close: {
rotate: 0,
transition: { duration: 0.3, ease: "easeInOut" },
},
openSecond: {
rotate: 45,
transition: { duration: 0.3, delay: 0.4, ease: "easeInOut" },
},
closeSecond: {
rotate: 0,
transition: { duration: 0.3, ease: "easeInOut" },
},
};
const bottomLineVariants = {
open: {
width: 0,
transition: { duration: 0.1, ease: "easeIn" },
},
close: {
width: "100%",
transition: { duration: 0.1, delay: 0.4, ease: "linear" },
},
};npm i @radix-ui/react-accordion @radix-ui/react-dialog @radix-ui/react-slot class-variance-authority@0.7.1 clsx@^2.1.1 embla-carousel-react@^8.5.2 motion@^12.15.0 relume-icons@1.3.0 tailwind-merge@^2.2.2


