mika-agent-assist/src/components/mika/PasswordStrengthMeter.tsx
gpt-engineer-app[bot] fa8bee0e36 Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
2026-04-17 17:02:12 +00:00

36 lines
956 B
TypeScript

"use client";
import { passwordStrength, passwordStrengthLabel } from "@/lib/password";
import { cn } from "@/lib/utils";
export function PasswordStrengthMeter({ password }: { password: string }) {
if (!password) return null;
const score = passwordStrength(password);
const colors = [
"bg-destructive",
"bg-destructive",
"bg-warning",
"bg-success",
];
return (
<div className="space-y-1.5" aria-live="polite">
<div className="flex gap-1">
{[0, 1, 2].map((i) => (
<div
key={i}
className={cn(
"h-1.5 flex-1 rounded-full transition-colors",
i < score ? colors[score] : "bg-muted",
)}
/>
))}
</div>
<p className={cn(
"text-xs",
score < 2 ? "text-destructive" : score === 2 ? "text-warning" : "text-success",
)}>
Força: {passwordStrengthLabel(score)}
</p>
</div>
);
}