Skip to content
Open
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
180 changes: 90 additions & 90 deletions src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,121 +8,121 @@ import { socials } from "../data/socials";
export default function Navbar() {
const [openMenu, setOpenMenu] = useState(false);

// Top navigation links
const navLinks = [
{
label: "Features",
onClick: () => {
const el = document.getElementById("features");
if (el) el.scrollIntoView({ behavior: "smooth" });
},
},
{ label: "Editor", to: "/editor" },
{ label: "Templates", to: "/templates" },
{ label: "Docs", to: socials.docs },
];

// Social links
const socialLinks = [
{ title: "Jump to Github", href: socials.github, icon: "bi-github" },
{ title: "Follow us on X", href: socials.twitter, icon: "bi-twitter-x" },
{ title: "Join the community on Discord", href: socials.discord, icon: "bi-discord" },
];

return (
<>
<div className="py-4 px-12 sm:px-4 flex justify-between items-center">
<div className="flex items-center justify-between w-full">
{/* Logo */}
<Link to="/">
<img src={logo} alt="logo" className="h-[48px] sm:h-[32px]" />
</Link>

{/* Desktop Nav Links */}
<div className="md:hidden flex gap-12">
<Link
className="text-lg font-semibold hover:text-sky-800 transition-colors duration-300"
onClick={() =>
document
.getElementById("features")
.scrollIntoView({ behavior: "smooth" })
}
>
Features
</Link>
<Link
to="/editor"
className="text-lg font-semibold hover:text-sky-800 transition-colors duration-300"
>
Editor
</Link>
<Link
to="/templates"
className="text-lg font-semibold hover:text-sky-800 transition-colors duration-300"
>
Templates
</Link>
<Link
to={socials.docs}
className="text-lg font-semibold hover:text-sky-800 transition-colors duration-300"
>
Docs
</Link>
{navLinks.map(({ label, to, onClick }) =>
to ? (
<Link
key={label}
to={to}
className="text-lg font-semibold hover:text-sky-800 transition-colors duration-300"
>
{label}
</Link>
) : (
<button
key={label}
onClick={onClick}
className="text-lg font-semibold hover:text-sky-800 transition-colors duration-300"
>
{label}
</button>
)
)}
</div>

{/* Social Icons */}
<div className="md:hidden block space-x-3 ms-12">
<a
title="Jump to Github"
className="px-2 py-2 hover:opacity-60 transition-all duration-300 rounded-full text-2xl"
href={socials.github}
target="_blank"
rel="noreferrer"
>
<i className="opacity-70 bi bi-github" />
</a>
<a
title="Follow us on X"
className="px-2 py-2 hover:opacity-60 transition-all duration-300 rounded-full text-2xl"
href={socials.twitter}
target="_blank"
rel="noreferrer"
>
<i className="opacity-70 bi bi-twitter-x" />
</a>
<a
title="Join the community on Discord"
className="px-2 py-2 hover:opacity-60 transition-all duration-300 rounded-full text-2xl"
href={socials.discord}
target="_blank"
rel="noreferrer"
>
<i className="opacity-70 bi bi-discord" />
</a>
{socialLinks.map(({ title, href, icon }) => (
<a
key={title}
title={title}
href={href}
target="_blank"
rel="noreferrer"
className="px-2 py-2 transition-colors duration-300 rounded-full text-2xl hover:text-sky-800"
>
<i className={`opacity-90 bi ${icon}`} />
</a>
))}
</div>
</div>

{/* Mobile Menu Button */}
<button
onClick={() => setOpenMenu((prev) => !prev)}
className="hidden md:inline-block h-[24px]"
aria-label="Open navigation menu"
>
<IconMenu size="extra-large" />
</button>
</div>

<hr />

{/* Mobile Side Sheet */}
<SideSheet
title={
<img src={logo} alt="logo" className="sm:h-[32px] md:h-[42px]" />
}
title={<img src={logo} alt="logo" className="sm:h-[32px] md:h-[42px]" />}
visible={openMenu}
onCancel={() => setOpenMenu(false)}
width={window.innerWidth}
role="navigation"
aria-label="Mobile Navigation Menu"
>
<Link
className="hover:bg-zinc-100 block p-3 text-base font-semibold"
onClick={() => {
document
.getElementById("features")
.scrollIntoView({ behavior: "smooth" });
setOpenMenu(false);
}}
>
Features
</Link>
<hr />
<Link
to="/editor"
className="hover:bg-zinc-100 block p-3 text-base font-semibold"
>
Editor
</Link>
<hr />
<Link
to="/templates"
className="hover:bg-zinc-100 block p-3 text-base font-semibold"
>
Templates
</Link>
<hr />
<Link
to={socials.docs}
className="hover:bg-zinc-100 block p-3 text-base font-semibold"
>
Docs
</Link>
{navLinks.map(({ label, to, onClick }) => (
<div key={label}>
{to ? (
<Link
to={to}
className="hover:bg-zinc-100 block p-3 text-base font-semibold"
onClick={() => setOpenMenu(false)}
>
{label}
</Link>
) : (
<button
className="hover:bg-zinc-100 block w-full text-left p-3 text-base font-semibold"
onClick={() => {
onClick();
setOpenMenu(false);
}}
>
{label}
</button>
)}
<hr />
</div>
))}
</SideSheet>
</>
);
Expand Down