feat(webui): animate contextual state icons

Add a shared, stable-size password visibility icon that switches with interruptible opacity, scale, and blur motion across login and password-change flows.

Apply the same motion language to password rule checks, remove the redundant outer pulse, skip initial-state animation, and switch immediately when reduced motion is enabled.
This commit is contained in:
DrSmoothl committed 2026-07-16 16:06:04 +08:00
1 parent cd0466a7e3
commit e224a0c6ea
3 files changed
+53 -15

No files matched your search

@@ -1,11 +1,12 @@
import { useEffect, useState } from 'react';
import { motion } from 'motion/react';
import { ArrowRight, Eye, EyeOff, KeyRound, Sparkles } from 'lucide-react';
import { ArrowRight, KeyRound, Sparkles } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
import { ToggleSwitch } from '@/components/ui/toggle-switch';
import { PasswordVisibilityIcon } from '@/components/ui/password-visibility-icon';
import { ThemeToggle } from '@/components/theme-toggle';
import { LoginWaves } from '@/components/login-waves';
import { useTheme } from '@/contexts/ThemeContext';
@@ -131,7 +132,7 @@ export function LoginPage({ onLogin }: LoginPageProps) {
tabIndex={-1}
aria-label={showPwd ? '隐藏密码' : '显示密码'}
>
{showPwd ? <EyeOff className="size-4" /> : <Eye className="size-4" />}
<PasswordVisibilityIcon visible={showPwd} reduceMotion={reduce} />
</button>
</motion.div>