import React, { useEffect } from 'react' import Button from './Button' import robotLogo from '../../assets/images/robot-logo.png' import { BsNewspaper, BsGithub } from 'react-icons/bs' import Whitepaper from '../../assets/Whitepaper.pdf' type Props = {} const menuItems = [ { name: 'Home', path: '/', id: 'home', }, { name: 'About', path: '', id: 'about', }, { name: 'Roadmap', path: '', id: 'roadmap', }, { name: 'Tokenomics', path: '', id: 'tokenomics', }, ] const Header = (props: Props) => { const [isScrolled, setIsScrolled] = React.useState(false) const [isOpenMenu, setIsOpenMenu] = React.useState(false) const [isMobile, setIsMobile] = React.useState(false) React.useEffect(() => { // check is mobile if (window.innerWidth <= 768) { setIsMobile(true) } else { setIsMobile(false) } if (window.innerWidth <= 1024) { setIsScrolled(true) } else { window.addEventListener('scroll', () => { if (window.scrollY > 0) { setIsScrolled(true) } else { setIsScrolled(false) } }) } }, []) const jumpToSection = (section: string) => { console.log('section', section) const element = document.getElementById(section) if (element) { element.scrollIntoView({ behavior: 'smooth' }) } } const openLocalPdf = () => { const pdf = Whitepaper window.open(pdf) } return ( <> {isScrolled ? (

SGPT

{ // Mobile menu isMobile ? (
setIsOpenMenu(!isOpenMenu)} >
) : (
    {menuItems.map((item) => (
  • jumpToSection(item.id) } >

    {item.name}

  • ))}
) } { // Mobile menu isMobile && isOpenMenu ? (
    {menuItems.map((item) => (
  • jumpToSection(item.id) } >

    {item.name}

  • ))}
  • openLocalPdf()} >

    Whitepaper

  • Audit

) : null }
) : (

SGPT

    {menuItems.map((item) => (
  • jumpToSection(item.id)} >

    {item.name}

  • ))}
)} ) } export default Header