const { Navbar, Footer } = window.NotHumanDesignSystem_3e0b8e; const parse = () => (location.hash.replace(/^#\/?/, '') || 'home'); function App() { const [route, setRoute] = React.useState(parse); React.useEffect(() => { const on = () => { setRoute(parse()); window.scrollTo({ top: 0 }); }; window.addEventListener('hashchange', on); return () => window.removeEventListener('hashchange', on); }, []); const scrollTo = (id) => { const el = document.getElementById(id); if (el) window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - 72, behavior: 'smooth' }); }; const go = (r) => { if (r === 'book') { location.href = NH_BOOK; return; } if (r === 'what-we-do') { if (route.split('/')[0] !== 'home') { history.pushState(null, '', '#/'); setRoute('home'); setTimeout(() => scrollTo('what-we-do'), 150); } else scrollTo('what-we-do'); return; } const h = r === 'home' ? '#/' : '#/' + r; if (location.hash === h) { window.scrollTo({ top: 0, behavior: 'smooth' }); return; } location.hash = h; }; const base = route.split('/')[0]; let page; if (base === 'work' && route.includes('/')) page = ; else if (base === 'work') page = ; else if (base === 'about') page = ; else page = ; React.useEffect(() => { document.title = base === 'work' ? 'Work — NotHuman' : base === 'about' ? 'About — NotHuman' : 'NotHuman | Digital Characters for Modern Brands'; }, [route]); return ( <>
{page}