diff --git a/src/app/error.tsx b/src/app/error.tsx index 89c9190..4ed2119 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -1,56 +1,12 @@ "use client"; -import { useEffect } from "react"; - -import { Button } from "~/components/ui/button"; -import Icon from "~/components/ui/icon"; - -import useRouter from "~/hooks/usePRouter"; -import { cn } from "~/lib/utils"; +import ErrorComponent from "~/components/layout/Error"; export default function Error({ error, reset }: { error: Error & { digest?: string }; reset?: () => void }) { - const router = useRouter(); - useEffect(() => { - console.error(error); - }, [error]); - return ( -
- -
- Something went wrong - More details can be found in the console -
- - {error.message} - - -
- - -
-
+ ); } diff --git a/src/components/Layout/Error.tsx b/src/components/Layout/Error.tsx new file mode 100644 index 0000000..acd9059 --- /dev/null +++ b/src/components/Layout/Error.tsx @@ -0,0 +1,61 @@ +"use client"; + +import { useEffect } from "react"; + +import { Button } from "~/components/ui/button"; +import Icon from "~/components/ui/icon"; + +import useRouter from "~/hooks/usePRouter"; +import { cn } from "~/lib/utils"; + +type Props = { + error: Error & { digest?: string }; + reset?: () => void; +}; + +export default function ErrorComponent({ error, reset }: Props) { + const router = useRouter(); + useEffect(() => { + console.error(error); + }, [error]); + + return ( +
+ +
+ Something went wrong + More details can be found in the console +
+ + {error.message} + + +
+ + +
+
+ ); +}