From 24bf530e502fc2bb7c758ea9eab2d4425549f26b Mon Sep 17 00:00:00 2001 From: parsa aghaei Date: Wed, 15 Jul 2026 13:35:10 +0330 Subject: [PATCH] fix: redesign header search bar input, button borders, logo alignment, and copywriting details --- frontend/application/components/Header.tsx | 59 ++++++++++++------- .../application/components/HeaderButton.tsx | 19 ++++-- 2 files changed, 52 insertions(+), 26 deletions(-) diff --git a/frontend/application/components/Header.tsx b/frontend/application/components/Header.tsx index cd152e7f..28afa8a3 100644 --- a/frontend/application/components/Header.tsx +++ b/frontend/application/components/Header.tsx @@ -117,9 +117,16 @@ export default function Header({ onClick={() => setIsMobileMenuOpen(false)} >
C
-
- Canina {getText('brand_name_fa', "ایران")} - {getText('brand_subtitle', "نماینده رسمی Canina Pharma GmbH آلمان")} +
+ + Canina + + {getText('brand_name_fa', "ایران")} + + + + {getText('brand_subtitle', "نماینده رسمی Canina Pharma GmbH آلمان")} +
@@ -132,7 +139,7 @@ export default function Header({ onMouseLeave={() => setIsMegaMenuOpen(false)} > @@ -180,7 +187,7 @@ export default function Header({ { id: 'shop', label: getText('nav_products', 'محصولات تخصصی'), href: '/shop' }, { id: 'wiki', label: getText('nav_wiki', 'دانشنامه علمی'), href: '/wiki' }, { id: 'blog', label: getText('nav_blog', 'مجله سلامت پت'), href: '/blog' }, - { id: 'profile', label: getText('nav_pet_profiles', 'شناسنامه پت‌ها'), href: '/profile' } + { id: 'profile', label: getText('nav_pet_profiles', 'شناسنامه پت'), href: '/profile' } ].map((item) => (
setSearchQuery(e.target.value)} onBlur={() => !searchQuery && setIsSearchFocused(false)} - placeholder={getText('nav_search_placeholder', "جستجوی محصولات، مقالات سلامت و...")} - className="w-full bg-transparent px-4 py-2 text-[12px] font-bold outline-none font-vazir text-medical-gray-900" + placeholder="جستجوی محصولات، مقالات سلامت و ... " + dir="rtl" + className="w-full bg-transparent py-2 text-[12px] font-black outline-none font-vazir text-medical-gray-900 text-right placeholder:text-medical-gray-400" /> - +
)} @@ -226,10 +232,22 @@ export default function Header({ setIsSearchFocused(!isSearchFocused)} + className={cn( + "w-12 h-12 transition-all duration-300", + isSearchFocused + ? "z-30 bg-canina-blue text-white rounded-r-2xl rounded-l-none" + : "rounded-2xl" + )} + onClick={() => { + if (isSearchFocused && searchQuery.trim()) { + onSearch(searchQuery); + setIsSearchFocused(false); + } else { + setIsSearchFocused(!isSearchFocused); + } + }} > - + @@ -355,9 +373,10 @@ export default function Header({ ) : ( setIsAuthModalOpen(true)} - icon={} + icon={} > {getText('nav_login', "ورود / ثبت‌نام")} @@ -419,7 +438,7 @@ export default function Header({ onClick={() => setIsMobileSolutionsOpen(!isMobileSolutionsOpen)} className="w-full flex items-center justify-between px-4 py-3 rounded-xl text-sm font-black text-medical-gray-600 hover:bg-medical-gray-50 transition-all font-vazir" > - {getText('nav_solutions', "راهکارهای درمانی")} + {getText('nav_solutions', "دسته بندی درمانی")} @@ -464,7 +483,7 @@ export default function Header({ { id: 'shop', label: getText('nav_products', 'محصولات تخصصی'), href: '/shop' }, { id: 'wiki', label: getText('nav_wiki', 'دانشنامه علمی'), href: '/wiki' }, { id: 'blog', label: getText('nav_blog', 'مجله سلامت پت'), href: '/blog' }, - { id: 'profile', label: getText('nav_pet_profiles', 'شناسنامه پت‌ها'), href: '/profile' } + { id: 'profile', label: getText('nav_pet_profiles', 'شناسنامه پت'), href: '/profile' } ].map((item) => ( void; @@ -10,6 +10,7 @@ interface HeaderButtonProps { className?: string; badge?: number; icon?: React.ReactNode; + layout?: "row" | "col"; } export default function HeaderButton({ @@ -18,10 +19,16 @@ export default function HeaderButton({ variant = "primary", className = "", badge, - icon + icon, + layout = "col" }: HeaderButtonProps) { - const baseStyles = "relative flex flex-col items-center justify-center rounded-xl transition-all duration-300 font-vazir select-none cursor-pointer overflow-visible focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none"; + const baseStyles = "relative flex items-center justify-center rounded-2xl transition-all duration-300 font-vazir select-none cursor-pointer overflow-visible focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none"; + const layouts = { + col: "flex-col", + row: "flex-row gap-2" + }; + const variants = { primary: "bg-canina-blue text-white hover:bg-medical-gray-900 shadow-lg shadow-canina-blue/20", secondary: "bg-medical-gray-50 text-medical-gray-600 hover:bg-medical-gray-100", @@ -39,10 +46,10 @@ export default function HeaderButton({ whileHover={{ y: -2 }} whileTap={{ scale: 0.95 }} onClick={onClick} - className={`${baseStyles} ${variants[variant]} ${className}`} + className={cn(baseStyles, layouts[layout], variants[variant], className)} > - {icon &&
{icon}
} -
{children}
+ {icon &&
{icon}
} +
{children}
{mounted && badge !== undefined && badge > 0 && (