diff --git a/components/Product/ProductCardCatalog/index.tsx b/components/Product/ProductCardCatalog/index.tsx
index 2d6ca45..53388f7 100644
--- a/components/Product/ProductCardCatalog/index.tsx
+++ b/components/Product/ProductCardCatalog/index.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import Link from 'next/link';
import { productProp } from '../../../interfaces';
import { Product } from '../index';
-import { OnCart } from '../OnCart';
+import { SaveOnCart } from '../SaveOnCart';
import {Share} from '../Share';
import { ProductImage } from '../ProductImage';
@@ -15,7 +15,7 @@ export function ProductCard({ product }: productProp) {
-
+
diff --git a/components/Product/OnCart/index.tsx b/components/Product/SaveOnCart/index.tsx
similarity index 64%
rename from components/Product/OnCart/index.tsx
rename to components/Product/SaveOnCart/index.tsx
index f7a7f55..9755851 100644
--- a/components/Product/OnCart/index.tsx
+++ b/components/Product/SaveOnCart/index.tsx
@@ -3,11 +3,11 @@ import { productProp } from '../../../interfaces';
import {useCart} from '../../../hooks/useCart';
import {RiShoppingCart2Fill,RiShoppingCart2Line} from 'react-icons/ri';
-export const OnCart=({product}:productProp)=>{
+export const SaveOnCart=({product}:productProp)=>{
const { cart, removeProduct, addProduct } = useCart();
const [ liked, setLiked ] = useState(false);
-
+ const [animated,setAnimated]=useState(false);
useEffect(
() => {
@@ -27,19 +27,32 @@ export const OnCart=({product}:productProp)=>{
setLiked(false);
} else {
addProduct(product.id);
+ handleAnimation();
setLiked(true);
}
};
+ const handleAnimation = () => {
+ setAnimated(true);
+ console.log('animated');
+ setTimeout(() => {
+ setAnimated(false);
+ console.log('animated off');
+ }
+ , 200);
+
+ };
+
+
return (
{liked ? (
-
+
) : (
-
+
)}
)
diff --git a/tailwind.config.js b/tailwind.config.js
index fca8485..20d9124 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -5,11 +5,13 @@ module.exports = {
fontFamily: {
// 'varela-round': [ 'Varela Round', 'sans-serif' ],
montserrat: [ 'Montserrat', 'sans-serif' ]
+ },
+ keyframes: {
+ 'bounce-short': {
+ '0%, 100%': { transform: 'rotate(-3deg)' },
+ '50%': { transform: 'rotate(3deg)' }
+ }
}
- // backdropFilter: {
- // none: 'none',
- // blur: 'blur(10px)'
- // }
}
},
plugins: [ require('@tailwindcss/line-clamp'), require('tailwindcss-filters') ]