perf(webui): scope interactive motion
Replace broad transitions with property-specific animation for progress bars, filters, cards, and dashboard controls. This prevents unrelated layout properties from animating while preserving the existing visual feedback. Standardize standalone press feedback at a 0.96 scale, keep disabled controls static, and honor both operating-system and in-app reduced-motion preferences.
This commit is contained in:
11 files changed
+21
-17
No files matched your search
@@ -9,6 +9,7 @@ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
import { useTheme } from '@/contexts/ThemeContext';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { QQInfo } from '@/types';
|
||||
|
||||
@@ -31,6 +32,9 @@ export function AccountSidebar({
|
||||
collapsed,
|
||||
onToggleCollapsed,
|
||||
}: AccountSidebarProps) {
|
||||
const { appearance } = useTheme();
|
||||
const reduceMotion = appearance.reduceMotion || appearance.disableMotion;
|
||||
|
||||
return (
|
||||
<motion.aside
|
||||
animate={{ width: collapsed ? 56 : 248 }}
|
||||
@@ -64,8 +68,8 @@ export function AccountSidebar({
|
||||
<motion.button
|
||||
key={q.uin}
|
||||
type="button"
|
||||
whileHover={{ scale: 1.01 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
whileHover={reduceMotion ? undefined : { scale: 1.01 }}
|
||||
whileTap={reduceMotion ? undefined : { scale: 0.96 }}
|
||||
onClick={() => onSelect(q.uin)}
|
||||
className={cn(
|
||||
'flex items-center gap-2.5 rounded-lg border text-left transition-colors cursor-pointer',
|
||||
|
||||
@@ -58,7 +58,7 @@ export function NodeSummaryCard<T extends AdapterCommon>({
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={off ? { duration: 0 } : { duration: 0.18 }}
|
||||
className={cn(
|
||||
'flex flex-col gap-2 rounded-xl border bg-card/40 p-3.5 transition-all hover:bg-accent/20 sm:flex-row sm:items-center sm:gap-3',
|
||||
'flex flex-col gap-2 rounded-xl border bg-card/40 p-3.5 transition-[background-color,opacity] duration-150 ease-out hover:bg-accent/20 sm:flex-row sm:items-center sm:gap-3',
|
||||
!enabled && 'opacity-60',
|
||||
)}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user