-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: NotFoundPage lazyload parallax
- Loading branch information
Showing
2 changed files
with
43 additions
and
18 deletions.
There are no files selected for viewing
25 changes: 7 additions & 18 deletions
25
src/components/NotFoundPage.tsx → ...nents/NotFoundPage/ParallaxCubes.lazy.tsx
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Link } from '@tanstack/react-router' | ||
import { Layout } from '../layout' | ||
import { PrimaryButton } from '../ui' | ||
import { Suspense, lazy, type ReactNode } from 'react' | ||
|
||
const ParallaxCubesWrapper = lazy(() => import('./ParallaxCubes.lazy')) | ||
|
||
export function NotFoundPage() { | ||
return ( | ||
<Suspense fallback={<PageContent />}> | ||
<ParallaxCubesWrapper> | ||
{(renderParallaxCubes) => <PageContent renderParallaxCubes={renderParallaxCubes} />} | ||
</ParallaxCubesWrapper> | ||
</Suspense> | ||
) | ||
} | ||
|
||
type NotFoundInnerProps = { renderParallaxCubes?: () => ReactNode } | ||
function PageContent({ renderParallaxCubes }: NotFoundInnerProps) { | ||
return ( | ||
<Layout> | ||
<div className='relative flex-1 rounded-xl bg-black-80 p-16'> | ||
{renderParallaxCubes?.()} | ||
<div className='relative w-min'> | ||
<p className='title-lg mb-4 whitespace-nowrap'>Lost in cuberspace?</p> | ||
<p className='text-large mb-8 inline-block'> | ||
Sorry, the page you're looking for seems to have gone on a digital adventure of its own | ||
</p> | ||
<Link to='/'> | ||
<PrimaryButton>Go back to dashboard</PrimaryButton> | ||
</Link> | ||
</div> | ||
</div> | ||
</Layout> | ||
) | ||
} |