Skip to content

Commit

Permalink
Move non-Admin page components into route group (#194)
Browse files Browse the repository at this point in the history
- Since `usePathname` requires a Client Component and the Root Layout
  must be a Server Component, create a route group for the main site
- The Admin site will have it's own layout (without main Navbar/Footer)
- Move application form components into `@/lib/components/forms`
  - Update imports in application form sections accordingly
- Refactor `SceneLayout` for canvas scene
- Include brown background color on `body` for main layout
  • Loading branch information
taesungh committed Jan 8, 2024
1 parent ba38682 commit 6d8d9b2
Show file tree
Hide file tree
Showing 71 changed files with 63 additions and 39 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SimpleRadio from "@/app/apply/sections/Components/SimpleRadio";
import SimpleRadio from "@/lib/components/forms/SimpleRadio";

const yesNoOptions = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RadioSelect from "@/app/apply/sections/Components/RadioSelect";
import TextInput from "@/app/apply/sections/Components/TextInput";
import RadioSelect from "@/lib/components/forms/RadioSelect";
import TextInput from "@/lib/components/forms/TextInput";
import styles from "./Form.module.scss";

const pronouns = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TextInput from "@/app/apply/sections/Components/TextInput";
import Textfield from "@/app/apply/sections/Components/Textfield";
import TextInput from "@/lib/components/forms/TextInput";
import Textfield from "@/lib/components/forms/Textfield";
import styles from "./Form.module.scss";

const FRQ_MAX_LENGTH = 2000;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from "./Form.module.scss";
import DropdownSelect from "@/app/apply/sections/Components/DropdownSelect";
import SimpleRadio from "@/app/apply/sections/Components/SimpleRadio";
import DropdownSelect from "@/lib/components/forms/DropdownSelect";
import SimpleRadio from "@/lib/components/forms/SimpleRadio";

//these values can be edited if backend needs it later on

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

body {
color: var(--color-cream);
background-color: var(--color-brown);
}

p {
Expand Down
File renamed without changes.
30 changes: 30 additions & 0 deletions apps/site/src/app/(main)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { PropsWithChildren } from "react";

import type { Metadata } from "next";

import water from "@/assets/backgrounds/water.jpg";
import SceneLayout from "@/components/dom/SceneLayout";
import Footer from "@/lib/components/Footer/Footer";
import NavbarParent from "@/lib/components/Navbar/NavbarParent";

import "./globals.css";

export const metadata: Metadata = {
title: "IrvineHacks 2024",
description:
"IrvineHacks is Hack at UCI's premier hackathon for collegiate students.",
};

export default function Layout({ children }: PropsWithChildren) {
return (
<div
style={{ backgroundImage: `url(${water.src})` }}
className="overflow-x-hidden bg-top bg-repeat-y bg-[length:100%]"
>
{/* reference: https://github.com/pmndrs/react-three-next */}
<NavbarParent />
<SceneLayout>{children}</SceneLayout>
<Footer />
</div>
);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions apps/site/src/app/admin/demo/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function AdminDemo() {
return <div>AdminDemo</div>;
}

export default AdminDemo;
13 changes: 13 additions & 0 deletions apps/site/src/app/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Metadata } from "next/types";

import { PropsWithChildren } from "react";

export const metadata: Metadata = {
title: "Admin | IrvineHacks 2024",
};

function Layout({ children }: PropsWithChildren) {
return <div style={{ color: "red" }}>{children}</div>;
}

export default Layout;
32 changes: 3 additions & 29 deletions apps/site/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,9 @@
import type { Metadata } from "next";
import water from "@/assets/backgrounds/water.jpg";
import Footer from "@/lib/components/Footer/Footer";
import "./globals.css";
import { PropsWithChildren } from "react";

import { Layout } from "@/components/dom/Layout";
import NavbarParent from "@/lib/components/Navbar/NavbarParent";

export const metadata: Metadata = {
title: "IrvineHacks 2024",
description:
"IrvineHacks is Hack at UCI's premier hackathon for collegiate students.",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
export default function RootLayout({ children }: PropsWithChildren) {
return (
<html lang="en">
<body
style={{
backgroundImage: `url(${water.src})`,
}}
className="overflow-x-hidden bg-top bg-repeat-y bg-[length:100%]"
>
{/* reference: https://github.com/pmndrs/react-three-next */}
<NavbarParent />
<Layout>{children}</Layout>
<Footer />
</body>
<body>{children}</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"use client";

import { ReactNode, useRef } from "react";
import { PropsWithChildren, useRef } from "react";

import Scene from "@/components/canvas/Scene";

const Layout = ({ children }: { children: ReactNode }) => {
const SceneLayout = ({ children }: PropsWithChildren) => {
const ref = useRef<HTMLDivElement>(null);

return (
Expand Down Expand Up @@ -37,4 +38,4 @@ const Layout = ({ children }: { children: ReactNode }) => {
);
};

export { Layout };
export default SceneLayout;

0 comments on commit 6d8d9b2

Please sign in to comment.