Skip to content

Commit

Permalink
layout fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Princekumarofficial committed Aug 31, 2024
1 parent f7fe8d9 commit fe7c69a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 77 deletions.
56 changes: 18 additions & 38 deletions src/app/(authroutes)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,31 @@
import "../globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { ToggleProvider } from "@/contextProviders/ToggleProvider";
import NextAuthProvider from "@/contextProviders/sessionProvider";
import { Toaster } from "react-hot-toast";
import Sidebar from "@/components/Sidebar";
import MainContent from "@/components/MainContent";
import { Providers } from "@/store/provider";
import { Suspense } from "react";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "TPC Portal",
description: "Generated by create next app",
};

interface Props {
children: React.ReactNode;
}

const AuthLayout = async ({ children }: Props) => {
const className = inter.className;

const RouteLayout = async ({ children }: Props) => {
return (
<html lang="en">
<body className={className}>
<ToggleProvider>
<div className="flex flex-col h-screen">
<Toaster />

<NextAuthProvider>
<div className="flex-auto flex h-[92vh] ">
{/* sidebar and main content share this space */}
<Suspense fallback={<>Loading...</>}></Suspense>
<Providers>
<div className="w-screen min-h-screen h-max bg-[url(/images/iiti_bg.JPG)] bg-cover bg-fixed bg-center bg-no-repeat absolute">
<div className="w-full min-h-full h-max bg-gradient-to-b from-black/40 to-black/90 bg-opacity-50 absolute">
{children}
</div>
</div>
</Providers>
<div className="flex-auto flex h-[92vh] ">
<Providers>
<div className="flex-auto flex h-[92vh] ">
{/* sidebar and main content share this space */}
<Suspense fallback={<>Loading...</>}></Suspense>
<Providers>
<div className="w-screen min-h-screen h-max bg-[url(/images/iiti_bg.JPG)] bg-cover bg-fixed bg-center bg-no-repeat absolute">
<div className="w-full min-h-full h-max bg-gradient-to-b from-black/40 to-black/90 bg-opacity-50 absolute">
{children}
</div>
</NextAuthProvider>
</div>
</ToggleProvider>
</body>
</html>
</div>
</Providers>
</div>
</Providers>
</div>
);
};

export default AuthLayout;
export default RouteLayout;
49 changes: 10 additions & 39 deletions src/app/(routes)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,24 @@
import "../globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { ToggleProvider } from "@/contextProviders/ToggleProvider";
import Sidebar from "@/components/Sidebar";
import MainContent from "@/components/MainContent";
import NextAuthProvider from "@/contextProviders/sessionProvider";
import { Toaster } from "react-hot-toast";
import { Providers } from "@/store/provider";
import { Suspense } from "react";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "TPC Portal",
description: "Generated by create next app",
};

interface Props {
children: React.ReactNode;
auth: React.ReactNode;
}

const RouteLayout = async ({ children, auth }: Props) => {
const className = inter.className;

const RouteLayout = async ({ children }: Props) => {
return (
<html lang="en">
<body className={className}>
<ToggleProvider>
<div className="flex flex-col h-screen">
{/* Page Content */}
<Toaster />

<NextAuthProvider>
<div className="flex-auto flex h-[92vh] ">
{/* sidebar and main content share this space */}
<Suspense fallback={<>Loading...</>}>
<Sidebar />
</Suspense>
<MainContent>
<Providers>{children}</Providers>
</MainContent>
</div>
{auth}
</NextAuthProvider>
</div>
</ToggleProvider>
</body>
</html>
<div className="flex-auto flex h-[92vh] ">
{/* sidebar and main content share this space */}
<Suspense fallback={<>Loading...</>}>
<Sidebar />
</Suspense>
<MainContent>
<Providers>{children}</Providers>
</MainContent>
</div>
);
};

Expand Down
46 changes: 46 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import "./globals.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { ToggleProvider } from "@/contextProviders/ToggleProvider";
import Sidebar from "@/components/Sidebar";
import MainContent from "@/components/MainContent";
import NextAuthProvider from "@/contextProviders/sessionProvider";
import { Toaster } from "react-hot-toast";
import { Providers } from "@/store/provider";
import { Suspense } from "react";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "TPC Portal",
description: "Generated by create next app",
};

interface Props {
children: React.ReactNode;
auth: React.ReactNode;
}

const RouteLayout = async ({ children, auth }: Props) => {
const className = inter.className;

return (
<html lang="en">
<body className={className}>
<ToggleProvider>
<div className="flex flex-col h-screen">
{/* Page Content */}
<Toaster />

<NextAuthProvider>
{children}
{auth}
</NextAuthProvider>
</div>
</ToggleProvider>
</body>
</html>
);
};

export default RouteLayout;

0 comments on commit fe7c69a

Please sign in to comment.