Skip to content

Commit 6e5cc7b

Browse files
committed
Menu icons
1 parent f6c8656 commit 6e5cc7b

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Contact from './pages/Contact';
99

1010
function App() {
1111
return (
12-
<div className=" bg-secondary-light dark:bg-primary-dark transition duration-500">
12+
<div className=" bg-secondary-light dark:bg-primary-dark transition duration-300">
1313
<Router>
1414
<AppHeader></AppHeader>
1515
<Routes>

src/components/AppHeader.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FiMoon, FiSun } from 'react-icons/fi';
1+
import { FiMenu, FiMoon, FiSun, FiX } from 'react-icons/fi';
22
import { Link } from 'react-router-dom';
33
import useThemeSwitcher from '../hooks/useThemeSwitcher';
44

@@ -12,7 +12,13 @@ const AppHeader = () => {
1212
const [showModal, setShowModal] = useState(false);
1313
const [activeTheme, setTheme] = useThemeSwitcher();
1414

15-
const toggleMenu = showMenu === false ? true : false;
15+
function toggleMenu() {
16+
if (!showMenu) {
17+
setShowMenu(true);
18+
} else {
19+
setShowMenu(false);
20+
}
21+
}
1622

1723
function showHireMeModal() {
1824
if (!showModal) {
@@ -72,7 +78,7 @@ const AppHeader = () => {
7278
{/* Small screen hamburger menu start */}
7379
<div className="sm:hidden">
7480
<button
75-
onClick={() => setShowMenu(toggleMenu)}
81+
onClick={toggleMenu}
7682
type="button"
7783
className="focus:outline-none"
7884
aria-label="Hamburger Menu"
@@ -82,15 +88,11 @@ const AppHeader = () => {
8288
viewBox="0 0 24 24"
8389
className="h-7 w-7 fill-current text-secondary-dark dark:text-ternary-light"
8490
>
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+
)}
9496
</svg>
9597
</button>
9698
</div>
@@ -99,7 +101,7 @@ const AppHeader = () => {
99101
{/* Header menu links and small screen hamburger menu end */}
100102

101103
{/* 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">
103105
<Link
104106
to="/projects"
105107
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

Comments
 (0)