From b71bc31eec1355bed92e97b6e82ff1cd00095022 Mon Sep 17 00:00:00 2001 From: Andrew Aquino Date: Tue, 16 Jun 2026 12:00:56 -0700 Subject: [PATCH] feat: change StepDivider color to green when previous step is completed (#26394) ref DEVEX-482 --- .../TemplateBuilder/SelectionSummary.tsx | 92 +++++++++++-------- 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/site/src/pages/TemplateBuilder/SelectionSummary.tsx b/site/src/pages/TemplateBuilder/SelectionSummary.tsx index 20fea1f00b..ec1bcda97a 100644 --- a/site/src/pages/TemplateBuilder/SelectionSummary.tsx +++ b/site/src/pages/TemplateBuilder/SelectionSummary.tsx @@ -1,8 +1,13 @@ -import { cva, type VariantProps } from "class-variance-authority"; +import { cva } from "class-variance-authority"; import { XIcon } from "lucide-react"; +import { createContext, type PropsWithChildren, useContext } from "react"; import { Button } from "#/components/Button/Button"; import { cn } from "#/utils/cn"; +type Variant = "complete" | "current" | "upcoming" | null | undefined; + +const VariantContext = createContext(null); + type SelectedTemplate = { name: string; iconUrl?: string; @@ -36,28 +41,28 @@ export const SelectionSummary: React.FC = ({

Selection

- - Base Template - - {selectedTemplate ? ( - - ) : ( - - )} - - Modules - - {selectedModules ? ( - - ) : ( - - )} - - Customizations - + + Base Template + {selectedTemplate ? ( + + ) : ( + + )} + + + Modules + {selectedModules ? ( + + ) : ( + + )} + + + Customizations +
); @@ -68,8 +73,8 @@ const stepCircleVariants = cva( { variants: { variant: { - complete: "border-border-success", - current: "border-content-primary", + complete: "border-border-success bg-surface-green", + current: "border-border-success", upcoming: "border-border text-content-secondary", }, }, @@ -86,16 +91,13 @@ const stepLabelVariants = cva("font-normal mr-2", { }, }); -type StepIndicatorProps = VariantProps & { +type StepIndicatorProps = PropsWithChildren<{ step: number; - children: React.ReactNode; -}; +}>; + +const StepIndicator: React.FC = ({ step, children }) => { + const variant = useContext(VariantContext); -const StepIndicator: React.FC = ({ - step, - variant, - children, -}) => { return (
{step}
@@ -104,14 +106,30 @@ const StepIndicator: React.FC = ({ ); }; -const StepDivider: React.FC<{ - children?: React.ReactNode; +const stepDividerVariants = cva( + "border-0 border-l border-solid mx-4 -translate-x-px", + { + variants: { + variant: { + complete: "border-border-success", + current: "border-border", + upcoming: "border-border", + }, + }, + }, +); + +type StepDividerProps = PropsWithChildren<{ className?: string; -}> = ({ children, className }) => { +}>; + +const StepDivider: React.FC = ({ className, children }) => { + const variant = useContext(VariantContext); + return (