'use client'; import { AnimatePresence, motion } from 'framer-motion'; import React, { useState } from 'react'; interface AnimatedSubscribeButtonProps { buttonColor: string; buttonTextColor?: string; subscribeStatus: boolean; initialText: React.ReactElement | string; changeText: React.ReactElement | string; } export const AnimatedSubscribeButton: React.FC = ({ buttonColor, subscribeStatus, buttonTextColor, changeText, initialText, }) => { const [isSubscribed, setIsSubscribed] = useState(subscribeStatus); return ( {isSubscribed ? ( setIsSubscribed(false)} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} > {changeText} ) : ( setIsSubscribed(true)} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} > {initialText} )} ); };