Is there a way to prevent rootlayout
from being wrapped around dashboardlayout
? Next.js v13
doc:
My file structure:
I could use route groups; however, doing so would disable the wrapping in my contact
, pricing
routes. Is there a way to prevent this from happening? I would like the home navbar across the contact and pricing page but don't want the home page navbar in my dashboard.
I tried using route groups; however, it disabled wrapping in my pricing and contact routes.
navbar.tsx
"use client";
import { useEffect, useState } from "react";
import { Disclosure } from "@headlessui/react";
function joinClassName(...classes: string[]) {
return classes.filter(Boolean).join(" ");
}
export default function Navbar() {
const [navbar, setNavbar] = useState(false);
const changeBackground = () => {
if (window.scrollY >= 64) {
setNavbar(true);
} else {
setNavbar(false);
}
};
useEffect(() => {
changeBackground();
window.addEventListener("scroll", changeBackground);
});
return (
<Disclosure as="nav">
{({ open, close }) => (
<>
<div
className={joinClassName(
navbar || open ? "dark:bg-black bg-white" : "bg-transparent",
" fixed top-0 left-0 right-0 z-50 "
)}
></div>
</>
)}
</Disclosure>
);
}