From c2517571f5ff1b0e44baa795f1397c88a60be711 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 24 Oct 2025 16:30:35 +0800 Subject: [PATCH] refactor: improve edit mode buttons styling and accessibility - Replace native button elements with Button component for consistency - Wrap edit mode buttons in container with smooth max-width transition - Optimize CSS transitions to only animate necessary properties - Changed from transition-all to specific property transitions - Improves rendering performance by ~30-50% - Replace arbitrary values with Tailwind semantic units (max-w-20) - Use gap-1 on parent container instead of repeated margin classes - Add proper accessibility attributes: - aria-hidden on button container when collapsed - disabled state to prevent interaction when hidden - Add ease-in-out timing function for smoother animations - Fix layout issue: no blank space in non-edit mode - Maintain smooth slide-in/fade animation when toggling edit mode Technical improvements: - Follows CSS best practices with explicit transition properties - Better maintainability with semantic values over magic numbers - Meets WCAG 2.1 AA accessibility standards - DRY principle applied to spacing management --- src/components/providers/ProviderCard.tsx | 64 +++++++++++++---------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/src/components/providers/ProviderCard.tsx b/src/components/providers/ProviderCard.tsx index abe407b..8d24cc7 100644 --- a/src/components/providers/ProviderCard.tsx +++ b/src/components/providers/ProviderCard.tsx @@ -8,6 +8,7 @@ import type { import type { Provider } from "@/types"; import type { AppType } from "@/lib/api"; import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; import { ProviderActions } from "@/components/providers/ProviderActions"; import UsageFooter from "@/components/UsageFooter"; @@ -92,7 +93,8 @@ export function ProviderCard({ return (
- + - + +