'use client' import { useState, useRef, useEffect } from 'react' import { Transition } from '@headlessui/react' import Link from 'next/link' export default function MobileMenu() { const [mobileNavOpen, setMobileNavOpen] = useState(false) const trigger = useRef(null) const mobileNav = useRef(null) // close the mobile menu on click outside useEffect(() => { const clickHandler = ({ target }: { target: EventTarget | null }): void => { if (!mobileNav.current || !trigger.current) return; if (!mobileNavOpen || mobileNav.current.contains(target as Node) || trigger.current.contains(target as Node)) return; setMobileNavOpen(false) }; document.addEventListener('click', clickHandler) return () => document.removeEventListener('click', clickHandler) }) // close the mobile menu if the esc key is pressed useEffect(() => { const keyHandler = ({ keyCode }: { keyCode: number }): void => { if (!mobileNavOpen || keyCode !== 27) return; setMobileNavOpen(false) }; document.addEventListener('keydown', keyHandler) return () => document.removeEventListener('keydown', keyHandler) }) return (
{/* Hamburger button */} {/*Mobile navigation */}
  • setMobileNavOpen(false)}>About
  • setMobileNavOpen(false)}>Residential
    • setMobileNavOpen(false)}>PC Building & Repair
    • setMobileNavOpen(false)}>Home Automation
    • setMobileNavOpen(false)}>Home Networking
  • setMobileNavOpen(false)}>Commercial
    • setMobileNavOpen(false)}>PC & Server Maintenance
    • setMobileNavOpen(false)}>Remote Management
    • setMobileNavOpen(false)}>Web Presence
  • setMobileNavOpen(false)}>Contact Us
) }