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

Added custom 404 not found page. Fixes : #4 #20

Closed
wants to merge 3 commits into from
Closed
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
30 changes: 30 additions & 0 deletions components/ImageWithButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Start from './buttons/Start'
import Link from 'next/link'
import Button from './buttons/Primary'

export default function ImageWithButton({ type, button, buttonText, title, description, image, redirect, buttonTitle }) {
return (
<section className="flex flex-col md:flex-row container-style justify-center items-center">
<div className="basis-6/12 flex flex-col text-center md:text-left">
<div className={`${type === 'hero' ? 'text-h1' : 'text-subtitle-1 md:text-h2'}`}>
{title}
</div>
<div className="text-body-regular text-[#404040] mt-10">{description}</div>
<div className={`${button === 'true' ? 'block' : 'hidden'} mt-10`}>
<Start text={buttonText} />
</div>
<div>
<Link href={redirect}>
<Button type="submit" className="mt-12">
{buttonTitle}
</Button>
</Link>
</div>
</div>

<div className="text-body-regular shrink-0 basis-6/12 flex justify-center">
<img src={image} className="w-max md:w-auto" />
</div>
</section>
)
}
14 changes: 0 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions pages/404.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useEffect } from 'react';
import Navbar from '@/components/Navbar';
import ImageWithButton from '@/components/ImageWithButton';

export default function NotFound() {
useEffect(() => {
// Add class to body to hide overflow when component mounts
document.body.classList.add('noscroll');
// Remove class from body to restore overflow when component unmounts
return () => {
document.body.classList.remove('noscroll');
};
}, []);

return (
<div className="background-styling">
<Navbar />
<section className="lg:mt-[100px] md:mt-[35px] background-rectangle-wavy md:hidden xl:block mdm:mt-36">
<div className="text-center">
<ImageWithButton
title="The page you're looking for doesn't exist."
description="Try going back to the previous page or visit our homepage."
image="/png/404.png"
redirect="/"
buttonTitle="Go to homepage"
/>
</div>
</section>
</div>
)
}
Binary file added public/png/404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
@apply text-[#131313];
}

.noscroll {
overflow: hidden;
}


.text-dark-gray {
@apply text-[#404040];
}
Expand Down