-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Brad Garropy <[email protected]>
- Loading branch information
1 parent
a840dd3
commit 81c6a7d
Showing
9 changed files
with
128 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
import {render, screen} from "@testing-library/react" | ||
|
||
import FourOhFour from "~/components/FourOhFour" | ||
import {mockPostFrontmatter, mockVideos} from "~/test-utils/mocks" | ||
|
||
test("shows 404", () => { | ||
render(<FourOhFour />) | ||
expect(screen.getByText("404")) | ||
render(<FourOhFour post={mockPostFrontmatter} videos={mockVideos} />) | ||
|
||
expect(screen.getByText("There's nothing here.")) | ||
expect(screen.getByText(mockPostFrontmatter.title)) | ||
|
||
mockVideos.forEach(mockVideo => { | ||
expect(screen.getByAltText(mockVideo.title)) | ||
}) | ||
}) |
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
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 |
---|---|---|
@@ -1,16 +1,39 @@ | ||
import SEO from "@bradgarropy/next-seo" | ||
import type {GetStaticProps} from "next" | ||
import type {FC} from "react" | ||
|
||
import FourOhFour from "~/components/FourOhFour" | ||
import Layout from "~/components/Layout" | ||
import type {PostFrontmatter} from "~/types/post" | ||
import type {Video} from "~/types/video" | ||
import {getLatestPost} from "~/utils/posts" | ||
import {getLatestVideos} from "~/utils/videos" | ||
|
||
const NotFoundPage: FC = () => { | ||
type NotFoundPageProps = { | ||
latestPost: PostFrontmatter | ||
latestVideos: Video[] | ||
} | ||
|
||
const NotFoundPage: FC<NotFoundPageProps> = ({latestPost, latestVideos}) => { | ||
return ( | ||
<Layout> | ||
<SEO title="🤷🏼♂️ not found" /> | ||
<FourOhFour /> | ||
<FourOhFour post={latestPost} videos={latestVideos} /> | ||
</Layout> | ||
) | ||
} | ||
|
||
const getStaticProps: GetStaticProps = async () => { | ||
const latestPost = getLatestPost() | ||
const latestVideos = await getLatestVideos(2) | ||
|
||
return { | ||
props: { | ||
latestPost, | ||
latestVideos, | ||
}, | ||
} | ||
} | ||
|
||
export default NotFoundPage | ||
export {getStaticProps} |
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
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
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
81c6a7d
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:
bradgarropy – ./
bradgarropy-bradgarropy.vercel.app
bradgarropy.vercel.app
bradgarropy.com
bradgarropy-git-master-bradgarropy.vercel.app
www.bradgarropy.com