Skip to content

Commit

Permalink
update: grid layout css conditions for home & rest
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhaseeb13mar committed Oct 10, 2023
1 parent 4e6bd9a commit 288c82f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import { Footer } from "./components/Footer";
import { Navbar } from "./components/NavBar";
import { store } from "./redux/store";
import { Provider } from "react-redux";
import { usePathname } from "next/navigation";

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
const path = usePathname();

useEffect(() => {
initializeSubscriptions(store);
return () => {
Expand All @@ -31,7 +34,10 @@ export default function RootLayout({
</head>
<Provider store={store}>
<body>
<div className="grid grid-cols-12 custom-auto-row-grid h-screen prose md:prose-lg lg:prose-xl max-w-none divide-y-4 divide-base-300">
<div
data-path={path}
className="grid grid-cols-12 custom-auto-row-grid h-screen prose md:prose-lg lg:prose-xl max-w-none divide-y-4 divide-base-300"
>
<Navbar />
{children}
<Footer />
Expand Down
7 changes: 6 additions & 1 deletion src/app/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ input[type="number"]::-ms-clear {
background-color: hsl(var(--b2) / var(--tw-bg-opacity, 1));
}

/* Grid layout for home page */
.custom-auto-row-grid[data-path="/"] {
grid-auto-rows: 0fr auto auto 1fr 1fr;
}
/* Grid layout for rest of the pages */
.custom-auto-row-grid {
grid-auto-rows: auto auto auto 1fr 1fr;
grid-auto-rows: 0fr auto 0fr;
}

0 comments on commit 288c82f

Please sign in to comment.