Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: layout #26

Merged
merged 4 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions src/app/(main)/layout.tsx

This file was deleted.

19 changes: 19 additions & 0 deletions src/app/(playground)/pg/error/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use client";

import { useEffect } from "react";
import { ALink, AMain } from "~/app/(playground)/pg/inner-tools";

export default function Page() {
useEffect(() => {
throw new Error("This is an intentional error");
}, []);

return (
<AMain>
<ALink href="./">playground</ALink>
<div>
<h1>Test</h1>
</div>
</AMain>
);
}
26 changes: 5 additions & 21 deletions src/app/(playground)/pg/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,10 @@ export default async function AppLayout({
children: React.ReactNode;
}) {
return (
<html lang="ko">
<head>
<link
rel="stylesheet"
as="style"
crossOrigin="anonymous"
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/variable/pretendardvariable-dynamic-subset.min.css"
/>
</head>
<body
style={{
fontFamily: '"Pretendard Variable", Pretendard, sans-serif',
}}
>
<Providers>
{children}
<Toaster />
<GlobalAlert />
</Providers>
</body>
</html>
<Providers>
{children}
<Toaster />
<GlobalAlert />
</Providers>
);
}
22 changes: 10 additions & 12 deletions src/app/(ut)/ut/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import Script from "next/script";
import BottomSheet from "~/app/(playground)/pg/bottom-sheet/_components/bottom-sheet";
import { Toaster } from "~/components/ui/sonner";
import { pretendard } from "~/lib/fonts";
import "./style.css";

export default function UTPageLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="ko" className="bg-[#1A1A1A]">
<body className={pretendard.className}>
{children}
<BottomSheet />
<Toaster />
<Script
type="text/javascript"
src="https://developers.kakao.com/sdk/js/kakao.js"
/>
</body>
</html>
<>
{children}
<BottomSheet />
<Toaster />
<Script
type="text/javascript"
src="https://developers.kakao.com/sdk/js/kakao.js"
/>
</>
);
}
3 changes: 3 additions & 0 deletions src/app/(ut)/ut/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
html {
background: #1a1a1a;
}
41 changes: 41 additions & 0 deletions src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use client";

import { useEffect } from "react";
import { Button } from "~/components/ui/button";

export default function Error({
error,
reset,
}: {
error: Error & { digest?: string };
// 에러가 발생한 컴포넌트를 다시 렌더링
reset: () => void;
}) {
useEffect(() => {
// 에러 추적을 위함
console.error(error);
}, [error]);

return (
<main className="mx-auto max-w-6xl px-5 py-8 pb-20 lg:p-14">
<div className="align-stretch mx-auto flex h-full w-full max-w-3xl flex-col">
<div className="h-[45%] py-12">
<div className="mb-16">
<h1 className="mb-2 text-2xl font-medium">
오류가 발생되었습니다.
</h1>
<p className="mb-8 text-sm text-muted-foreground">
잠시 후 다시 시도해주세요.
</p>
<Button onClick={() => reset()}>다시 시도</Button>
</div>
</div>
<div className="w-full border-t py-4">
<p className="text-[0.875rem] font-normal leading-[1.125rem] text-muted-foreground">
Invi © 2024. All rights reserved
</p>
</div>
</div>
</main>
);
}
7 changes: 6 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import { pretendard } from "~/lib/fonts";
import "./globals.css";

export const metadata: Metadata = {
Expand All @@ -11,5 +12,9 @@ export default function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
return children;
return (
<html lang="ko">
<body className={pretendard.className}>{children}</body>
</html>
);
}
29 changes: 29 additions & 0 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Link from "next/link";
import { Button } from "~/components/ui/button";

export default function NotFoundPage() {
return (
<main className="mx-auto max-w-6xl px-5 py-8 pb-20 lg:p-14">
<div className="align-stretch mx-auto flex h-full w-full max-w-3xl flex-col">
<div className="h-[45%] py-12">
<div className="mb-16">
<h1 className="mb-2 text-2xl font-medium">
페이지를 찾지 못했어요.
</h1>
<p className="mb-8 text-sm text-muted-foreground">
페이지 주소가 정확한지 확인해주세요.
</p>
<Button asChild>
<Link href="/">홈으로 가기</Link>
</Button>
</div>
</div>
<div className="w-full border-t py-4">
<p className="text-[0.875rem] font-normal leading-[1.125rem] text-muted-foreground">
Invi © 2024. All rights reserved
</p>
</div>
</div>
</main>
);
}
Loading