-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from hsglc/feature/error-pages
feat: generate error page
- Loading branch information
Showing
10 changed files
with
176 additions
and
17 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"use client"; | ||
|
||
import Image from "next/image"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
export const GoBackButton = () => { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<button | ||
className="not-found-page__navigation__go-back" | ||
onClick={() => { | ||
router.back(); | ||
}}> | ||
<Image priority src="/left-arrow.svg" alt="left-arrow" width={24} height={24} /> | ||
Go back | ||
</button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use client"; | ||
|
||
import Link from "next/link"; | ||
import { GoBackButton } from "./components/error/go-back-button"; | ||
import "./styles/error/style.scss"; | ||
|
||
export default function GlobalError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) { | ||
return ( | ||
<main className="not-found-page"> | ||
<h1 className="not-found-page__title">500 error</h1> | ||
<h2 className="not-found-page__subtitle">{error && error.message}</h2> | ||
<p className="not-found-page__description"> | ||
We searched high and low, but couldn’t find what you’re looking for. Let’s find a better place for you to go. | ||
</p> | ||
<div className="not-found-page__navigation"> | ||
<GoBackButton /> | ||
<Link className="not-found-page__navigation__take-me-home" href="/"> | ||
Take me home | ||
</Link> | ||
</div> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Link from "next/link"; | ||
import { GoBackButton } from "./components/error/go-back-button"; | ||
import "./styles/error/style.scss"; | ||
|
||
export default function NotFound() { | ||
return ( | ||
<html> | ||
<body> | ||
<main className="not-found-page"> | ||
<h1 className="not-found-page__title">404 error</h1> | ||
<h2 className="not-found-page__subtitle">We lost this page</h2> | ||
<p className="not-found-page__description"> | ||
We searched high and low, but couldn’t find what you’re looking for. Let’s find a better place for you to | ||
go. | ||
</p> | ||
<div className="not-found-page__navigation"> | ||
<GoBackButton /> | ||
<Link className="not-found-page__navigation__take-me-home" href="/"> | ||
Take me home | ||
</Link> | ||
</div> | ||
</main> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ export default function NotFound() { | |
</Link> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.not-found-page { | ||
min-height: 100vh; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: column; | ||
|
||
&__title { | ||
color: $primary-700; | ||
line-height: $line-height-paragraph-4; | ||
font-weight: $semibold; | ||
font-size: $font-size-paragraph-3; | ||
padding-bottom: $space-medium; | ||
} | ||
&__subtitle { | ||
color: $gray-900; | ||
line-height: $line-height-header-1; | ||
font-weight: $semibold; | ||
font-size: $font-size-header-1; | ||
padding-bottom: $space-xlarge; | ||
letter-spacing: $letter-spacing-1; | ||
text-align: center; | ||
} | ||
&__description { | ||
color: $gray-600; | ||
line-height: $line-height-paragraph-2; | ||
font-weight: $regular; | ||
font-size: $font-size-body-4; | ||
padding-bottom: $space-xxxlarge; | ||
max-width: 576px; | ||
text-align: center; | ||
} | ||
|
||
&__navigation { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: $space-medium; | ||
|
||
&__go-back { | ||
padding: 16px 28px; | ||
border-radius: $radius-large; | ||
border: 1px solid $gray-300; | ||
display: flex; | ||
align-items: center; | ||
gap: $space-medium; | ||
color: $gray-700; | ||
font-weight: $semibold; | ||
font-size: $font-size-paragraph-2; | ||
cursor: pointer; | ||
height: 60px; | ||
background: $white; | ||
} | ||
&__take-me-home { | ||
height: 60px; | ||
border-radius: $radius-large; | ||
padding: 16px 28px; | ||
background: $primary-600; | ||
color: $white; | ||
font-weight: $semibold; | ||
font-size: $font-size-paragraph-2; | ||
border: 1px solid $primary-600; | ||
display: flex; | ||
align-items: center; | ||
} | ||
} | ||
&__link:hover { | ||
background-color: $yellow-400; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import "../variables.scss"; | ||
@import "../mixins.scss"; | ||
@import "./not-found.scss"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters