Initial commit

This commit is contained in:
forceoranj
2021-10-16 01:53:56 +02:00
commit ebdd8dccdd
104 changed files with 29770 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
/**
* @jest-environment jsdom
*/
import { render } from "@testing-library/react"
import { MemoryRouter } from "react-router-dom"
import NotFound from "../index"
describe("<NotFound />", () => {
it("renders", () => {
const tree = render(
<MemoryRouter>
{/*
@ts-expect-error */}
<NotFound />
</MemoryRouter>
).container.firstChild
expect(tree).toMatchSnapshot()
})
})

View File

@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<NotFound /> renders 1`] = `
<div
class="NotFound"
>
<p>
Oops, Page was not found!
</p>
</div>
`;

23
src/pages/NotFound/index.tsx Executable file
View File

@@ -0,0 +1,23 @@
import { memo } from "react"
import { RouteComponentProps } from "react-router-dom"
import { Helmet } from "react-helmet"
import styles from "./styles.module.scss"
type Props = RouteComponentProps
const NotFound = ({ staticContext }: Props) => {
// We have to check if staticContext exists
// because it will be undefined if rendered through a BrowserRoute
/* istanbul ignore next */
if (staticContext) staticContext.statusCode = 404
return (
<div className={styles.NotFound}>
<Helmet title="Oops" />
<p>Oops, Page was not found!</p>
</div>
)
}
export default memo(NotFound)

View File

@@ -0,0 +1,3 @@
.NotFound {
padding: 0 15px;
}