27 lines
850 B
TypeScript
27 lines
850 B
TypeScript
import { FC, useState } from 'react';
|
|
import { MessageText1 } from 'iconsax-react';
|
|
import Chatbot from './Chatbot';
|
|
|
|
const ChatbotButton: FC = () => {
|
|
const [isChatbotOpen, setIsChatbotOpen] = useState<boolean>(false);
|
|
|
|
const toggleChatbot = () => {
|
|
setIsChatbotOpen(!isChatbotOpen);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<button
|
|
onClick={toggleChatbot}
|
|
className="fixed bottom-5 right-5 bg-blue-600 text-white rounded-full w-14 h-14 flex items-center justify-center shadow-lg hover:bg-blue-700 transition-colors z-40"
|
|
aria-label="چت با پشتیبانی"
|
|
>
|
|
<MessageText1 size={24} />
|
|
</button>
|
|
|
|
<Chatbot isOpen={isChatbotOpen} onClose={() => setIsChatbotOpen(false)} />
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default ChatbotButton;
|