feat: add 404 page

This commit is contained in:
jinhojang6 2023-08-24 04:07:19 +09:00
parent 78d4292368
commit 9290b9c7a0
5 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,45 @@
import { uiConfigs } from '@/configs/ui.configs'
import { Button, Typography } from '@acid-info/lsd-react'
import styled from '@emotion/styled'
import Link from 'next/link'
const NotFound = () => {
return (
<Container>
<Title genericFontFamily="serif" variant="h3">
Page not found
</Title>
<Description variant="body1">
Sorry, the page you are looking for doesnt exist or has been moved.
<br />
Try searching our site.
</Description>
<Link href="/search">
<SearchButton size="large">Go to search</SearchButton>
</Link>
</Container>
)
}
export default NotFound
const Container = styled.div`
display: flex;
flex-direction: column;
align-items: center;
margin-top: calc(120px + ${uiConfigs.navbarRenderedHeight}px);
`
const Title = styled(Typography)`
margin-bottom: 16px;
`
const Description = styled(Typography)`
margin-bottom: 48px;
max-width: 510px;
text-align: center;
`
const SearchButton = styled(Button)`
width: fit-content;
`

View File

@ -0,0 +1 @@
export { default as NotFound } from './NotFound'

View File

@ -0,0 +1,25 @@
import { Main } from '@/components/Main'
import { NavBarProps } from '@/components/NavBar/NavBar'
import { PropsWithChildren, useMemo } from 'react'
import { MainProps } from '../../components/Main/Main'
import { AppBar } from '../../components/NavBar'
interface Props {
navbarProps?: NavBarProps
mainProps?: Partial<MainProps>
}
export default function DefaultLayout(props: PropsWithChildren<Props>) {
const { mainProps = {}, navbarProps = {} } = props
const navbarDefaultState = useMemo(
() => navbarProps.defaultState ?? { showTitle: true },
[navbarProps],
)
return (
<>
<AppBar {...navbarProps} defaultState={navbarDefaultState} />
<Main {...mainProps}>{props.children}</Main>
</>
)
}

View File

@ -0,0 +1 @@
export { default as DefaultLayout } from './NotFound.layout'

24
src/pages/404.tsx Normal file
View File

@ -0,0 +1,24 @@
import { NotFound } from '@/components/NotFound'
import { SEO } from '@/components/SEO'
import NotFoundLayout from '@/layouts/NotFoundLayout/NotFound.layout'
import { ReactNode } from 'react'
const NotFoundPage = () => {
return (
<>
<SEO
title={'Not Found'}
description={'Description'}
imageUrl={undefined}
tags={[]}
/>
<NotFound />
</>
)
}
NotFoundPage.getLayout = function getLayout(page: ReactNode) {
return <NotFoundLayout>{page}</NotFoundLayout>
}
export default NotFoundPage