Skip to content

Commit

Permalink
feat: update Error to use click event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanarldt committed Dec 31, 2024
1 parent dcd193c commit e2af0c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/web/vibes/soul/examples/pages/error/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function Preview() {
searchHref="#"
/>

<Error cta={{ label: 'Try again', href: '#' }} />
<Error cta={{ label: 'Try again', onRetry: () => null }} />

<Subscribe
action={action}
Expand Down
20 changes: 13 additions & 7 deletions apps/web/vibes/soul/sections/error/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ButtonLink } from '@/vibes/soul/primitives/button-link';
import { Button } from '@/vibes/soul/primitives/button';

interface Link {
interface Action {
label: string;
href: string;
onRetry: () => void;
}

interface Props {
title?: string;
subtitle?: string;
cta?: Link;
cta?: Action;
}

export function Error({
Expand All @@ -24,10 +24,16 @@ export function Error({
</h1>
<p className="text-lg text-contrast-500">{subtitle}</p>

{cta !== undefined && cta.href !== '' && cta.label !== '' && (
<ButtonLink className="mt-8" href={cta.href} size="large" type="button" variant="primary">
{cta !== undefined && cta.label !== '' && (
<Button
className="mt-8"
onClick={cta.onRetry}
size="large"
type="button"
variant="primary"
>
{cta.label}
</ButtonLink>
</Button>
)}
</div>
</section>
Expand Down

0 comments on commit e2af0c1

Please sign in to comment.