generated from Pettor/template-web-component-react
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: not found page with link to home
- Loading branch information
Showing
10 changed files
with
39 additions
and
17 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import type { ReactElement } from "react"; | ||
import { BasicLayout } from "../../layout/BasicLayout"; | ||
|
||
export function NotFoundView(): ReactElement { | ||
export interface NotFoundViewProps { | ||
onBack(): void; | ||
} | ||
|
||
export function NotFoundView({ onBack }: NotFoundViewProps): ReactElement { | ||
return ( | ||
<BasicLayout container> | ||
<h1>Not Found</h1> | ||
<div className="flex flex-col gap-4 items-center"> | ||
<article className="prose lg:prose-xl p-4 text-pretty max-w-64 lg:max-w-full"> | ||
<strong>{"Could not find the page you were looking for! 🕵️"}</strong> | ||
</article> | ||
<button className="btn btn-primary mt-4 w-48" onClick={onBack}> | ||
Start over 🦖 | ||
</button> | ||
</div> | ||
</BasicLayout> | ||
); | ||
} |
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,10 @@ | ||
import { useNavigate } from "react-router-dom"; | ||
import type { NotFoundViewProps } from "./NotFoundView"; | ||
|
||
export function useNotFoundView(): NotFoundViewProps { | ||
const navigate = useNavigate(); | ||
|
||
return { | ||
onBack: () => navigate("/"), | ||
}; | ||
} |
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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import type { ReactElement } from "react"; | ||
import { NotFoundView } from "~/components/views/not-found/NotFoundView"; | ||
import { useNotFoundView } from "~/components/views/not-found/UseNotFoundView"; | ||
|
||
export function NotFoundPage(): ReactElement { | ||
return <NotFoundView />; | ||
const notFoundViewProps = useNotFoundView(); | ||
return <NotFoundView {...notFoundViewProps} />; | ||
} |