From 2d58866bd5d226dfb9681bf69adb4f0ca9a1704f Mon Sep 17 00:00:00 2001 From: dkon70 Date: Thu, 7 Dec 2023 03:46:54 +0700 Subject: [PATCH 1/3] feat: add 404 page --- src/pages/404.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/pages/404.tsx diff --git a/src/pages/404.tsx b/src/pages/404.tsx new file mode 100644 index 0000000..becb0b0 --- /dev/null +++ b/src/pages/404.tsx @@ -0,0 +1,14 @@ +import { Button } from "@/components/ui/button"; +import Link from "next/link"; +const NotFound = () => { + + return ( +
+

404

+

page not found

+ +
+ ) +} + +export default NotFound; \ No newline at end of file From 091762aaa28c5b2d9c020d8c275cdb9e6a3a2a48 Mon Sep 17 00:00:00 2001 From: dkon70 Date: Thu, 7 Dec 2023 04:26:52 +0700 Subject: [PATCH 2/3] feat: add test for 404 page --- src/pages/404.tsx | 25 ++++++++++++++----------- src/test/404.test.tsx | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 src/test/404.test.tsx diff --git a/src/pages/404.tsx b/src/pages/404.tsx index becb0b0..25c414d 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,14 +1,17 @@ -import { Button } from "@/components/ui/button"; -import Link from "next/link"; +import { Button } from '@/components/ui/button'; +import Link from 'next/link'; const NotFound = () => { - return ( -
-

404

-

page not found

- -
- ) -} +
+

404

+

page not found

+ + + +
+ ); +}; -export default NotFound; \ No newline at end of file +export default NotFound; diff --git a/src/test/404.test.tsx b/src/test/404.test.tsx new file mode 100644 index 0000000..1fb57af --- /dev/null +++ b/src/test/404.test.tsx @@ -0,0 +1,14 @@ +import NotFound from '@/pages/404'; +import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; + +describe('404 page tests:', () => { + test('404 page renders correctly', () => { + render(); + + const heading = screen.getByText('404'); + const button = screen.getByRole('button'); + expect(heading).toBeInTheDocument(); + expect(button).toBeInTheDocument(); + }); +}); From f233311f3926aa64ac6a67b8695eda8eb7f96004 Mon Sep 17 00:00:00 2001 From: dkon70 Date: Thu, 7 Dec 2023 05:00:45 +0700 Subject: [PATCH 3/3] feat: add layout --- src/pages/404.tsx | 21 ++++++++++++--------- src/pages/index.tsx | 8 +++++++- src/pages/layout.tsx | 15 +++++++++++++++ src/test/404.test.tsx | 2 +- 4 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 src/pages/layout.tsx diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 25c414d..9d42254 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,16 +1,19 @@ import { Button } from '@/components/ui/button'; import Link from 'next/link'; +import Layout from './layout'; const NotFound = () => { return ( -
-

404

-

page not found

- - - -
+ +
+

404

+

page not found

+ + + +
+
); }; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 6ff5373..55cff89 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,3 +1,9 @@ +import Layout from './layout'; + export default function Home() { - return <>; + return ( + <> + + + ); } diff --git a/src/pages/layout.tsx b/src/pages/layout.tsx new file mode 100644 index 0000000..378d2c3 --- /dev/null +++ b/src/pages/layout.tsx @@ -0,0 +1,15 @@ +import Header from '@/components/Header/Header'; +import Footer from '@/components/Footer/Footer'; +import { ReactNode } from 'react'; + +const Layout = ({ children }: { children?: ReactNode }) => { + return ( + <> +
+
{children}
+