Skip to content

Commit

Permalink
add multiple root layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
delishad21 committed Oct 8, 2024
1 parent 26afcb4 commit f54bacf
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 65 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 66 additions & 0 deletions frontend/peerprep/app/(default)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import "@/styles/globals.css";
import { Metadata, Viewport } from "next";
import clsx from "clsx";
import { PublicEnvScript } from "next-runtime-env";

import { Providers } from "./providers";

import { siteConfig } from "@/config/site";
import { fontSans } from "@/config/fonts";
import { Navbar } from "@/components/navbar";
import { Sidebar } from "@/components/sidebar";

export const metadata: Metadata = {
title: {
default: siteConfig.name,
template: `%s - ${siteConfig.name}`,
},
description: siteConfig.description,
icons: {
icon: "/favicon.ico",
},
};

export const viewport: Viewport = {
themeColor: [
{ media: "(prefers-color-scheme: light)", color: "white" },
{ media: "(prefers-color-scheme: dark)", color: "black" },
],
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html suppressHydrationWarning lang="en">
<head>
<PublicEnvScript />
<link
href="https://unpkg.com/[email protected]/css/boxicons.min.css"
rel="stylesheet"
/>
</head>
<body
className={clsx(
"min-h-screen bg-background font-sans antialiased",
fontSans.variable
)}
>
<Providers themeProps={{ attribute: "class", defaultTheme: "light" }}>
<div className="relative flex flex-col h-screen">
<Navbar />
<div className="flex flex-grow mx-6">
<Sidebar />
<main className="flex-grow container max-w-screen">
{children}
</main>
</div>
<footer className="w-full flex items-center justify-center py-3" />
</div>
</Providers>
</body>
</html>
);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
57 changes: 2 additions & 55 deletions frontend/peerprep/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,65 +1,12 @@
import "@/styles/globals.css";
import { Metadata, Viewport } from "next";
import clsx from "clsx";
import { PublicEnvScript } from "next-runtime-env";

import { Providers } from "./providers";

import { siteConfig } from "@/config/site";
import { fontSans } from "@/config/fonts";
import { Navbar } from "@/components/navbar";
import { Sidebar } from "@/components/sidebar";

export const metadata: Metadata = {
title: {
default: siteConfig.name,
template: `%s - ${siteConfig.name}`,
},
description: siteConfig.description,
icons: {
icon: "/favicon.ico",
},
};

export const viewport: Viewport = {
themeColor: [
{ media: "(prefers-color-scheme: light)", color: "white" },
{ media: "(prefers-color-scheme: dark)", color: "black" },
],
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html suppressHydrationWarning lang="en">
<head>
<PublicEnvScript />
<link
href="https://unpkg.com/[email protected]/css/boxicons.min.css"
rel="stylesheet"
/>
</head>
<body
className={clsx(
"min-h-screen bg-background font-sans antialiased",
fontSans.variable
)}
>
<Providers themeProps={{ attribute: "class", defaultTheme: "light" }}>
<div className="relative flex flex-col h-screen">
<Navbar />
<div className="flex flex-grow mx-6">
<Sidebar />
<main className="flex-grow container max-w-screen">
{children}
</main>
</div>
<footer className="w-full flex items-center justify-center py-3" />
</div>
</Providers>
<body>
<div>{children}</div>
</body>
</html>
);
Expand Down
7 changes: 0 additions & 7 deletions frontend/peerprep/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
"use client";

export default function Home() {
const friends = [
{ name: "s_name", status: "online" },
{ name: "thisisalongusername", status: "online" },
{ name: "Friend3", status: "hidden" },
{ name: "Friend4", status: "offline" },
];

return (
<div className="flex flex-col items-center p-8">
<h1 className="text-3xl font-bold text-center">
Expand Down
2 changes: 1 addition & 1 deletion frontend/peerprep/components/addquestionform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { WysiMarkEditor } from "./wysimarkeditor";
import BoxIcon from "./boxicons";

import { capitalize, languages } from "@/utils/utils";
import { complexityColorMap } from "@/app/questions-management/columns";
import { complexityColorMap } from "@/app/(default)/questions-management/columns";

interface AddQuestionFormProps {
initialTitle?: string;
Expand Down
2 changes: 1 addition & 1 deletion frontend/peerprep/components/editquestionform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { capitalize, languages } from "@/utils/utils";
import {
complexityColorMap,
Question,
} from "@/app/questions-management/columns";
} from "@/app/(default)/questions-management/columns";

interface EditQuestionFormProps {
initialTitle?: string;
Expand Down
2 changes: 1 addition & 1 deletion frontend/peerprep/components/questionstable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
Question,
RenderCell,
complexityOptions,
} from "@/app/questions-management/columns";
} from "@/app/(default)/questions-management/columns";

const fetcher = (url: string) => fetch(url).then((res) => res.json());

Expand Down

0 comments on commit f54bacf

Please sign in to comment.