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

Create Error Page - Not Found #3

Merged
merged 1 commit into from
Nov 13, 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
15 changes: 7 additions & 8 deletions src/pages/Error/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { useRouteError } from 'react-router-dom';
import { Link } from 'react-router-dom';
import { Container } from './styles';

export default function ErrorPage() {
const error = useRouteError() as Error & { statusText?: string };
console.error(error);
import gameHubLogo from '@assets/logo/logo-white-removebg-preview.png';

export default function ErrorPage() {
return (
<Container>
<Link to="/">
<img src={gameHubLogo} alt="Logotipo" width={100} height={100} />
</Link>
<h1>Oops!</h1>
<p>Sorry, an unexpected error has occurred.</p>
<p>
<i>{error.statusText || error.message}</i>
</p>
<p>Página não encontrada.</p>
</Container>
);
}
10 changes: 10 additions & 0 deletions src/pages/Error/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@ export const Container = styled.div`
align-items: center;
justify-content: center;
gap: 1rem;

img {
width: 200px;
height: 200px;
transition: filter 0.3s;
}

img:hover {
filter: brightness(70%);
}
`;
2 changes: 2 additions & 0 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Lists from '../pages/Lists';
import Login from '../pages/Login';
import Register from '../pages/Register';
import Game from '../pages/Game';
import ErrorPage from '../pages/Error';
import { PrivateRoute } from './privateRoutes';

export const AppRouter = () => {
Expand All @@ -18,6 +19,7 @@ export const AppRouter = () => {
<Route path="/lists" element={<PrivateRoute />}>
<Route path="/lists" element={<Lists />} />
</Route>
<Route path="*" element={<ErrorPage />} />
</Routes>
</Router>
);
Expand Down