|
| 1 | +import { NextSeo } from 'next-seo'; |
| 2 | +import Link from 'next/link'; |
| 3 | +import AJ404 from '@/components/global/icons/AJ404'; |
| 4 | + |
| 5 | +import { GetStaticPropsContext, InferGetStaticPropsType } from 'next'; |
| 6 | +import builder from '@builder.io/react'; |
| 7 | +import Layout from '@/layout/Layout'; |
| 8 | + |
| 9 | +export async function getStaticProps({ |
| 10 | + params, |
| 11 | +}: GetStaticPropsContext<{ page: string[] }>) { |
| 12 | + console.log(JSON.stringify(params)); |
| 13 | + const [header, footer] = await Promise.all([ |
| 14 | + builder.get('header').promise(), |
| 15 | + builder.get('footer').promise(), |
| 16 | + ]); |
| 17 | + |
| 18 | + return { |
| 19 | + props: { |
| 20 | + header: header || null, |
| 21 | + footer: footer || null, |
| 22 | + }, |
| 23 | + revalidate: 5, |
| 24 | + }; |
| 25 | +} |
| 26 | + |
| 27 | +export default function Custom404({ |
| 28 | + header, |
| 29 | + footer, |
| 30 | +}: InferGetStaticPropsType<typeof getStaticProps>) { |
| 31 | + return ( |
| 32 | + <> |
| 33 | + <NextSeo title="404 | Not Found" noindex={true}></NextSeo> |
| 34 | + |
| 35 | + <Layout header={header} footer={footer}> |
| 36 | + <section className="grid content-start grid-cols-1 gap-10 p-4 text-center justify-items-center"> |
| 37 | + <AJ404 /> |
| 38 | + <h1 className="text-5xl lg:text-6xl"> |
| 39 | + Uh oh, that page doesn't seem to exist. |
| 40 | + </h1> |
| 41 | + <h2 className="font-sans text-4xl lg:text-5xl"> |
| 42 | + Were you looking for{' '} |
| 43 | + {/* add some logic here to say which route they clicked? */} |
| 44 | + <Link href="/courses"> |
| 45 | + <a className="underline text-secondary-600">Courses</a> |
| 46 | + </Link> |
| 47 | + </h2> |
| 48 | + </section> |
| 49 | + </Layout> |
| 50 | + </> |
| 51 | + ); |
| 52 | +} |
0 commit comments