Replaces placeholder colors/type-scale with the documented Figma design system (§1), and rebuilds login as three screens matching the doc exactly: role selection, phone entry, and 6-box OTP verification with countdown resend. Fixes a real bug along the way: normalizeIranianPhone stripped Persian-digit keyboard input entirely instead of converting it (\D matches non-ASCII digits too) -- added toLatinDigits/toPersianDigits and verified the round-trip in isolation.
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { Slot } from "@radix-ui/react-slot";
|
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
import * as React from "react";
|
|
import { cn } from "@/lib/utils/cn";
|
|
|
|
const buttonVariants = cva(
|
|
"inline-flex items-center justify-center gap-2 rounded-full text-body-medium font-semibold transition-colors disabled:pointer-events-none disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
outline: "border border-border bg-transparent hover:bg-muted",
|
|
ghost: "bg-transparent hover:bg-muted",
|
|
},
|
|
size: {
|
|
default: "h-12 px-4 text-body-large",
|
|
sm: "h-9 px-3 text-label",
|
|
lg: "h-12 px-6 text-body-large",
|
|
icon: "h-10 w-10",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "primary",
|
|
size: "default",
|
|
},
|
|
},
|
|
);
|
|
|
|
export interface ButtonProps
|
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
VariantProps<typeof buttonVariants> {
|
|
asChild?: boolean;
|
|
}
|
|
|
|
export function Button({ className, variant, size, asChild, ...props }: ButtonProps) {
|
|
const Comp = asChild ? Slot : "button";
|
|
return <Comp className={cn(buttonVariants({ variant, size, className }))} {...props} />;
|
|
}
|