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: generate error page #78

Merged
merged 14 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions gurubu-client/public/left-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions gurubu-client/src/app/components/error/go-back-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"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>
);
armagandalkiran marked this conversation as resolved.
Show resolved Hide resolved
};
37 changes: 37 additions & 0 deletions gurubu-client/src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"use client";

import Link from "next/link";

import { GoBackButton } from "./components/error/go-back-button";

import "./styles/error/style.scss";
hsglc marked this conversation as resolved.
Show resolved Hide resolved

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>
);
}
32 changes: 32 additions & 0 deletions gurubu-client/src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Link from "next/link";

import { GoBackButton } from "./components/error/go-back-button";

import "./styles/error/style.scss";
hsglc marked this conversation as resolved.
Show resolved Hide resolved

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>
);
}
13 changes: 0 additions & 13 deletions gurubu-client/src/app/room/[id]/not-found.tsx
armagandalkiran marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

66 changes: 66 additions & 0 deletions gurubu-client/src/app/styles/error/not-found.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.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: $medium;
font-size: $font-size-header-1;
padding-bottom: $space-xlarge;
}
&__description {
color: $gray-600;
line-height: $line-height-paragraph-2;
font-weight: $regular;
font-size: $font-size-body-4;
padding-bottom: $space-xxxlarge;
}

&__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;

}
&__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;

}
}
&__link:hover {
background-color: $yellow-400;
}
}

6 changes: 6 additions & 0 deletions gurubu-client/src/app/styles/error/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../variables.scss";
@import "../mixins.scss";

@import "./not-found.scss";
hsglc marked this conversation as resolved.
Show resolved Hide resolved


8 changes: 4 additions & 4 deletions gurubu-client/src/app/styles/page/greeting.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
}
&__title {
color: $blue-900;
font-size: $font-size-header-3;
line-height: $line-height-header-3;
font-size: $font-size-header-4;
line-height: $line-height-header-4;
font-weight: $black;

@include media(xl){
font-size: $font-size-header-1;
line-height: $line-height-header-1;
font-size: $font-size-header-2;
line-height: $line-height-header-2;
}
}
&__description {
Expand Down
4 changes: 2 additions & 2 deletions gurubu-client/src/app/styles/room/nickname-form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
border: 2px solid $blue-600;
&__title {
color: $blue-700;
font-size: $font-size-header-3;
line-height: $line-height-header-3;
font-size: $font-size-header-4;
line-height: $line-height-header-4;
font-weight: $semibold;
margin-bottom: $space-xlarge;
}
Expand Down
28 changes: 0 additions & 28 deletions gurubu-client/src/app/styles/room/not-found.scss

This file was deleted.

1 change: 0 additions & 1 deletion gurubu-client/src/app/styles/room/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import "../variables.scss";
@import "../mixins.scss";

@import "./not-found.scss";
@import "./vote-card.scss";
@import "./voting-stick.scss";
@import "./nickname-form.scss";
Expand Down
18 changes: 12 additions & 6 deletions gurubu-client/src/app/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ $voting-card-color: linear-gradient(
#ced3e8 101.29%
);

$primary-700: #6941C6;
$primary-600: #7F56D9;

$blue-900: #091133;
$blue-800: #111b47;
$blue-700: #222f65;
Expand Down Expand Up @@ -54,13 +57,15 @@ $yellow-100: #fff6e0;
$red-700: #DC2626;

// font size
$font-size-header-1: 50px;
armagandalkiran marked this conversation as resolved.
Show resolved Hide resolved
$font-size-header-2: 42px;
$font-size-header-3: 26px;
$font-size-header-1: 60px;
$font-size-header-2: 50px;
$font-size-header-3: 42px;
$font-size-header-4: 26px;

$font-size-body-1: 48px;
$font-size-body-2: 36px;
$font-size-body-3: 28px;
$font-size-body-4: 20px;

$font-size-paragraph-1: 22px;
$font-size-paragraph-2: 18px;
Expand All @@ -69,9 +74,10 @@ $font-size-paragraph-4: 14px;
$font-size-paragraph-5: 12px;

// line height
$line-height-header-1: 66px;
$line-height-header-2: 60px;
$line-height-header-3: 38px;
$line-height-header-1: 72px;
$line-height-header-2: 66px;
$line-height-header-3: 60px;
$line-height-header-4: 38px;

$line-height-body-1: 48px;
$line-height-body-2: 38px;
Expand Down