From 973bc9048dbc58a26d2b1e793b64a27fd9b140ad Mon Sep 17 00:00:00 2001 From: kuekhaoyang Date: Tue, 18 Nov 2025 17:47:15 +0800 Subject: [PATCH] refactor: enhance UI responsiveness and animations; add smooth transitions for video grid and improve TypeBadgeItem interaction --- app/globals.css | 16 ++++++++++++++++ components/search/TypeBadgeItem.tsx | 13 +++++++++---- components/search/VideoGrid.tsx | 2 +- lib/hooks/useTypeBadges.ts | 18 +++++++++++------- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/app/globals.css b/app/globals.css index 4879d61..6b14b26 100644 --- a/app/globals.css +++ b/app/globals.css @@ -533,6 +533,22 @@ nav:where(.sticky, .fixed), contain: layout style paint; } +/* Smooth video grid transitions */ +[class*="grid"] > a { + animation: fadeInUp 0.2s ease-out; +} + +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(8px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + /* Reduce paint complexity on scroll */ img { content-visibility: auto; diff --git a/components/search/TypeBadgeItem.tsx b/components/search/TypeBadgeItem.tsx index ed3b690..77f95c7 100644 --- a/components/search/TypeBadgeItem.tsx +++ b/components/search/TypeBadgeItem.tsx @@ -22,15 +22,20 @@ export function TypeBadgeItem({ onFocus, innerRef, }: TypeBadgeItemProps) { + const handleClick = () => { + // Immediate visual feedback before state update + onToggle(); + }; + return (