MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / FullScreenModal

Function FullScreenModal

src/components/Mermaid.tsx:183–304  ·  view source on GitHub ↗
({ isOpen, onClose, children })

Source from the content-addressed store, hash-verified

181 onClose: () => void;
182 children: React.ReactNode;
183}> = ({ isOpen, onClose, children }) => {
184 const modalRef = useRef<HTMLDivElement>(null);
185 const [zoom, setZoom] = useState(1);
186
187 // Close on Escape key
188 useEffect(() => {
189 const handleKeyDown = (e: KeyboardEvent) => {
190 if (e.key === 'Escape') {
191 onClose();
192 }
193 };
194
195 if (isOpen) {
196 document.addEventListener('keydown', handleKeyDown);
197 }
198
199 return () => {
200 document.removeEventListener('keydown', handleKeyDown);
201 };
202 }, [isOpen, onClose]);
203
204 // Handle click outside to close
205 useEffect(() => {
206 const handleOutsideClick = (e: MouseEvent) => {
207 if (modalRef.current && !modalRef.current.contains(e.target as Node)) {
208 onClose();
209 }
210 };
211
212 if (isOpen) {
213 document.addEventListener('mousedown', handleOutsideClick);
214 }
215
216 return () => {
217 document.removeEventListener('mousedown', handleOutsideClick);
218 };
219 }, [isOpen, onClose]);
220
221 // Reset zoom when modal opens
222 useEffect(() => {
223 if (isOpen) {
224 setZoom(1);
225 }
226 }, [isOpen]);
227
228 if (!isOpen) return null;
229
230 return (
231 <div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-75 p-4">
232 <div
233 ref={modalRef}
234 className="bg-[var(--card-bg)] rounded-lg shadow-custom max-w-5xl max-h-[90vh] w-full overflow-hidden flex flex-col card-japanese"
235 >
236 {/* Modal header with controls */}
237 <div className="flex items-center justify-between p-4 border-b border-[var(--border-color)]">
238 <div className="font-medium text-[var(--foreground)] font-serif">図表表示</div>
239 <div className="flex items-center gap-4">
240 <div className="flex items-center gap-2">

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected