All files / src/components/auth TabToggle.tsx

100% Statements 4/4
83.33% Branches 5/6
100% Functions 4/4
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                  5x       1x                     1x                     1x                        
export type AuthTab = "email" | "phone" | "password";
 
export function TabToggle({
	activeTab,
	onChange,
}: {
	activeTab: AuthTab;
	onChange: (tab: AuthTab) => void;
}) {
	return (
		<div className="flex bg-muted rounded-lg p-1 mb-4">
			<button
				type="button"
				onClick={() => onChange("email")}
				className={`flex-1 py-2 text-sm font-medium rounded-md transition-colors ${
					activeTab === "email"
						? "bg-background shadow-sm text-foreground"
						: "text-muted-foreground hover:text-foreground"
				}`}
			>
				Email
			</button>
			<button
				type="button"
				onClick={() => onChange("phone")}
				className={`flex-1 py-2 text-sm font-medium rounded-md transition-colors ${
					activeTab === "phone"
						? "bg-background shadow-sm text-foreground"
						: "text-muted-foreground hover:text-foreground"
				}`}
			>
				Phone
			</button>
			<button
				type="button"
				onClick={() => onChange("password")}
				className={`flex-1 py-2 text-sm font-medium rounded-md transition-colors ${
					activeTab === "password"
						? "bg-background shadow-sm text-foreground"
						: "text-muted-foreground hover:text-foreground"
				}`}
			>
				Password
			</button>
		</div>
	);
}