-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
950244e
commit 112ee99
Showing
9 changed files
with
132 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { FC } from "react"; | ||
import { Box, Heading, Stack, Text, Button, Flex } from "@chakra-ui/core"; | ||
import Link from "next/link"; | ||
|
||
interface IProps { | ||
statusCode: number; | ||
} | ||
|
||
const IndexPageComponent: FC<IProps> = ({ statusCode }) => { | ||
const heightOfNavbar: string = "74px"; | ||
const containerPadding: string = "1rem"; | ||
|
||
const signOutButtonNode = () => { | ||
return ( | ||
<Box> | ||
<Link href="/"> | ||
<Button variantColor="cyan">Return to the home page</Button> | ||
</Link> | ||
</Box> | ||
); | ||
}; | ||
|
||
return ( | ||
<Stack> | ||
<Flex | ||
minH={`calc(100vh - ${heightOfNavbar} - ${containerPadding}*2)`} | ||
justifyContent="center" | ||
alignItems="center" | ||
> | ||
<Stack spacing={4} maxW="xl" mx="auto"> | ||
<Heading textAlign="center">Nextjs Hasura Boilerplate</Heading> | ||
<Text fontSize="xl" lineHeight="tall" textAlign="center"> | ||
{statusCode | ||
? `An error ${statusCode} occurred on server` | ||
: "An error occurred on client"} | ||
</Text> | ||
<Box> | ||
<Stack isInline align="center" justifyContent="center"> | ||
{signOutButtonNode()} | ||
</Stack> | ||
</Box> | ||
</Stack> | ||
</Flex> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default IndexPageComponent; |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
// https://nextjs.org/docs/api-reference/next.config.js/react-strict-mode | ||
reactStrictMode: true, | ||
}; |
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,17 @@ | ||
import React from "react"; | ||
import Head from "next/head"; | ||
import Page from "components/pages/error"; | ||
import { NextPage } from "next"; | ||
|
||
const Custom404Page: NextPage = () => { | ||
return ( | ||
<> | ||
<Head> | ||
<title>Error Page</title> | ||
</Head> | ||
<Page statusCode={404} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Custom404Page; |
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,27 @@ | ||
import React from "react"; | ||
import Head from "next/head"; | ||
import Page from "components/pages/error"; | ||
import { NextPage } from "next"; | ||
|
||
interface iProps { | ||
statusCode: number; | ||
} | ||
|
||
const Error: NextPage<iProps> = ({ statusCode }) => { | ||
return ( | ||
<> | ||
<Head> | ||
<title>Error Page</title> | ||
</Head> | ||
<Page statusCode={statusCode} /> | ||
</> | ||
); | ||
}; | ||
|
||
Error.getInitialProps = ({ res, err }) => { | ||
const statusCode = res ? res.statusCode : err ? err.statusCode : 404; | ||
|
||
return { statusCode }; | ||
}; | ||
|
||
export default Error; |
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 |
---|---|---|
|
@@ -4,5 +4,6 @@ export default interface ISession { | |
email: string; | ||
image: string; | ||
}; | ||
id: number; | ||
expires: string; | ||
} |
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,6 @@ | ||
export default interface iToken { | ||
id: number; | ||
email: string; | ||
name: string; | ||
picture: string; | ||
} |
112ee99
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: