Skip to content

Commit

Permalink
Merge pull request #49 from NjNerson/MenuMobileVersion
Browse files Browse the repository at this point in the history
Menu mobile version
  • Loading branch information
Ntsoa2112 authored Jun 1, 2024
2 parents 78f895c + 7cf522d commit 178737a
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 95 deletions.
60 changes: 29 additions & 31 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import 'bootstrap/dist/css/bootstrap.min.css'
import Comptetion from './page/Comptetion'
import Conferences from './page/Conferences'
import Stande from './page/Stande'
import Statistiques from './page/Statistiques'
import Home from './scenes/Home'
import './styles/App.css'
import "bootstrap/dist/css/bootstrap.min.css";
import Comptetion from "./page/Comptetion";
import Conferences from "./page/Conferences";
import Stande from "./page/Stande";
import Statistiques from "./page/Statistiques";
import Home from "./scenes/Home";
import "./styles/App.css";

import CountDownDay from './scenes/CountDownDay'
import OrganizersPartners from './scenes/OrganizersPartners'
import CountDownDay from "./scenes/CountDownDay";
import OrganizersPartners from "./scenes/OrganizersPartners";


import Footer from './scenes/Footer'
import GetTicket from './scenes/GetTicket'
import Photos from './scenes/Photos'
import Questions from './scenes/Questions'
import About from './scenes/About'
import Footer from "./scenes/Footer";
import GetTicket from "./scenes/GetTicket";
import Photos from "./scenes/Photos";
import Questions from "./scenes/Questions";
import About from "./scenes/About";

const App = () => {
const WNL = new Date("June 22, 2024").getTime();
Expand All @@ -23,22 +22,21 @@ const App = () => {
<Home />
<div className="bg-background">
<div className="mx-auto max-w-[1600px] ">
<CountDownDay WNL={WNL}/>
<OrganizersPartners/>
<About/>
<Conferences/>
<Stande/>
<Statistiques/>
<Comptetion/>
<Photos/>
<Questions/>
</div>
<GetTicket/>
<Footer/>

<CountDownDay WNL={WNL} />
<OrganizersPartners />
<About />
<Conferences />
<Stande />
<Statistiques />
<Comptetion />
<Photos />
<Questions />
</div>
<GetTicket />
<Footer />
</div>
</>
)
}
);
};

export default App
export default App;
35 changes: 19 additions & 16 deletions src/components/Drop.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import { Fragment } from 'react'
import { Menu, Transition } from '@headlessui/react'
import { ChevronDownIcon } from '@heroicons/react/20/solid'
import { Fragment } from "react";
import { Menu, Transition } from "@headlessui/react";
import { ChevronDownIcon } from "@heroicons/react/20/solid";

function classNames(...classes) {
return classes.filter(Boolean).join(' ')
return classes.filter(Boolean).join(" ");
}

export default function Drop() {
return (
<Menu as="div" className="relative inline-block text-left">
<div>
<Menu.Button className="inline-flex w-full justify-center gap-x-1.5 font-DMMono text-white hidden sm:flex">
<Menu.Button className="inline-flex w-full justify-center gap-x-1.5 font-DMMono text-white sm:flex">
Activités
<ChevronDownIcon className="-mr-1 h-5 w-5 text-gray-400" aria-hidden="true" />
<ChevronDownIcon
className="-mr-1 h-5 w-5 text-gray-400"
aria-hidden="true"
/>
</Menu.Button>
</div>

Expand All @@ -32,8 +35,8 @@ export default function Drop() {
<a
href="#"
className={classNames(
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
'block px-4 py-2 text-sm font-DMMono'
active ? "bg-gray-100 text-gray-900" : "text-gray-700",
"block px-4 py-2 text-sm font-DMMono"
)}
>
Account settings
Expand All @@ -45,8 +48,8 @@ export default function Drop() {
<a
href="#"
className={classNames(
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
'block px-4 py-2 text-sm font-DMMono'
active ? "bg-gray-100 text-gray-900" : "text-gray-700",
"block px-4 py-2 text-sm font-DMMono"
)}
>
Support
Expand All @@ -58,8 +61,8 @@ export default function Drop() {
<a
href="#"
className={classNames(
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
'block px-4 py-2 text-sm font-DMMono'
active ? "bg-gray-100 text-gray-900" : "text-gray-700",
"block px-4 py-2 text-sm font-DMMono"
)}
>
License
Expand All @@ -72,8 +75,8 @@ export default function Drop() {
<button
type="submit"
className={classNames(
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
'block w-full px-4 py-2 text-left text-sm font-DMMono'
active ? "bg-gray-100 text-gray-900" : "text-gray-700",
"block w-full px-4 py-2 text-left text-sm font-DMMono"
)}
>
Sign out
Expand All @@ -85,5 +88,5 @@ export default function Drop() {
</Menu.Items>
</Transition>
</Menu>
)
}
);
}
15 changes: 12 additions & 3 deletions src/components/NavItem.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
function NavItem(props){
return <a href='#' className='hidden font-DMMono text-white sm:block'>{props.children}</a>
function NavItem(props) {
// return (
// <a href="#" className="hidden font-DMMono text-white sm:block">
// {props.children}
// </a>
// );
return (
<a href="#" className="font-DMMono text-white">
{props.children}
</a>
);
}
export default NavItem
export default NavItem;
168 changes: 123 additions & 45 deletions src/components/nav.jsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,132 @@

import React, { useEffect, useState } from "react";
import Logo from '../ressources/logos_linux-tux.svg';
import Drop from './Drop';
import NavItem from './NavItem';
import Logo from "../ressources/logos_linux-tux.svg";
import Drop from "./Drop";
import NavItem from "./NavItem";
import React, { useState, useEffect } from "react";

const Nav = () => {
const [navSize, setnavSize] = useState("10rem");
const [navColor, setnavColor] = useState("transparent");
const listenScrollEvent = () => {
window.scrollY > 10 ? setnavColor("#252734") : setnavColor("transparent");
window.scrollY > 10 ? setnavSize("5rem") : setnavSize("10rem");
const [navSize, setnavSize] = useState("10rem");
const [navColor, setnavColor] = useState("transparent");
const [borderWidth, setBorderWidth] = useState("0px");

const [isBurgerOpen, setIsBurgerOpen] = useState(false);

const handleClosingBurger = () => {
if (window.innerWidth >= 1024) {
setIsBurgerOpen(false);
}
};

const handleBurgerClick = () => {
if (isBurgerOpen) {
setIsBurgerOpen(false);
setnavSize("10rem");
} else {
setIsBurgerOpen(true);
setnavSize("auto");
}
};

useEffect(() => {
window.addEventListener("resize", handleClosingBurger, false);
return () => {
window.removeEventListener("resize", handleClosingBurger);
};
}, []);

const listenScrollEvent = () => {
window.scrollY > 10
? (setnavColor("#020F13"), setBorderWidth("1px"))
: (setnavColor("transparent"), setBorderWidth("0px"));
window.innerWidth >= 1024
? window.scrollY > 10
? setnavSize("5rem")
: setnavSize("10rem")
: window.scrollY > 10
? setnavSize("5rem")
: setnavSize("8rem");
};

useEffect(() => {
window.addEventListener("scroll", listenScrollEvent);
return () => {
window.removeEventListener("scroll", listenScrollEvent);
};
useEffect(() => {
window.addEventListener("scroll", listenScrollEvent);
return () => {
window.removeEventListener("scroll", listenScrollEvent);
};
}, []);
return <header className="flex fixed w-full top-0 left-0 z-50 px-5 items-center justify-between py-5" style={{
}, []);

return (
<header
className={`flex fixed w-full top-0 left-0 z-50 lg:px-5 px-4 py-5 border-raven transition-[height_1s_linear] duration-1000
${
isBurgerOpen
? "flex-col top-section"
: "flex-row items-center justify-between"
}`}
style={{
backgroundColor: navColor,
height: navSize,
transition: "all 1s"
}}>
<div>
<div className="flex items-center justify-between">
<div className="mr-3">
<img src={Logo} />

</div>
<div className="hidden h-6 text-3xl text-white text-center Kontes-Compressed sm:block">Why not <span className='color-yellow-sea'>Linux</span></div>
</div>
borderBottomWidth: borderWidth,
transition: "all 0.7s ease-in-out",
}}
>
{/* LOGO */}
<div className="flex lg:w-auto w-full lg:block justify-between items-center">
<div className="flex items-center justify-between ">
<div className="mr-3">
<img src={Logo} className=" w-12 lg:w-16 h-auto" />
</div>
<div className=" h-6 text-2xl lg:text-3xl text-white text-center Kontes-Compressed sm:block">
Why not <span className="color-yellow-sea">Linux</span>
</div>
</div>

<div className='flex items-center space-x-6 leading-5 sm:space-x-10'>
<NavItem>À propos</NavItem>
<Drop />
<NavItem>Archive</NavItem>
<NavItem>FaQ</NavItem>
<button className="lg:hidden flex flex-col ml-4">
<span className="w-6 h-1 bg-white mb-1">
</span>
<span className="w-6 h-1 bg-white mb-1">
</span>
<span className="w-6 h-1 bg-white mb-1">
</span>
</button>
<button type="button" className="text-white bg-[#050708] hover:bg-[#050708]/90 focus:ring-4 focus:outline-none focus:ring-[#050708]/50 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-[#050708]/50 dark:hover:bg-[#050708]/30 me-2 mb-2">Inscription</button>
</div>
{/* BURGER BUTTON FOR SMALL SCREEN */}
<button
className="lg:hidden flex flex-col relative"
onClick={() => handleBurgerClick()}
>
<span
className={`w-6 h-1 bg-white mb-1 transition-[transform_0.5s] duration-500 ${
isBurgerOpen
? " -translate-x-1/2 rotate-45 absolute -translate-y-1/2 top-1/2 left-1/2"
: ""
}`}
></span>
<span
className={`w-6 h-1 bg-white mb-1 transition-opacity ${
isBurgerOpen ? "opacity-0" : " delay-100"
}`}
></span>
<span
className={`w-6 h-1 bg-white mb-1 transition-[tranform_0.7s] duration-700 ${
isBurgerOpen
? " -translate-x-1/2 -rotate-45 bg-red-300 absolute -translate-y-1/2 top-1/2 left-1/2 "
: ""
}`}
></span>
</button>
</div>

</header>
{/* MENU FOR LARGE SCREEN AND WHEN BURGER IS OPEN FOR SMALL SCREEN */}
<div
className={`lg:flex items-center leading-5 gap-10 ${
isBurgerOpen
? "flex flex-col justify-start space-y-5 h-full py-10 top-11 "
: "hidden -top-10"
}`}
>
<NavItem>À propos</NavItem>
<Drop />
<NavItem>Archive</NavItem>
<NavItem>FaQ</NavItem>

}
export default Nav
<button
type="button"
className="text-white bg-[#050708] hover:bg-[#050708]/90 focus:ring-4 focus:outline-none focus:ring-[#050708]/50 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-[#050708]/50 dark:hover:bg-[#050708]/30 me-2 mb-2"
>
inscription
</button>
</div>
</header>
);
};
export default Nav;

0 comments on commit 178737a

Please sign in to comment.