From e8a1a16b450ac816b4a7efc3d94870d3ddf9466d Mon Sep 17 00:00:00 2001 From: rsandb Date: Sat, 14 Jan 2023 01:01:30 -0600 Subject: [PATCH] move component into EmptyState --- website/src/components/EmptyState.tsx | 15 ++++++++++++--- website/src/pages/404.tsx | 20 +++----------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/website/src/components/EmptyState.tsx b/website/src/components/EmptyState.tsx index 3338fa21..8d82163c 100644 --- a/website/src/components/EmptyState.tsx +++ b/website/src/components/EmptyState.tsx @@ -1,4 +1,5 @@ -import { Box, Text, useColorModeValue } from "@chakra-ui/react"; +import { Box, Link, Text, useColorModeValue } from "@chakra-ui/react"; +import { useRouter } from "next/router"; import { FiAlertTriangle } from "react-icons/fi"; import { IconType } from "react-icons/lib"; @@ -9,12 +10,16 @@ type EmptyStateProps = { export const EmptyState = (props: EmptyStateProps) => { const backgroundColor = useColorModeValue("white", "gray.800"); + const router = useRouter(); return ( - + - {props.text} + {props.text} + router.back()} color="blue.500" textUnderlineOffset="3px"> + Click here to go back + ); @@ -23,3 +28,7 @@ export const EmptyState = (props: EmptyStateProps) => { export const TaskEmptyState = () => { return ; }; + +export const PageEmptyState = () => { + return ; +}; diff --git a/website/src/pages/404.tsx b/website/src/pages/404.tsx index f17102e3..30ab2ced 100644 --- a/website/src/pages/404.tsx +++ b/website/src/pages/404.tsx @@ -1,12 +1,9 @@ -import { Box, Center, Link, Text, useColorModeValue } from "@chakra-ui/react"; +import { Center, useColorModeValue } from "@chakra-ui/react"; import Head from "next/head"; -import { useRouter } from "next/router"; -import { FiAlertTriangle } from "react-icons/fi"; +import { PageEmptyState } from "src/components/EmptyState"; import { getTransparentHeaderLayout } from "src/components/Layout"; function Error() { - const router = useRouter(); - const backgroundColor = useColorModeValue("white", "gray.800"); const backgroundColor2 = useColorModeValue("gray.50", "gray.900"); return ( @@ -16,22 +13,11 @@ function Error() {
- - - - - Sorry, the page you are looking for does not exist. - router.back()} color="blue.500" textUnderlineOffset="3px"> - Click here to go back - - - - +
); } Error.getLayout = getTransparentHeaderLayout; - export default Error;