import React, { useState, useEffect } from 'react'; import { useScrollContext } from './ScrollContext'; interface KeyboardEvent { key: string; } const DebugOverlay: React.FC = () => { const [showDebug, setShowDebug] = useState(false); const { isTransitioning } = useScrollContext(); useEffect(() => { const handleKeyPress = (e: KeyboardEvent) => { if (e.key === 'd') { setShowDebug((prev: boolean) => !prev); } }; window.addEventListener('keydown', handleKeyPress); return () => window.removeEventListener('keydown', handleKeyPress); }, []); if (!showDebug) return null; return (
Transitioning: {isTransitioning ? 'Yes' : 'No'}
Body Overflow: {document.body.style.overflow}
Scroll Position: {window.scrollY}
View Height: {window.innerHeight}
); }; export default DebugOverlay;