Open History to see the last commit
1import { CheckIcon } from "lucide-react";
2
3import { cn } from "../../lib/utils";
4import {
5 ADD_PROVIDER_WIZARD_STEPS,
6 resolveWizardNavigation,
7 type WizardNavigation,
8} from "./AddProviderInstanceDialog.logic";
9
10interface AddProviderInstanceWizardStepsProps {
11 readonly currentStep: number;
12 readonly summaries: readonly (string | null)[];
13 readonly instanceIdError: string | null;
14 readonly onNavigation: (navigation: WizardNavigation) => void;
15}
16
17export function AddProviderInstanceWizardSteps({
18 currentStep,
19 summaries,
20 instanceIdError,
21 onNavigation,
22}: AddProviderInstanceWizardStepsProps) {
23 return (
24 <ol
25 className="grid grid-cols-3 gap-1 rounded-xl bg-zinc-25 p-1 ring-1 ring-black/5 dark:bg-white/4 dark:ring-white/5"
26 role="list"
27 >
28 {ADD_PROVIDER_WIZARD_STEPS.map((step, index) => (
29 <li key={step} className="min-w-0">
30 <button
31 type="button"
32 className={cn(
33 "flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-lg px-2.5 py-2 text-left outline-none hover:bg-card focus-visible:ring-2 focus-visible:ring-ring max-sm:justify-center max-sm:px-2",
34 index === currentStep &&
35 "bg-card text-foreground shadow-xs ring-1 ring-black/5 hover:bg-card dark:shadow-none dark:ring-white/5",
36 )}
37 aria-current={index === currentStep ? "step" : undefined}
38 aria-label={`${step}, step ${index + 1}${index < currentStep && summaries[index] ? `, ${summaries[index]}` : ""}`}
39 onClick={() =>
40 onNavigation(
41 resolveWizardNavigation(currentStep, index, ADD_PROVIDER_WIZARD_STEPS.length, {
42 instanceIdError,
43 }),
44 )
45 }
46 >
47 <span
48 className={cn(
49 "grid size-5 shrink-0 place-items-center rounded-full text-sm font-medium ring-1",
50 index < currentStep
51 ? "bg-primary text-primary-foreground ring-primary"
52 : index === currentStep
53 ? "bg-primary/10 text-primary ring-primary/30"
54 : "bg-card text-muted-foreground ring-black/10 dark:bg-white/5 dark:ring-white/10",
55 )}
56 aria-hidden
57 >
58 {index < currentStep ? <CheckIcon className="size-4 shrink-0" /> : index + 1}
59 </span>
60 <span
61 className={cn(
62 "min-w-0 truncate text-sm font-medium max-sm:hidden",
63 index === currentStep ? "text-foreground" : "text-muted-foreground",
64 )}
65 >
66 {step}
67 </span>
68 </button>
69 </li>
70 ))}
71 </ol>
72 );
73}