Skip to content

Commit

Permalink
Change Back button on Not Found page to redirect to the previous page (
Browse files Browse the repository at this point in the history
…#1877)

Co-authored-by: ani-kalpachka <[email protected]>
  • Loading branch information
ani-kalpachka and ani-kalpachka authored Jul 9, 2024
1 parent 6cb0d41 commit 04b266c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Stack, Typography } from '@mui/material'
import { Stack, Typography, Button } from '@mui/material'
import { styled } from '@mui/material/styles'

import LinkButton from 'components/common/LinkButton'
import theme from 'common/theme'

export const Root = styled(Stack)(() => ({
Expand All @@ -14,7 +13,7 @@ export const ErrorMessage = styled(Typography)(() => ({
maxWidth: theme.spacing(80),
}))

export const BackButton = styled(LinkButton)(() => ({
export const BackButton = styled(Button)(() => ({
color: theme.palette.primary.dark,
borderColor: theme.palette.primary.dark,
}))
9 changes: 7 additions & 2 deletions src/components/common/errors/NotFoundPage/NotFoundPage.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { useTranslation } from 'next-i18next'
import { useRouter } from 'next/router'
import { Grid } from '@mui/material'
import ArrowBackIcon from '@mui/icons-material/ArrowBack'

import { routes } from 'common/routes'
import Layout from 'components/client/layout/Layout'
import NotFoundIllustration from '../assets/NotFoundIllustration'

import { BackButton, ErrorMessage, Root } from './NotFoundPage.styled'

export default function NotFoundPage() {
const { t } = useTranslation('common')
const router = useRouter()

const handleBackClick = () => {
router.back()
}

return (
<Layout>
Expand All @@ -22,7 +27,7 @@ export default function NotFoundPage() {
size="large"
startIcon={<ArrowBackIcon />}
variant="outlined"
href={routes.index}>
onClick={handleBackClick}>
{t('errors.backButtonLabel')}
</BackButton>
</Root>
Expand Down

0 comments on commit 04b266c

Please sign in to comment.