Skip to content

Commit f8f1dc2

Browse files
authored
Merge pull request #150 from anasfarock/update/#12-improved-the-hover-effect-of-main-header
updated/#12 - added hover effect on buttons in the main header
2 parents d605447 + 40ba0b9 commit f8f1dc2

2 files changed

Lines changed: 177 additions & 115 deletions

File tree

src/components/Header/MainHeader.jsx

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
ShoppingCart,
1111
} from 'lucide-react';
1212
import SearchBox from '../Search/SearchBox';
13-
import TopHeader from "../TopHeader/TopHeader";
13+
import TopHeader from '../TopHeader/TopHeader';
1414
import ShopMenu from '../ShopMenu';
1515

1616
export default function Header() {
@@ -46,30 +46,45 @@ export default function Header() {
4646
<img
4747
src="/images/official-logo-core-x.svg"
4848
alt="CoreX Logo"
49-
className="h-8 w-auto"
49+
className="h-10 w-auto"
5050
/>
5151
</Link>
5252
</div>
5353

5454
{/* Center: Desktop Navigation */}
55-
<nav className="hidden md:flex space-x-8 items-center">
55+
<nav className="hidden md:flex space-x-6 items-center">
5656
<div className="relative">
57-
<ShopMenu
57+
<ShopMenu
5858
shopOpen={shopOpen}
5959
setShopOpen={setShopOpen}
6060
onShopClick={handleShopClick}
6161
onShopKeyDown={handleShopButtonKeyDown}
6262
/>
6363
</div>
64-
65-
<Link to="/garage-sale" className="text-gray-700 hover:text-black font-medium">
64+
{/* Garage Sale */}
65+
<Link
66+
to="/garage-sale"
67+
className="px-5 py-2 rounded-full font-medium text-gray-700 transition-all duration-300 hover:bg-[#0D1B2A] hover:text-white"
68+
>
6669
GARAGE SALE
6770
</Link>
68-
<Link to="/products" className="text-gray-700 hover:text-black font-medium">
71+
72+
{/* All Products */}
73+
<Link
74+
to="/products"
75+
className="px-5 py-2 rounded-full font-medium text-gray-700 transition-all duration-300 hover:bg-[#0D1B2A] hover:text-white"
76+
>
6977
ALL PRODUCTS
7078
</Link>
71-
<Link to="/about-corex" className="text-gray-700 hover:text-black font-medium">
72-
ABOUT COREX
79+
{/* About CoreX */}
80+
<Link
81+
to="/about-corex"
82+
className="group px-5 py-2 rounded-full font-medium text-gray-700 transition-all duration-300 hover:bg-[#0D1B2A] hover:text-white"
83+
>
84+
ABOUT CORE
85+
<span className="text-red-600 group-hover:text-red-600 transition-colors duration-300">
86+
X
87+
</span>
7388
</Link>
7489
</nav>
7590

@@ -92,15 +107,15 @@ export default function Header() {
92107
>
93108
<Heart className="h-5 w-5" />
94109
</a>
95-
110+
96111
<Link
97112
to="/login"
98113
aria-label="User Account"
99114
className="transform transition-transform duration-200 hover:scale-110 hover:text-black"
100115
>
101116
<User className="h-5 w-5" />
102117
</Link>
103-
118+
104119
<a
105120
href="#"
106121
aria-label="Shopping Cart"
@@ -122,7 +137,7 @@ export default function Header() {
122137
<button
123138
onClick={() => setMobileOpen(!mobileOpen)}
124139
className="text-gray-700 hover:text-black"
125-
aria-label={mobileOpen ? "Close menu" : "Open menu"}
140+
aria-label={mobileOpen ? 'Close menu' : 'Open menu'}
126141
>
127142
{mobileOpen ? (
128143
<X className="h-6 w-6" />
@@ -171,14 +186,14 @@ export default function Header() {
171186
>
172187
Garage Sale
173188
</Link>
174-
189+
175190
<Link
176191
to="/products"
177192
className="text-gray-700 hover:text-black transition"
178193
>
179194
All Products
180195
</Link>
181-
196+
182197
<Link
183198
to="/about-corex"
184199
className="text-gray-700 hover:text-black transition"
@@ -193,20 +208,24 @@ export default function Header() {
193208
{/* Overlay for Mobile Menu */}
194209
<div
195210
className={`fixed inset-0 bg-black/30 backdrop-blur-sm transition-opacity duration-300 ${
196-
mobileOpen ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"
211+
mobileOpen
212+
? 'opacity-100 pointer-events-auto'
213+
: 'opacity-0 pointer-events-none'
197214
} z-[998]`}
198215
/>
199216

200217
{/* Mobile Menu Drawer */}
201218
<div
202219
ref={mobileMenuRef}
203220
className={`fixed top-0 right-0 w-full sm:w-[280px] h-full bg-white shadow-2xl border-l border-gray-200 z-[999] transform transition-all duration-300 ease-in-out ${
204-
mobileOpen ? "translate-x-0 scale-100" : "translate-x-full scale-95"
221+
mobileOpen ? 'translate-x-0 scale-100' : 'translate-x-full scale-95'
205222
} flex flex-col`}
206223
>
207224
{/* Mobile Menu Header */}
208225
<div className="flex justify-between items-center px-6 py-4 border-b border-gray-200">
209-
<h2 className="font-bold text-lg text-[#023E8A] tracking-wide">MENU</h2>
226+
<h2 className="font-bold text-lg text-[#023E8A] tracking-wide">
227+
MENU
228+
</h2>
210229
<button
211230
onClick={() => setMobileOpen(false)}
212231
className="p-2 rounded-full hover:bg-gray-100 transition-colors duration-200 cursor-pointer"
@@ -226,7 +245,7 @@ export default function Header() {
226245
Shop
227246
<ChevronDown
228247
className={`h-4 w-4 transition-transform duration-200 ${
229-
shopOpen ? "rotate-180" : ""
248+
shopOpen ? 'rotate-180' : ''
230249
}`}
231250
/>
232251
</button>
@@ -311,12 +330,7 @@ export default function Header() {
311330
</div>
312331

313332
{/* Search Drawer */}
314-
{search && (
315-
<SearchBox
316-
isOpen={search}
317-
onClose={() => setSearch(false)}
318-
/>
319-
)}
333+
{search && <SearchBox isOpen={search} onClose={() => setSearch(false)} />}
320334
</>
321335
);
322-
}
336+
}

0 commit comments

Comments
 (0)