website refactor
This commit is contained in:
@@ -1,55 +1,29 @@
|
||||
import React from 'react';
|
||||
import { Box } from './primitives/Box';
|
||||
import { Button } from './Button';
|
||||
import { RefreshCw, Home } from 'lucide-react';
|
||||
|
||||
interface ErrorActionButtonsProps {
|
||||
export interface ErrorActionButtonsProps {
|
||||
onRetry?: () => void;
|
||||
onHomeClick: () => void;
|
||||
showRetry?: boolean;
|
||||
homeLabel?: string;
|
||||
onGoHome?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* ErrorActionButtons
|
||||
*
|
||||
* Action buttons for error pages (Try Again, Go Home)
|
||||
* Provides consistent styling and behavior.
|
||||
* All navigation callbacks must be provided by the caller.
|
||||
*/
|
||||
export function ErrorActionButtons({
|
||||
onRetry,
|
||||
onHomeClick,
|
||||
showRetry = false,
|
||||
homeLabel = 'Drive home',
|
||||
}: ErrorActionButtonsProps) {
|
||||
if (showRetry && onRetry) {
|
||||
return (
|
||||
<div className="flex items-center justify-center gap-3 pt-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onRetry}
|
||||
className="inline-flex items-center justify-center rounded-md bg-primary-blue px-4 py-2 text-sm font-medium text-white hover:bg-primary-blue/80 transition-colors"
|
||||
>
|
||||
Try again
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onHomeClick}
|
||||
className="inline-flex items-center justify-center rounded-md bg-iron-gray px-4 py-2 text-sm font-medium text-white hover:bg-iron-gray/80 transition-colors"
|
||||
>
|
||||
Go home
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export const ErrorActionButtons = ({
|
||||
onRetry,
|
||||
onGoHome
|
||||
}: ErrorActionButtonsProps) => {
|
||||
return (
|
||||
<div className="pt-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onHomeClick}
|
||||
className="inline-flex items-center justify-center rounded-md bg-primary-blue px-4 py-2 text-sm font-medium text-white hover:bg-primary-blue/80 transition-colors"
|
||||
>
|
||||
{homeLabel}
|
||||
</button>
|
||||
</div>
|
||||
<Box display="flex" alignItems="center" gap={4}>
|
||||
{onRetry && (
|
||||
<Button variant="primary" onClick={onRetry} icon={<RefreshCw size={16} />}>
|
||||
Retry
|
||||
</Button>
|
||||
)}
|
||||
{onGoHome && (
|
||||
<Button variant="secondary" onClick={onGoHome} icon={<Home size={16} />}>
|
||||
Go Home
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user