You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.2 KiB
76 lines
2.2 KiB
import React, { useRef } from "react";
|
|
import logo from '../public/images/thetiptop_logo.png';
|
|
import Link from "next/link";
|
|
import { useRouter } from "next/router";
|
|
import { signOut, useSession } from "next-auth/react";
|
|
import style from '../styles/NavBar.module.css';
|
|
import Image from 'next/image';
|
|
|
|
const NavBar = () => {
|
|
|
|
const navRef = useRef<HTMLInputElement>();
|
|
|
|
const router = useRouter();
|
|
const { data: session, status } = useSession();
|
|
console.log('role', session)
|
|
|
|
const closeNav = () => {
|
|
navRef.current.style.height = "0%";
|
|
}
|
|
|
|
const openNav = () => {
|
|
navRef.current.style.height = "100%";
|
|
}
|
|
|
|
let visitor = (
|
|
<nav className={`${style.customcss} container-fluid`}>
|
|
|
|
<div className="d-flex justify-content-center">
|
|
<Image
|
|
src={logo}
|
|
|
|
alt="thetiptop navigation logo big"
|
|
width={250}
|
|
height={100}
|
|
/>
|
|
</div>
|
|
<div className={`justify-content-center text-center ${style['hidden-mobile']}`}>
|
|
<Link href="/" legacyBehavior><a className={style.link} >Accueil</a></Link> |
|
|
<Link href="/contact" legacyBehavior><a className={style.link} >Nos produits</a></Link> |
|
|
<Link href="/" legacyBehavior><a className={style.link} >Contactez-nous</a></Link> |
|
|
<Link href="/login" legacyBehavior><a className={style.link} >Connexion</a></Link>
|
|
|
|
|
|
</div>
|
|
<div className={`justify-content-center text-center ${style['show-mobile']}`}>
|
|
<span className={`${style.burgerButton}`} onClick={openNav}>☰</span>
|
|
</div>
|
|
|
|
|
|
|
|
<div ref={navRef} className={style.overlay} onClick={closeNav}>
|
|
|
|
<a className={style.closebtn} onClick={closeNav}>×</a>
|
|
<div className="overlay-content">
|
|
<Link href="/" legacyBehavior><a className={style.link} >Accueil</a></Link> |
|
|
<Link href="/contact" legacyBehavior><a className={style.link} >Nos produits</a></Link> |
|
|
<Link href="/" legacyBehavior><a className={style.link} >Contactez-nous</a></Link> |
|
|
<Link href="/user" legacyBehavior><a className={style.link} >Connexion</a></Link>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</nav>
|
|
|
|
)
|
|
|
|
return (<>
|
|
{visitor}
|
|
</>)
|
|
|
|
|
|
|
|
};
|
|
|
|
export default NavBar;
|