parent
87e03b5789
commit
65be22affc
@ -0,0 +1,42 @@ |
|||||||
|
// src/Navbar.js |
||||||
|
import { useState } from 'react'; |
||||||
|
import { FaBars, FaTimes } from 'react-icons/fa'; |
||||||
|
|
||||||
|
const Navbar = () => { |
||||||
|
const [isOpen, setIsOpen] = useState(false); |
||||||
|
|
||||||
|
const toggleMenu = () => { |
||||||
|
setIsOpen(!isOpen); |
||||||
|
}; |
||||||
|
|
||||||
|
return ( |
||||||
|
<nav className="bg-gray-800 p-4"> |
||||||
|
<div className="container mx-auto flex justify-between items-center"> |
||||||
|
<div className="text-white text-lg font-bold"> |
||||||
|
MyApp |
||||||
|
</div> |
||||||
|
<div className="md:hidden"> |
||||||
|
<button onClick={toggleMenu} className="text-gray-300 hover:bg-gray-700 hover:text-white p-2 rounded"> |
||||||
|
{isOpen ? <FaTimes /> : <FaBars />} |
||||||
|
</button> |
||||||
|
</div> |
||||||
|
<div className={`flex-col md:flex md:flex-row md:space-x-4 ${isOpen ? 'block' : 'hidden'} md:block`}> |
||||||
|
<a href="#" className="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded"> |
||||||
|
Home |
||||||
|
</a> |
||||||
|
<a href="#" className="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded"> |
||||||
|
About |
||||||
|
</a> |
||||||
|
<a href="#" className="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded"> |
||||||
|
Services |
||||||
|
</a> |
||||||
|
<a href="#" className="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded"> |
||||||
|
Contact |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</nav> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
|
export default Navbar; |
Loading…
Reference in new issue