Skip to content

Commit

Permalink
Merge pull request #17 from chrisvasqm/feature/add-error-page
Browse files Browse the repository at this point in the history
Add error page
  • Loading branch information
chrisvasqm authored Apr 5, 2024
2 parents 5de949b + 7394fa1 commit 02f9396
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Button, Center, Heading, Text, VStack } from "@chakra-ui/react"
import { Link } from "react-router-dom"
import NavBar from "./NavBar"

const ErrorPage = () => {
return (
<>
<NavBar />
<Center height={'100vh'}>
<VStack>
<Heading>Oops!</Heading>
<Text>Seems like you have lost your way</Text>
<Link to={'/pokemons'}><Button>Go Home</Button></Link>
</VStack>
</Center>
</>
)
}

export default ErrorPage
2 changes: 2 additions & 0 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { createBrowserRouter } from 'react-router-dom'
import Layout from './Layout'
import PokemonDetail from './components/pokemon/PokemonDetail'
import PokemonsContainer from './components/pokemon/PokemonContainer'
import ErrorPage from './components/ErrorPage'

const router = createBrowserRouter([
{
path: '/',
element: <Layout />,
errorElement: <ErrorPage />,
children: [
{ path: '/pokemons', element: <PokemonsContainer /> },
{ path: '/pokemons/:id', element: <PokemonDetail /> }
Expand Down

0 comments on commit 02f9396

Please sign in to comment.