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

Feat/layout #6

Merged
merged 3 commits into from
Dec 7, 2023
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
20 changes: 20 additions & 0 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Button } from '@/components/ui/button';
import Link from 'next/link';
import Layout from './layout';
const NotFound = () => {
return (
<Layout>
<main className="w-full h-[calc(100vh-160px)] flex flex-col justify-center items-center bg-slate-700 text-white">
<h1 className="text-7xl">404</h1>
<h3 className="text-3xl">page not found</h3>
<Link href="/">
<Button variant="secondary" className="mt-5">
Go Home
</Button>
</Link>
</main>
</Layout>
);
};

export default NotFound;
8 changes: 7 additions & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import Layout from './layout';

export default function Home() {
return <></>;
return (
<>
<Layout></Layout>
</>
);
}
15 changes: 15 additions & 0 deletions src/pages/layout.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<>
<Header />
<div className="min-h-[calc(100vh-160px)]">{children}</div>
<Footer />
</>
);
};

export default Layout;
14 changes: 14 additions & 0 deletions src/test/404.test.tsx
Original file line number Diff line number Diff line change
@@ -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(<NotFound />);

const heading = screen.getByText('404');
const button = screen.getByText('Go Home');
expect(heading).toBeInTheDocument();
expect(button).toBeInTheDocument();
});
});