@servicetitan/assist-ui
Version:
ServiceTitan Assist UI Components
21 lines • 983 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { motion } from 'framer-motion';
import * as styles from './styles.module.less';
const CHAT_WIDTH = 390;
export const ChatWindow = ({ open, position, children }) => {
var _a, _b;
return (_jsx(motion.div, { initial: { x: '100%' }, animate: {
x: open ? '-24px' : '100%',
display: open ? 'flex' : 'none',
}, transition: {
type: 'tween',
duration: open ? 0.3 : 0,
}, className: styles.chatWindow, style: {
position: position ? 'fixed' : 'relative',
width: `${CHAT_WIDTH}px`,
left: (_a = position === null || position === void 0 ? void 0 : position.x) !== null && _a !== void 0 ? _a : 'auto',
top: (_b = position === null || position === void 0 ? void 0 : position.y) !== null && _b !== void 0 ? _b : 'auto',
zIndex: 9999,
}, children: children }));
};
//# sourceMappingURL=chat-window.js.map