"use client"; import { ChevronLeft, Clock, MapPin, Phone } from "lucide-react"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { cn } from "@/lib/utils"; interface StoreLocation { id: string; name: string; address: string; city: string; phone: string; hours: string; distance?: string; mapQuery: string; } interface Contact23Props { title?: string; description?: string; locations?: StoreLocation[]; defaultMapQuery?: string; className?: string; } const Contact23 = ({ title = "یافتن نزدیک‌ترین شعبه", description = "نام شهر یا کد پستی را وارد کنید تا نزدیک‌ترین شعبه یا نمایندگی را پیدا کنید.", locations = [ { id: "1", name: "شعبه مرکزی", address: "Valiasr St, District 6", city: "Tehran, Iran", phone: "۲۱-۱۲۳۴۵۶۷۸", hours: "شنبه تا پنج‌شنبه ۱۰ تا ۲۱، جمعه ۱۱ تا ۱۸", distance: "۱۳ کیلومتر", mapQuery: "Valiasr Street, Tehran, Iran", }, { id: "2", name: "شعبه ونک", address: "Vanak Square, District 3", city: "Tehran, Iran", phone: "۲۱-۸۸۷۷۶۶۵۵", hours: "شنبه تا پنج‌شنبه ۱۰ تا ۲۰، جمعه ۱۲ تا ۱۸", distance: "۲ کیلومتر", mapQuery: "Vanak Square, Tehran, Iran", }, { id: "3", name: "شعبه سعادت‌آباد", address: "Seyyed Khandan St", city: "Tehran, Iran", phone: "۲۱-۴۴۰۱۱۲۲", hours: "شنبه تا پنج‌شنبه ۹ تا ۱۹، جمعه ۱۰ تا ۱۷", distance: "۴.۲ کیلومتر", mapQuery: "Saadat Abad, Tehran, Iran", }, { id: "4", name: "شعبه تجریش", address: "Tajrish Square", city: "Tehran, Iran", phone: "۲۱-۲۲۷۷۸۸۹۹", hours: "شنبه تا پنج‌شنبه ۸ تا ۲۰، جمعه ۹ تا ۱۸", distance: "۵.۱ کیلومتر", mapQuery: "Tajrish, Tehran, Iran", }, ], defaultMapQuery = "تهران، ایران", className, }: Contact23Props) => { const [selectedLocation, setSelectedLocation] = useState(null); const mapQuery = selectedLocation?.mapQuery || defaultMapQuery; return (

{title}

{description}

{locations.map((location) => (
setSelectedLocation(location)} className={cn( "group cursor-pointer rounded-xl border bg-background p-5 transition-colors hover:border-primary/50 hover:bg-muted/30", selectedLocation?.id === location.id && "border-primary bg-muted/30", )} >

{location.name}

{location.distance && ( {location.distance} )}

{location.address}

{location.city}

{location.hours}
))}