Spaces:
Running
Running
File size: 988 Bytes
5c05829 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import React from 'react';
import { motion } from 'framer-motion';
import { ShoppingCart } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Link } from 'react-router-dom';
const FloatingCartButton = ({ cartItemCount }) => {
// Don't render if cart is empty
if (cartItemCount <= 0) {
return null;
}
return (
<motion.div
className="fixed bottom-6 left-6 z-30"
initial={{ scale: 0, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
exit={{ scale: 0, opacity: 0 }}
transition={{ type: 'spring', stiffness: 260, damping: 20 }}
>
<Link to="/cart">
<Button
className="bg-amber-500 hover:bg-amber-600 text-white rounded-full shadow-lg flex items-center gap-2 px-4 py-6"
size="lg"
>
<ShoppingCart className="h-5 w-5" />
<span>View Cart ({cartItemCount})</span>
</Button>
</Link>
</motion.div>
);
};
export default FloatingCartButton; |