-
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.
- Loading branch information
Showing
8 changed files
with
120 additions
and
7 deletions.
There are no files selected for viewing
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
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,21 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import DeadEnd from './DeadEnd' | ||
|
||
const meta: Meta<typeof DeadEnd> = { | ||
component: DeadEnd, | ||
tags: ['autodocs'], | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof DeadEnd> | ||
|
||
/** DeadEnd tells users when their request can't be completed and they have to turn back. */ | ||
export const Primary: Story = { | ||
args: { | ||
title: 'Page not found', | ||
desc: "Sorry, we couldn't find the page you were looking for.", | ||
c2a: { text: 'Go home', to: '#' }, | ||
}, | ||
} |
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,45 @@ | ||
import { Link } from '@redwoodjs/router' | ||
|
||
import PageHead from '../PageHead/PageHead' | ||
import Typ from '../Typ/Typ' | ||
|
||
export type Props = { | ||
title: string | ||
desc: string | string[] | ||
c2a: { text: string } & ({ href: string } | { to: string }) | ||
} | ||
|
||
const DeadEnd = (props: Props) => { | ||
const { title, c2a } = props | ||
const desc = Array.isArray(props.desc) ? props.desc : [props.desc] | ||
|
||
const action = (() => { | ||
if ('href' in c2a) { | ||
return ( | ||
<a className="button is-primary mt-3" href={c2a.href}> | ||
{c2a.text} | ||
</a> | ||
) | ||
} else { | ||
return ( | ||
<Link className="button is-primary mt-3" to={c2a.to}> | ||
{c2a.text} | ||
</Link> | ||
) | ||
} | ||
})() | ||
|
||
return ( | ||
<div className="has-text-centered mx-auto" style={{ maxWidth: '600px' }}> | ||
<PageHead title={title} desc={desc.join(' ')} /> | ||
{desc.map((p, i) => ( | ||
<Typ x="p" key={i}> | ||
{p} | ||
</Typ> | ||
))} | ||
{action} | ||
</div> | ||
) | ||
} | ||
|
||
export default DeadEnd |
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
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