diff --git a/app/components/errors.tsx b/app/components/errors.tsx index 475bde94e..75f41c08e 100644 --- a/app/components/errors.tsx +++ b/app/components/errors.tsx @@ -4,11 +4,19 @@ import * as React from 'react' import { useMatches } from 'react-router' import { type MdxListItem } from '#app/types.ts' import { getErrorMessage } from '#app/utils/misc.ts' +import { + type NotFoundMatch, + sortNotFoundMatches, +} from '#app/utils/not-found-matches.ts' +import { notFoundQueryFromPathname } from '#app/utils/not-found-query.ts' import { ArrowLink } from './arrow-button.tsx' +import { Grid } from './grid.tsx' import { Facepalm, Grimmacing, MissingSomething } from './kifs.tsx' import { BlogSection } from './sections/blog-section.tsx' +import { HeaderSection } from './sections/header-section.tsx' import { HeroSection, type HeroSectionProps } from './sections/hero-section.tsx' -import { H2, H6 } from './typography.tsx' +import { Spacer } from './spacer.tsx' +import { H2, H4, H6 } from './typography.tsx' function RedBox({ error }: { error: Error }) { const [isVisible, setIsVisible] = React.useState(true) @@ -54,18 +62,21 @@ function RedBox({ error }: { error: Error }) { function ErrorPage({ error, articles, + possibleMatches, + possibleMatchesQuery, heroProps, }: { error?: Error articles?: Array + possibleMatches?: Array + possibleMatchesQuery?: string heroProps: HeroSectionProps }) { - if (articles?.length) { - Object.assign(heroProps, { - arrowUrl: '#articles', - arrowLabel: 'But wait, there is more!', - }) - } + const resolvedHeroProps: HeroSectionProps = possibleMatches?.length + ? { ...heroProps, arrowUrl: '#possible-matches', arrowLabel: 'Possible matches' } + : articles?.length + ? { ...heroProps, arrowUrl: '#articles', arrowLabel: 'But wait, there is more!' } + : heroProps return ( <>