import { motion } from 'framer-motion';
import { Button, type ButtonProps } from '@/components/ui/button';
import { forwardRef } from 'react';
import { cn } from '@/lib/utils';

export const AnimatedAction = forwardRef<HTMLButtonElement, ButtonProps>(
    ({ className, children, ...props }, ref) => {
        return (
            <Button
                ref={ref}
                variant="ghost"
                size="icon"
                className={cn(
                    "h-8 w-8 text-muted-foreground hover:text-foreground transition-colors",
                    className
                )}
                asChild
                {...props}
            >
                <motion.button
                    whileHover={{ scale: 1.15 }}
                    whileTap={{ scale: 0.9 }}
                >
                    {children}
                </motion.button>
            </Button>
        );
    }
);
AnimatedAction.displayName = 'AnimatedAction';
