Skip to content

Commit a47dd92

Browse files
committed
fix: Remove framer-motion from UI components for TypeScript compatibility
- Replace motion components with CSS transitions - Fix TypeScript errors in Button and Card components - Use Tailwind scale utilities for hover/active states
1 parent b5621f7 commit a47dd92

4 files changed

Lines changed: 7 additions & 17 deletions

File tree

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const pageVariants = {
1717
};
1818

1919
const pageTransition = {
20-
type: 'tween',
20+
type: 'tween' as const,
2121
duration: 0.3,
2222
};
2323

src/app/components/ui/button/Button.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ButtonHTMLAttributes, forwardRef } from 'react';
2-
import { motion } from 'framer-motion';
32

43
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
54
variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
@@ -9,7 +8,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
98

109
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
1110
({ variant = 'primary', size = 'md', isLoading, className = '', children, ...props }, ref) => {
12-
const baseStyles = 'inline-flex items-center justify-center font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none';
11+
const baseStyles = 'inline-flex items-center justify-center font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none hover:scale-[1.02] active:scale-[0.98]';
1312

1413
const variants = {
1514
primary: 'bg-gradient-to-r from-blue-600 to-purple-600 text-white hover:from-blue-700 hover:to-purple-700 focus:ring-blue-500',
@@ -26,10 +25,8 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
2625
};
2726

2827
return (
29-
<motion.button
28+
<button
3029
ref={ref}
31-
whileHover={{ scale: 1.02 }}
32-
whileTap={{ scale: 0.98 }}
3330
className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${className}`}
3431
disabled={isLoading}
3532
{...props}
@@ -61,7 +58,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
6158
) : (
6259
children
6360
)}
64-
</motion.button>
61+
</button>
6562
);
6663
}
6764
);

src/app/components/ui/card/Card.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { HTMLAttributes, forwardRef } from 'react';
2-
import { motion } from 'framer-motion';
32

43
interface CardProps extends HTMLAttributes<HTMLDivElement> {
54
hover?: boolean;
@@ -10,20 +9,14 @@ const Card = forwardRef<HTMLDivElement, CardProps>(
109
const baseStyles = 'bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden';
1110
const hoverStyles = hover ? 'transition-all duration-300 hover:shadow-2xl hover:-translate-y-1' : '';
1211

13-
const Component = hover ? motion.div : 'div';
14-
const motionProps = hover
15-
? { whileHover: { y: -4, transition: { duration: 0.2 } } }
16-
: {};
17-
1812
return (
19-
<Component
13+
<div
2014
ref={ref}
2115
className={`${baseStyles} ${hoverStyles} ${className}`}
22-
{...(hover ? motionProps : {})}
2316
{...props}
2417
>
2518
{children}
26-
</Component>
19+
</div>
2720
);
2821
}
2922
);

tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/app/components/footer/footer.tsx","./src/app/components/footer/index.ts","./src/app/components/header/header.tsx","./src/app/components/header/index.ts","./src/app/pages/about/about.tsx","./src/app/pages/about/index.ts","./src/app/pages/contact/contact.tsx","./src/app/pages/contact/index.ts","./src/app/pages/home/home.tsx","./src/app/pages/home/index.ts","./src/app/pages/services/services.tsx","./src/app/pages/services/index.ts"],"version":"5.9.3"}
1+
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/app/components/footer/footer.tsx","./src/app/components/footer/index.ts","./src/app/components/header/header.tsx","./src/app/components/header/index.ts","./src/app/components/ui/badge/badge.tsx","./src/app/components/ui/badge/index.ts","./src/app/components/ui/button/button.tsx","./src/app/components/ui/button/index.ts","./src/app/components/ui/card/card.tsx","./src/app/components/ui/card/index.ts","./src/app/components/ui/modal/modal.tsx","./src/app/components/ui/modal/index.ts","./src/app/pages/about/about.tsx","./src/app/pages/about/index.ts","./src/app/pages/contact/contact.tsx","./src/app/pages/contact/index.ts","./src/app/pages/home/home.tsx","./src/app/pages/home/index.ts","./src/app/pages/not-found/notfound.tsx","./src/app/pages/not-found/index.ts","./src/app/pages/services/services.tsx","./src/app/pages/services/index.ts"],"version":"5.9.3"}

0 commit comments

Comments
 (0)