metis-desk/packages/rdx-ui/src/components/form-step-actions.tsx
David 6b086e17f2 Add visual regression tests for UI components using Playwright
- Implemented a new test suite in `visual-audit-ui.test.py` to perform visual audits on the UI.
- Tests include checking row contrast, wizard geometry, focus behavior, and review headers across different screen sizes.
- Utilizes Playwright for browser automation and captures visual snapshots for comparison.
- Ensures that the tests run against a synthetic session state for accurate results.
2026-10-21 19:31:09 +02:00

49 lines
1.2 KiB
TypeScript

import { Button } from "@repo/shadcn-ui/components/button";
import { ChevronLeftIcon, ChevronRightIcon } from "../lib/icons";
import { FormActions } from "./form-dialog";
/** Acciones de formulario completo o por pasos; el consumidor aporta navegación y textos. */
export function FormStepActions({
step,
total,
pending,
canContinue,
onPrevious,
previousLabel,
nextLabel,
saveLabel,
}: {
step: number | undefined;
total: number;
pending: boolean;
canContinue: boolean;
onPrevious: () => void;
previousLabel: string;
nextLabel: string;
saveLabel: string;
}) {
const hasNext = step !== undefined && step < total;
return (
<FormActions cancelDisabled={pending}>
{step !== undefined && (
<Button
disabled={pending || step === 1}
onClick={onPrevious}
type="button"
variant="outline"
>
<ChevronLeftIcon aria-hidden="true" className="size-4" />
{previousLabel}
</Button>
)}
<Button disabled={pending || !canContinue} type="submit">
{hasNext ? nextLabel : saveLabel}
{hasNext && <ChevronRightIcon aria-hidden="true" className="size-4" />}
</Button>
</FormActions>
);
}