|
| 1 | +import { useLanguage } from "@/contexts/LanguageContext"; |
| 2 | +import { cn } from "@/lib/utils"; |
| 3 | +import { X } from "lucide-react"; |
| 4 | + |
| 5 | +const concerns = [ |
| 6 | + { id: "hygiene", en: "Personal Hygiene", ar: "النظافة الشخصية", count: 230 }, |
| 7 | + { id: "atopic", en: "Atopic Dermatitis", ar: "التهاب الجلد التأتبي", count: 85 }, |
| 8 | + { id: "first-teeth", en: "First Teeth", ar: "الأسنان الأولى", count: 34 }, |
| 9 | + { id: "special-care", en: "Special Care", ar: "العناية الخاصة", count: 33 }, |
| 10 | + { id: "nasal", en: "Nasal Congestion", ar: "احتقان الأنف", count: 26 }, |
| 11 | + { id: "dehydration", en: "Dehydration", ar: "الجفاف", count: 19 }, |
| 12 | + { id: "cradle-cap", en: "Cradle Cap", ar: "قبعة المهد", count: 13 }, |
| 13 | + { id: "colic", en: "Cramps & Colic", ar: "التشنجات والمغص", count: 12 }, |
| 14 | + { id: "lice", en: "Lice", ar: "القمل", count: 11 }, |
| 15 | + { id: "seborrheic", en: "Seborrheic Dermatitis", ar: "التهاب الجلد المثّي", count: 8 }, |
| 16 | + { id: "sensitive", en: "Sensitive Skin", ar: "البشرة الحساسة", count: 6 }, |
| 17 | + { id: "stretch-marks", en: "Stretch Marks", ar: "علامات التمدد", count: 5 }, |
| 18 | + { id: "sun-protection", en: "Sun Protection", ar: "الحماية من الشمس", count: 4 }, |
| 19 | +]; |
| 20 | + |
| 21 | +interface Props { |
| 22 | + activeConcern: string | null; |
| 23 | + onConcernChange: (concern: string | null) => void; |
| 24 | +} |
| 25 | + |
| 26 | +export default function ConcernFilters({ activeConcern, onConcernChange }: Props) { |
| 27 | + const { locale } = useLanguage(); |
| 28 | + const isAr = locale === "ar"; |
| 29 | + |
| 30 | + return ( |
| 31 | + <section className="py-6 bg-muted/30"> |
| 32 | + <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8"> |
| 33 | + <div className="flex items-center justify-between mb-3"> |
| 34 | + <h3 className="font-heading text-base text-foreground"> |
| 35 | + {isAr ? "تصفية حسب القلق" : "Filter by Concern"} |
| 36 | + </h3> |
| 37 | + {activeConcern && ( |
| 38 | + <button |
| 39 | + onClick={() => onConcernChange(null)} |
| 40 | + className="inline-flex items-center gap-1 text-xs font-body text-muted-foreground hover:text-primary transition-colors" |
| 41 | + > |
| 42 | + <X className="w-3 h-3" /> |
| 43 | + {isAr ? "مسح" : "Clear"} |
| 44 | + </button> |
| 45 | + )} |
| 46 | + </div> |
| 47 | + <div className="flex gap-2 overflow-x-auto pb-2 scrollbar-hide"> |
| 48 | + {concerns.map((concern) => { |
| 49 | + const active = activeConcern === concern.id; |
| 50 | + return ( |
| 51 | + <button |
| 52 | + key={concern.id} |
| 53 | + onClick={() => onConcernChange(active ? null : concern.id)} |
| 54 | + className={cn( |
| 55 | + "inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-3.5 py-1.5 text-xs font-body transition-all duration-200 border shrink-0", |
| 56 | + active |
| 57 | + ? "border-primary bg-primary text-primary-foreground" |
| 58 | + : "border-border bg-card text-foreground hover:border-accent/50" |
| 59 | + )} |
| 60 | + > |
| 61 | + {isAr ? concern.ar : concern.en} |
| 62 | + <span |
| 63 | + className={cn( |
| 64 | + "text-[10px] rounded-full px-1.5 py-0.5", |
| 65 | + active |
| 66 | + ? "bg-primary-foreground/20 text-primary-foreground" |
| 67 | + : "bg-muted text-muted-foreground" |
| 68 | + )} |
| 69 | + > |
| 70 | + {concern.count} |
| 71 | + </span> |
| 72 | + </button> |
| 73 | + ); |
| 74 | + })} |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + </section> |
| 78 | + ); |
| 79 | +} |
0 commit comments