Files
calendar/packages/ui/components/TokenHandler/TokenHandler.tsx
T
Alex van AndelandGitHub be404436d7 fix: Do not self import @calcom/ui (#20050)
* fix: Do not self import @calcom/ui

* Make translations optional

* Fix mocking implementation of Button (never worked)

* Ensure other libraries can resolve AppListCard
2025-03-13 18:17:42 +00:00

44 lines
979 B
TypeScript

// TODO: This file is currently unused.
import { Label } from "../form/inputs/Label";
import { Input } from "../form/inputs/TextField";
type Digit = {
value: number;
onChange: () => void;
};
type Translations = {
labelText?: string;
};
type PropType = {
digits: Digit[];
digitClassName: string;
translations?: Translations;
};
const TokenHandler = ({ digits, digitClassName, translations }: PropType) => {
const { labelText = "Code" } = translations ?? {};
return (
<div>
<Label htmlFor="code">{labelText}</Label>
<div className="flex flex-row justify-between">
{digits.map((element, index) => (
<Input
key={index}
className={digitClassName}
name={`2fa${index + 1}`}
inputMode="decimal"
{...element}
autoFocus={index === 0}
autoComplete="one-time-code"
/>
))}
</div>
</div>
);
};
export default TokenHandler;