PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / components / layouts / CanvasModalLayout.jsx

CanvasModalLayout.jsx in Extendify 3.2.1, at src/Agent/components/layouts/CanvasModalLayout.jsx

52 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { CanvasPane, DOT_GRID } from '@agent/components/Canvas';
2 import { usePortal } from '@agent/hooks/usePortal';
3 import { createPortal } from '@wordpress/element';
4 import { motion } from 'framer-motion';
5
6 const CHAT_WIDTH = 384;
7 const MODAL_SIZE = {
8 width: 1024,
9 height: 720,
10 maxWidth: 'calc(100vw - 8rem)',
11 maxHeight: 'calc(100vh - 8rem)',
12 };
13
14 // The canvas owns the scrim and the close control, so this only clears the scrim.
15 export const CanvasModalLayout = ({ children }) => {
16 const mountNode = usePortal('extendify-agent-canvas-modal-mount');
17
18 if (!mountNode) return null;
19
20 return createPortal(
21 <div className="pointer-events-none fixed inset-0 z-[100001] overflow-auto">
22 <div className="pointer-events-auto flex min-h-full items-center justify-center px-4 py-8">
23 <motion.div
24 initial={{ opacity: 0 }}
25 animate={{ opacity: 1 }}
26 transition={{ duration: 0.3, ease: 'easeInOut' }}
27 className="relative flex overflow-hidden rounded-2xl bg-gray-50 p-2 shadow-lg"
28 style={{ ...DOT_GRID, ...MODAL_SIZE }}
29 >
30 <div
31 className="relative z-10 flex h-full shrink-0 flex-col overflow-hidden rounded-2xl bg-white shadow-lg"
32 style={{ width: CHAT_WIDTH }}
33 >
34 <div className="flex shrink-0 items-center bg-banner-main px-4 py-2.5 text-banner-text">
35 <div className="flex h-5 max-w-36 overflow-hidden">
36 <img
37 className="max-h-full max-w-full object-contain"
38 src={window.extSharedData.partnerLogo}
39 alt={window.extSharedData.partnerName}
40 />
41 </div>
42 </div>
43 {children}
44 </div>
45 <CanvasPane seat="modal" />
46 </motion.div>
47 </div>
48 </div>,
49 mountNode,
50 );
51 };
52