Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6632 | Rev 6635 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React, { useEffect, useState } from 'react'

import NavLinks from './nav-links/NavLinks'
import UserImageDropdown from './user-dropdown/UserImageDropdown'
import SearchInput from './searchbox/SearchInput'

import { getBackendVars } from '../../../services/backendVars'

const Header = () => {
  const [navigationInfo, setNavigationInfo] = useState(null)
  const [navbarOpen, setNavbarOpen] = useState(false)

  useEffect(() => {
    getBackendVars('/helpers/menu')
      .then((results) => setNavigationInfo(results))
      .catch((err) => {
        console.log(err)
        throw new Error(err)
      })
  }, [])

  return (
    <>
      <nav className="navbar">
        <a href="/" className="logo d-none d-xl-block">
          <img src={navigationInfo?.logoForNavbar} alt="logo" />
        </a>
        <SearchInput />
        <div className="hamburgerIcon">
          <i
            className="fa fa-bars text-gray"
            onClick={() => setNavbarOpen(!navbarOpen)}
          />
        </div>
        <nav className="navLinksContainer">
          <NavLinks
            menuData={navigationInfo?.menu}
            sessionLink={navigationInfo?.routeCheckSession}
          />
        </nav>
        <UserImageDropdown
          image={''}
          fullName={navigationInfo?.fullName}
          linkAdmin={navigationInfo?.linkAdmin}
          linkImpersonate={navigationInfo?.linkImpersonate}
        />
      </nav>
    </>
  )
}

export default Header