11import React , { useState } from "react" ;
22import { HiOutlineMenu , HiOutlineX } from "react-icons/hi" ; // Importando ícones do React Icons
33import { Link } from "react-router-dom" ;
4+ import { CSSTransition } from "react-transition-group" ;
5+ import "./menu.css" ;
46
57export function Menu ( ) {
68 const [ isExpanded , setIsExpanded ] = useState ( false ) ;
@@ -10,35 +12,43 @@ export function Menu() {
1012 } ;
1113
1214 return (
13- < nav
14- className = { `text-white fixed top-0 left-0 bottom-0 z-50 overflow-y-auto ${
15- isExpanded ? "bg-gray-800 overflow-y-auto w-64" : "overflow-hidden"
16- } `}
17- >
18- < div className = "flex justify-between items-center p-4" >
19- < div className = { `text-2xl font-bold ${ isExpanded ? "" : "sr-only" } ` } >
20- Menu
21- </ div >
22- < button
23- className = "text-white focus:outline-none focus:text-white"
24- onClick = { toggleMenu }
25- >
26- { isExpanded ? (
27- < HiOutlineX className = "h-6 w-6" />
28- ) : (
29- < HiOutlineMenu className = "h-6 w-6" />
30- ) }
31- </ button >
32- </ div >
33- < ul className = { `p-4 ${ isExpanded ? "" : "hidden" } ` } >
34- < li className = { `my-2` } >
35- { " " }
36- < Link to = "/" > Classificar</ Link >
37- </ li >
38- < li className = { `my-2` } >
39- < Link to = "/train" > Treinar</ Link >
40- </ li >
41- </ ul >
42- </ nav >
15+ < >
16+ < button
17+ className = "text-white fixed top-0 left-0 p-4 focus:outline-none focus:text-white"
18+ onClick = { toggleMenu }
19+ >
20+ { isExpanded ? (
21+ < HiOutlineX className = "h-6 w-6" />
22+ ) : (
23+ < HiOutlineMenu className = "h-6 w-6" />
24+ ) }
25+ </ button >
26+ < CSSTransition
27+ in = { isExpanded }
28+ timeout = { 500 }
29+ classNames = "menu"
30+ unmountOnExit
31+ >
32+ < nav className = "text-white fixed top-0 left-0 bottom-0 z-50 overflow-y-auto w-64 bg-gray-800" >
33+ < div className = "p-4 flex justify-between items-center" >
34+ < div className = "text-2xl font-bold" > Menu</ div >
35+ < button
36+ className = "text-white focus:outline-none p-2"
37+ onClick = { toggleMenu }
38+ >
39+ < HiOutlineX className = "h-6 w-6" />
40+ </ button >
41+ </ div >
42+ < ul className = "p-4" >
43+ < li className = "my-2" >
44+ < Link to = "/" > Classificar</ Link >
45+ </ li >
46+ < li className = "my-2" >
47+ < Link to = "/train" > Treinar</ Link >
48+ </ li >
49+ </ ul >
50+ </ nav >
51+ </ CSSTransition >
52+ </ >
4353 ) ;
4454}
0 commit comments