fix: redesign header search bar input, button borders, logo alignment, and copywriting details
This commit is contained in:
1 parent
7d93a8d7c2
commit
24bf530e50
2 files changed
+52
-26
No files matched your search
@@ -117,9 +117,16 @@ export default function Header({
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
>
|
||||
<div className="w-12 h-12 bg-canina-blue rounded-2xl flex items-center justify-center text-white font-bold text-2xl group-hover:bg-medical-gray-900 transition-all shadow-xl shadow-canina-blue/20 italic">C</div>
|
||||
<div className="flex flex-col">
|
||||
<span className="text-canina-blue font-black text-2xl tracking-tighter leading-none italic font-sans">Canina <span className="text-sm not-italic font-medium border-l-2 border-medical-gray-100 pl-2 ml-2 font-vazir">{getText('brand_name_fa', "ایران")}</span></span>
|
||||
<span className="text-[10px] text-medical-gray-400 font-bold uppercase tracking-widest leading-none mt-1.5 font-vazir">{getText('brand_subtitle', "نماینده رسمی Canina Pharma GmbH آلمان")}</span>
|
||||
<div className="flex flex-col justify-center gap-1">
|
||||
<span className="text-canina-blue font-black text-2xl tracking-tighter italic font-sans flex items-center gap-2 leading-none">
|
||||
Canina
|
||||
<span className="text-sm not-italic font-medium border-r-2 border-medical-gray-200 pr-2 font-vazir">
|
||||
{getText('brand_name_fa', "ایران")}
|
||||
</span>
|
||||
</span>
|
||||
<span className="text-[9px] text-medical-gray-400 font-bold uppercase tracking-wider font-vazir leading-none">
|
||||
{getText('brand_subtitle', "نماینده رسمی Canina Pharma GmbH آلمان")}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
@@ -132,7 +139,7 @@ export default function Header({
|
||||
onMouseLeave={() => setIsMegaMenuOpen(false)}
|
||||
>
|
||||
<button className={`flex items-center justify-center gap-1.5 px-4 py-3 rounded-xl text-sm font-black transition-all whitespace-nowrap focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none min-h-[48px] ${isMegaMenuOpen ? 'bg-medical-gray-50 text-canina-blue' : 'text-medical-gray-600 hover:bg-medical-gray-50 hover:text-canina-blue'} font-vazir`}>
|
||||
{getText('nav_solutions', "راهکارهای درمانی")}
|
||||
{getText('nav_solutions', "دسته بندی درمانی")}
|
||||
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMegaMenuOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
|
||||
@@ -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) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
@@ -201,10 +208,10 @@ export default function Header({
|
||||
{isSearchFocused && (
|
||||
<motion.div
|
||||
initial={{ width: 0, opacity: 0 }}
|
||||
animate={{ width: 350, opacity: 1 }}
|
||||
animate={{ width: 320, opacity: 1 }}
|
||||
exit={{ width: 0, opacity: 0 }}
|
||||
transition={{ type: "spring", damping: 20, stiffness: 200 }}
|
||||
className="absolute right-0 top-1/2 -translate-y-1/2 bg-white border-2 border-canina-blue rounded-2xl shadow-xl overflow-hidden h-12 flex items-center pr-10"
|
||||
transition={{ type: "spring", damping: 25, stiffness: 220 }}
|
||||
className="absolute right-0 top-1/2 -translate-y-1/2 bg-white border border-canina-blue/30 rounded-2xl shadow-xl shadow-canina-blue/5 overflow-hidden h-12 flex items-center pr-12 pl-4 z-25"
|
||||
>
|
||||
<form onSubmit={handleSearch} className="w-full flex items-center">
|
||||
<input
|
||||
@@ -213,12 +220,11 @@ export default function Header({
|
||||
value={searchQuery}
|
||||
onChange={e => 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"
|
||||
/>
|
||||
<button type="submit" className="px-4 py-2 bg-canina-blue text-white text-[10px] font-black hover:bg-medical-gray-900 transition-colors">
|
||||
{getText('nav_search_button', "جستجو")}
|
||||
</button>
|
||||
<input type="submit" className="hidden" />
|
||||
</form>
|
||||
</motion.div>
|
||||
)}
|
||||
@@ -226,10 +232,22 @@ export default function Header({
|
||||
|
||||
<HeaderButton
|
||||
variant={isSearchFocused ? "primary" : "secondary"}
|
||||
className={cn("w-12 h-12 transition-all duration-300", isSearchFocused ? "z-30 bg-canina-blue text-white" : "")}
|
||||
onClick={() => 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);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Search className="w-5 h-5" />
|
||||
<Search className={cn("w-5 h-5", isSearchFocused ? "text-white" : "text-canina-blue")} />
|
||||
</HeaderButton>
|
||||
</div>
|
||||
|
||||
@@ -355,9 +373,10 @@ export default function Header({
|
||||
) : (
|
||||
<HeaderButton
|
||||
variant="outline"
|
||||
className="px-6 h-12 text-sm font-black"
|
||||
layout="row"
|
||||
className="px-6 h-12 text-sm font-black flex items-center justify-center"
|
||||
onClick={() => setIsAuthModalOpen(true)}
|
||||
icon={<LogIn className="w-5 h-5" />}
|
||||
icon={<LogIn className="w-5 h-5 text-canina-blue" />}
|
||||
>
|
||||
{getText('nav_login', "ورود / ثبتنام")}
|
||||
</HeaderButton>
|
||||
@@ -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"
|
||||
>
|
||||
<span>{getText('nav_solutions', "راهکارهای درمانی")}</span>
|
||||
<span>{getText('nav_solutions', "دسته بندی درمانی")}</span>
|
||||
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMobileSolutionsOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
<AnimatePresence>
|
||||
@@ -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) => (
|
||||
<Link
|
||||
key={item.id}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import React from "react";
|
||||
import { motion } from "motion/react";
|
||||
import { toPersian } from "../lib/utils";
|
||||
import { toPersian, cn } from "../lib/utils";
|
||||
|
||||
interface HeaderButtonProps {
|
||||
onClick?: () => 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 && <div className="mb-0.5">{icon}</div>}
|
||||
<div className="whitespace-nowrap">{children}</div>
|
||||
{icon && <div className={cn(layout === "col" ? "mb-0.5" : "flex-shrink-0 flex items-center")}>{icon}</div>}
|
||||
<div className="whitespace-nowrap flex items-center">{children}</div>
|
||||
|
||||
{mounted && badge !== undefined && badge > 0 && (
|
||||
<motion.div
|
||||
|
||||
Reference in new issue
Block a user