move component into EmptyState

This commit is contained in:
rsandb
2023-01-14 01:01:30 -06:00
parent 3cc9301360
commit e8a1a16b45
2 changed files with 15 additions and 20 deletions
+12 -3
View File
@@ -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 (
<Box bg={backgroundColor} p="10" borderRadius="xl" shadow="base">
<Box display="flex" flexDirection="column" alignItems="center" gap="8">
<Box display="flex" flexDirection="column" alignItems="center" gap="8" fontSize="lg">
<props.icon size="30" color="DarkOrange" />
<Text fontSize="lg">{props.text}</Text>
<Text>{props.text}</Text>
<Link onClick={() => router.back()} color="blue.500" textUnderlineOffset="3px">
<Text>Click here to go back</Text>
</Link>
</Box>
</Box>
);
@@ -23,3 +28,7 @@ export const EmptyState = (props: EmptyStateProps) => {
export const TaskEmptyState = () => {
return <EmptyState text="Looks like no tasks were found." icon={FiAlertTriangle} />;
};
export const PageEmptyState = () => {
return <EmptyState text="Sorry, the page you are looking for does not exist." icon={FiAlertTriangle} />;
};
+3 -17
View File
@@ -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() {
<meta name="404" content="Sorry, this page doesn't exist." />
</Head>
<Center bg={backgroundColor2} flexDirection="column" gap="4" fontSize="lg" className="subpixel-antialiased">
<Box bg={backgroundColor} p="10" borderRadius="xl" shadow="base">
<Box display="flex" flexDirection="column" alignItems="center" gap="8">
<FiAlertTriangle size="30" color="DarkOrange" />
<Box display="flex" flexDirection="column" alignItems="center" gap="3">
<Text>Sorry, the page you are looking for does not exist.</Text>
<Link onClick={() => router.back()} color="blue.500" textUnderlineOffset="3px">
<Text>Click here to go back</Text>
</Link>
</Box>
</Box>
</Box>
<PageEmptyState />
</Center>
</>
);
}
Error.getLayout = getTransparentHeaderLayout;
export default Error;