Connect, collaborate, and grow with a community of TypeScript developers
Create Challenge Steps transitions (#366)
Mir Ashifbfa7c85e895f
diff --git a/apps/web/src/components/wizard/NextBack.tsx b/apps/web/src/components/wizard/NextBack.tsxindex 147eb9e1..22b3ab6f 100644--- a/apps/web/src/components/wizard/NextBack.tsx+++ b/apps/web/src/components/wizard/NextBack.tsx@@ -29,7 +29,7 @@ export function NextBack({ current, onChange, onNext, onSubmit }: Props) {</Button>) : (<Button- className="w-[79px] rounded-full transition-all duration-300 ease-out hover:pl-8 active:scale-95"+ className="w-[79px] rounded-full transition-all duration-300 ease-out active:scale-95"onClick={onNext}>Nextdiff --git a/apps/web/src/components/wizard/Steps.tsx b/apps/web/src/components/wizard/Steps.tsxindex 3dfaafb2..630d7d39 100644--- a/apps/web/src/components/wizard/Steps.tsx+++ b/apps/web/src/components/wizard/Steps.tsx@@ -1,4 +1,5 @@import { Check } from '@repo/ui/icons';+import clsx from 'clsx';import { type Step } from '.';interface Props<T extends Step> {@@ -14,50 +15,59 @@ export function Steps<T extends Step>({ steps, current, onChange }: Props<T>) {className="flex w-full flex-wrap items-start justify-start gap-2 divide-y sm:justify-center md:w-10/12 md:divide-y-0"role="list">- {steps.map((step, stepIdx) => (- <li- className={`relative rounded-full ${- current > stepIdx ? 'bg-emerald-500/20' : 'bg-gray-500/10'- } py-1 pl-[0.4rem] pr-3 md:flex`}- key={step.name}- >- {current > stepIdx ? (+ {steps.map((step, stepIdx) => {+ const isCompleted = current > stepIdx;+ const isCurrent = current === stepIdx;+ const isFuture = !isCompleted && !isCurrent;+ return (+ <li+ className={clsx(+ 'relative rounded-full py-1 pl-[0.4rem] pr-3 transition-all duration-300 ease-in-out md:flex',+ isCompleted ? 'bg-emerald-500/20' : 'bg-gray-500/10',+ )}+ key={step.name}+ ><a- className="group flex w-full items-center"+ className={clsx(+ 'group flex w-full items-center',+ isCompleted && 'pointer-events-none',+ )}href="#"onClick={() => onChange(stepIdx)}><span className="flex items-center gap-2 text-sm font-medium">- <span className="flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full bg-emerald-700 text-white dark:bg-emerald-400">- <Check- className="h-3 w-3 stroke-white stroke-[3] dark:stroke-black"- size={20}- />+ <span+ className={clsx(+ 'flex flex-shrink-0 items-center justify-center rounded-full',+ isCompleted && 'h-4 w-4 bg-emerald-700 text-white dark:bg-emerald-400',+ (isCurrent || isFuture) && 'h-5 w-8 bg-gray-500/30 p-2 dark:bg-gray-500/50',+ )}+ >+ {isCompleted ? (+ <Check+ className="h-3 w-3 stroke-white stroke-[3] dark:stroke-black"+ size={20}+ />+ ) : (+ <span className={clsx('text-xs', !isCurrent && 'text-gray-500')}>+ {stepIdx + 1}+ </span>+ )}</span>- <span className="text-sm font-medium text-emerald-700 dark:text-emerald-500">+ <span+ className={clsx(+ 'text-sm font-medium',+ isCompleted && 'text-emerald-700 dark:text-emerald-500',+ isFuture && 'text-gray-500',+ )}+ >{step.name}</span></span></a>- ) : current === stepIdx ? (- <span aria-current="step" className="flex items-center gap-2 text-sm font-medium">- <span className="flex h-5 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-500/30 p-2 dark:bg-gray-500/50">- <span className="text-xs">{step.id}</span>- </span>- <span className="text-sm font-medium">{step.name}</span>- </span>- ) : (- <span className="group flex items-center">- <span className="flex items-center gap-2 text-sm font-medium">- <span className="flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full">- <span className="text-xs text-gray-500">{step.id}</span>- </span>- <span className="text-sm font-medium text-gray-500 ">{step.name}</span>- </span>- </span>- )}- </li>- ))}+ </li>+ );+ })}</ol></nav>);