/** * @component ScrollToTopAndThemeToggle * @purpose Widgets matching Screenshots 1-5: Dark/Light Mode toggle pill (bottom-left) and Scroll-to-Top circular blue button (bottom-right). * @a11y ARIA-labeled buttons, keyboard focusable */ 'use client'; import { useState, useEffect } from 'react'; import { ArrowUp, Moon, Sun } from 'lucide-react'; export function ScrollToTopAndThemeToggle() { const [showScroll, setShowScroll] = useState(false); const [darkMode, setDarkMode] = useState(false); useEffect(() => { const handleScroll = () => { setShowScroll(window.scrollY > 300); }; window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []); const toggleTheme = () => { const nextState = !darkMode; setDarkMode(nextState); if (nextState) { document.documentElement.classList.add('dark'); } else { document.documentElement.classList.remove('dark'); } }; const scrollToTop = () => { window.scrollTo({ top: 0, behavior: 'smooth' }); }; return ( <> {/* Dark/Light Mode Toggle Switch (Bottom Left) */} {/* Scroll to Top Circular Button (Bottom Right) */} {showScroll && ( )} ); }