| 1 |
import { useState } from '@wordpress/element' |
| 2 |
import { ChatButton } from '@chat/components/ChatButton' |
| 3 |
import { ChatDialog } from '@chat/components/ChatDialog' |
| 4 |
import { motion, AnimatePresence } from 'framer-motion' |
| 5 |
|
| 6 |
export const Chat = () => { |
| 7 |
const [showDialog, setShowDialog] = useState(false) |
| 8 |
|
| 9 |
return ( |
| 10 |
<> |
| 11 |
<ChatButton |
| 12 |
showDialog={showDialog} |
| 13 |
onClick={() => setShowDialog(!showDialog)} |
| 14 |
/> |
| 15 |
<AnimatePresence> |
| 16 |
{showDialog && ( |
| 17 |
<motion.div |
| 18 |
key="chat-dialog" |
| 19 |
className="fixed bottom-0 right-0" |
| 20 |
initial={{ y: 15, opacity: 0 }} |
| 21 |
exit={{ y: 15, opacity: 0 }} |
| 22 |
transition={{ |
| 23 |
y: { duration: 0.25 }, |
| 24 |
opacity: { duration: 0.1 }, |
| 25 |
}} |
| 26 |
animate={{ y: 0, opacity: 1 }}> |
| 27 |
<ChatDialog /> |
| 28 |
</motion.div> |
| 29 |
)} |
| 30 |
</AnimatePresence> |
| 31 |
</> |
| 32 |
) |
| 33 |
} |
| 34 |
|