File
Blob: src/client/components/ui/form-actions.tsx
| 1 | import { Button } from "@/client/components/ui/button"; |
| 2 | import { ErrorBanner } from "@/client/components/ui/error-banner"; |
| 3 | |
| 4 | interface FormActionsProps { |
| 5 | pending: boolean; |
| 6 | error?: string | null; |
| 7 | onDismissError?: () => void; |
| 8 | submitLabel: string; |
| 9 | onCancel: () => void; |
| 10 | submitDisabled?: boolean; |
| 11 | } |
| 12 | |
| 13 | export const FormActions = ({ |
| 14 | pending, |
| 15 | error, |
| 16 | onDismissError, |
| 17 | submitLabel, |
| 18 | onCancel, |
| 19 | submitDisabled, |
| 20 | }: FormActionsProps) => ( |
| 21 | <> |
| 22 | {error ? <ErrorBanner message={error} onDismiss={onDismissError} /> : null} |
| 23 | <div className="flex flex-wrap justify-end gap-2"> |
| 24 | <Button type="button" variant="ghost" onClick={onCancel} disabled={pending}> |
| 25 | Cancel |
| 26 | </Button> |
| 27 | <Button type="submit" loading={pending} disabled={submitDisabled}> |
| 28 | {submitLabel} |
| 29 | </Button> |
| 30 | </div> |
| 31 | </> |
| 32 | ); |