From f254711d85f9dd352fbc8fa7dc0fc9a82863de78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Mon, 19 Dec 2022 11:30:54 -0700 Subject: [PATCH] Makes WizardForm translation agnostic (#6111) --- apps/web/pages/auth/setup/index.tsx | 9 ++++++++- packages/ui/v2/core/Stepper.tsx | 19 +++++++------------ packages/ui/v2/core/WizardForm.tsx | 20 +++++++++----------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/apps/web/pages/auth/setup/index.tsx b/apps/web/pages/auth/setup/index.tsx index 750844682e..dfc472042d 100644 --- a/apps/web/pages/auth/setup/index.tsx +++ b/apps/web/pages/auth/setup/index.tsx @@ -35,7 +35,14 @@ export default function Setup(props: inferSSRProps) { return ( <>
- + t("current_step_of_total", { currentStep, maxSteps })} + />
); diff --git a/packages/ui/v2/core/Stepper.tsx b/packages/ui/v2/core/Stepper.tsx index bcac08f295..387b6ed7ad 100644 --- a/packages/ui/v2/core/Stepper.tsx +++ b/packages/ui/v2/core/Stepper.tsx @@ -1,8 +1,5 @@ -import { TFunction } from "next-i18next"; import Link from "next/link"; -import { useLocale } from "@calcom/lib/hooks/useLocale"; - type DefaultStep = { title: string; }; @@ -12,20 +9,18 @@ function Stepper(props: { step: number; steps: T[]; disableSteps?: boolean; - t?: TFunction; + stepLabel?: (currentStep: number, totalSteps: number) => string; }) { - let { t } = useLocale(); - if (props.t) { - t = props.t; - } - const { href, steps } = props; + const { + href, + steps, + stepLabel = (currentStep, totalSteps) => `Step ${currentStep} of ${totalSteps}`, + } = props; return ( <> {steps.length > 1 && (