mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 18:44:05 +02:00
Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: James Brunton <[email protected]> Co-authored-by: Reece Browne <[email protected]> Co-authored-by: ConnorYoh <[email protected]> Co-authored-by: Reece <[email protected]> Co-authored-by: EthanHealy01 <[email protected]> Co-authored-by: Ludy <[email protected]>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import "@shared/components/StepIndicator.css";
|
|
|
|
export interface StepIndicatorProps {
|
|
/** Total number of steps. */
|
|
total: number;
|
|
/** Current step, 1-based. */
|
|
current: number;
|
|
size?: "sm" | "md";
|
|
className?: string;
|
|
}
|
|
|
|
/**
|
|
* A segmented step/progress rail for multi-step flows (wizards, onboarding).
|
|
* Segments before `current` read as completed, the `current` segment is
|
|
* emphasised, and the rest are upcoming.
|
|
*/
|
|
export function StepIndicator({
|
|
total,
|
|
current,
|
|
size = "md",
|
|
className,
|
|
}: StepIndicatorProps) {
|
|
return (
|
|
<div
|
|
className={["sui-steps", `sui-steps--${size}`, className ?? ""]
|
|
.filter(Boolean)
|
|
.join(" ")}
|
|
role="progressbar"
|
|
aria-valuemin={1}
|
|
aria-valuemax={total}
|
|
aria-valuenow={current}
|
|
>
|
|
{Array.from({ length: total }, (_, i) => {
|
|
const step = i + 1;
|
|
const state =
|
|
step < current ? "done" : step === current ? "current" : "upcoming";
|
|
return (
|
|
<span key={step} className="sui-steps__bar" data-state={state} />
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|