1
- import { FiMoon , FiSun } from 'react-icons/fi' ;
1
+ import { FiMenu , FiMoon , FiSun , FiX } from 'react-icons/fi' ;
2
2
import { Link } from 'react-router-dom' ;
3
3
import useThemeSwitcher from '../hooks/useThemeSwitcher' ;
4
4
@@ -12,7 +12,13 @@ const AppHeader = () => {
12
12
const [ showModal , setShowModal ] = useState ( false ) ;
13
13
const [ activeTheme , setTheme ] = useThemeSwitcher ( ) ;
14
14
15
- const toggleMenu = showMenu === false ? true : false ;
15
+ function toggleMenu ( ) {
16
+ if ( ! showMenu ) {
17
+ setShowMenu ( true ) ;
18
+ } else {
19
+ setShowMenu ( false ) ;
20
+ }
21
+ }
16
22
17
23
function showHireMeModal ( ) {
18
24
if ( ! showModal ) {
@@ -72,7 +78,7 @@ const AppHeader = () => {
72
78
{ /* Small screen hamburger menu start */ }
73
79
< div className = "sm:hidden" >
74
80
< button
75
- onClick = { ( ) => setShowMenu ( toggleMenu ) }
81
+ onClick = { toggleMenu }
76
82
type = "button"
77
83
className = "focus:outline-none"
78
84
aria-label = "Hamburger Menu"
@@ -82,15 +88,11 @@ const AppHeader = () => {
82
88
viewBox = "0 0 24 24"
83
89
className = "h-7 w-7 fill-current text-secondary-dark dark:text-ternary-light"
84
90
>
85
- < path
86
- fill-rule = "evenodd"
87
- d = "M18.278 16.864a1 1 0 0 1-1.414 1.414l-4.829-4.828-4.828 4.828a1 1 0 0 1-1.414-1.414l4.828-4.829-4.828-4.828a1 1 0 0 1 1.414-1.414l4.829 4.828 4.828-4.828a1 1 0 1 1 1.414 1.414l-4.828 4.829 4.828 4.828z"
88
- clip-rule = "evenodd"
89
- > </ path >
90
- < path
91
- fill-rule = "evenodd"
92
- d = "M4 5h16a1 1 0 0 1 0 2H4a1 1 0 1 1 0-2zm0 6h16a1 1 0 0 1 0 2H4a1 1 0 0 1 0-2zm0 6h16a1 1 0 0 1 0 2H4a1 1 0 0 1 0-2z"
93
- > </ path >
91
+ { showMenu ? (
92
+ < FiX className = "text-3xl" />
93
+ ) : (
94
+ < FiMenu className = "text-3xl" />
95
+ ) }
94
96
</ svg >
95
97
</ button >
96
98
</ div >
@@ -99,7 +101,7 @@ const AppHeader = () => {
99
101
{ /* Header menu links and small screen hamburger menu end */ }
100
102
101
103
{ /* Header links start*/ }
102
- < div className = "m-0 sm:ml-4 mt-5 sm:mt-3 sm:flex p-5 sm:p-0 justify-center items-center shadow-lg sm:shadow-none" >
104
+ < div className = "hidden m-0 sm:ml-4 mt-5 sm:mt-3 sm:flex p-5 sm:p-0 justify-center items-center shadow-lg sm:shadow-none" >
103
105
< Link
104
106
to = "/projects"
105
107
className = "block text-left text-lg font-medium text-primary-dark dark:text-ternary-light hover:text-secondary-dark dark:hover:text-secondary-light sm:mx-4 mb-2 sm:py-2"
0 commit comments