Add Arjmand Pharmacy Next.js homepage.
Initial RTL storefront with header, slider, product sections, and local image assets. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { Container } from "@/components/Container";
|
||||
import { Placeholder } from "@/components/Placeholder";
|
||||
import { about } from "@/lib/data";
|
||||
|
||||
export function AboutDoctor() {
|
||||
return (
|
||||
<section id="about" className="pt-10">
|
||||
<Container>
|
||||
<div className="grid items-center gap-8 overflow-hidden rounded-2xl bg-white p-5 sm:p-8 lg:grid-cols-[0.9fr_1.1fr]">
|
||||
<div className="overflow-hidden rounded-2xl bg-sky">
|
||||
<Placeholder src="/placeholders/doctor.svg" className="aspect-[4/5] w-full object-cover lg:aspect-[4/4.4]" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-[13px] font-medium text-primary">{about.subtitle}</p>
|
||||
<h2 className="mt-2 text-[22px] font-bold text-navy">{about.title}</h2>
|
||||
{about.body.map((paragraph) => (
|
||||
<p key={paragraph} className="mt-4 text-[14px] leading-8 text-muted">
|
||||
{paragraph}
|
||||
</p>
|
||||
))}
|
||||
<div className="mt-7 grid grid-cols-3 gap-3">
|
||||
{about.stats.map((stat) => (
|
||||
<div key={stat.label} className="rounded-xl bg-sky px-3 py-4 text-center">
|
||||
<p className="font-latin text-[18px] font-bold text-navy">{stat.value}</p>
|
||||
<p className="mt-1 text-[12px] text-muted">{stat.label}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import Link from "next/link";
|
||||
import { Container } from "@/components/Container";
|
||||
import { Placeholder } from "@/components/Placeholder";
|
||||
|
||||
type Banner = { id: string; image: string; href: string };
|
||||
|
||||
export function BannerRow({ banners, columns }: { banners: Banner[]; columns: 2 | 3 }) {
|
||||
return (
|
||||
<section className="pt-8">
|
||||
<Container>
|
||||
<div className={`grid gap-3 ${columns === 3 ? "sm:grid-cols-3" : "sm:grid-cols-2"}`}>
|
||||
{banners.map((banner) => (
|
||||
<Link key={banner.id} href={banner.href} className="overflow-hidden rounded-xl bg-sky">
|
||||
<Placeholder src={banner.image} className="h-[100px] w-full object-cover sm:h-[118px]" />
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
"use client";
|
||||
|
||||
import { useRef } from "react";
|
||||
import Link from "next/link";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import { Container } from "@/components/Container";
|
||||
import { Placeholder } from "@/components/Placeholder";
|
||||
import { blogs } from "@/lib/data";
|
||||
|
||||
export function BlogCarousel() {
|
||||
const scroller = useRef<HTMLDivElement>(null);
|
||||
|
||||
return (
|
||||
<section id="blog" className="pt-10">
|
||||
<Container>
|
||||
<div className="mb-4 flex items-center justify-between">
|
||||
<div>
|
||||
<h2 className="text-[18px] font-bold text-navy">آخرین مطالب مجله سلامت</h2>
|
||||
<p className="mt-1 text-[13px] text-muted">نکتههای کاربردی از داروسازان داروخانه</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scroller.current?.scrollBy({ left: 320, behavior: "smooth" })}
|
||||
className="grid size-9 place-items-center rounded-full border border-line bg-white"
|
||||
aria-label="قبلی"
|
||||
>
|
||||
<ChevronRight className="size-4" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scroller.current?.scrollBy({ left: -320, behavior: "smooth" })}
|
||||
className="grid size-9 place-items-center rounded-full border border-line bg-white"
|
||||
aria-label="بعدی"
|
||||
>
|
||||
<ChevronLeft className="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div ref={scroller} className="no-scrollbar flex snap-x gap-4 overflow-x-auto">
|
||||
{blogs.map((post) => (
|
||||
<article key={post.id} className="w-[280px] shrink-0 snap-start overflow-hidden rounded-2xl bg-white sm:w-[320px]">
|
||||
<Link href="#" className="block overflow-hidden bg-sky">
|
||||
<Placeholder src={post.image} className="aspect-[16/10] w-full object-cover" />
|
||||
</Link>
|
||||
<div className="p-4">
|
||||
<p className="text-[12px] text-muted">{post.date}</p>
|
||||
<h3 className="mt-2 text-[14px] font-bold leading-7 text-navy">
|
||||
<Link href="#">{post.title}</Link>
|
||||
</h3>
|
||||
<p className="mt-2 line-clamp-2 text-[12.5px] leading-6 text-muted">{post.excerpt}</p>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Container } from "@/components/Container";
|
||||
import { faqs } from "@/lib/data";
|
||||
|
||||
export function FaqPreview() {
|
||||
return (
|
||||
<section id="faq" className="pt-10">
|
||||
<Container>
|
||||
<h2 className="mb-4 text-[18px] font-bold text-navy">سوالات متداول</h2>
|
||||
<div className="space-y-3">
|
||||
{faqs.map((item) => (
|
||||
<details key={item.q} className="rounded-2xl bg-white px-5 py-4">
|
||||
<summary className="cursor-pointer list-none text-[14px] font-bold text-navy">
|
||||
{item.q}
|
||||
</summary>
|
||||
<p className="mt-3 text-[13px] leading-7 text-muted">{item.a}</p>
|
||||
</details>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import Link from "next/link";
|
||||
import { Container } from "@/components/Container";
|
||||
import { Placeholder } from "@/components/Placeholder";
|
||||
import { categories } from "@/lib/data";
|
||||
|
||||
export function FeaturedCategories() {
|
||||
return (
|
||||
<section id="categories" className="pt-10">
|
||||
<Container>
|
||||
<div className="mb-5 flex items-end justify-between">
|
||||
<div>
|
||||
<h2 className="text-[18px] font-bold text-navy">دستهبندیهای منتخب</h2>
|
||||
<p className="mt-1 text-[13px] text-muted">خرید سریع از دستههای پرمخاطب داروخانه</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-4 gap-3 md:grid-cols-8">
|
||||
{categories.map((category) => (
|
||||
<Link
|
||||
key={category.id}
|
||||
href={category.href}
|
||||
className="group flex flex-col items-center gap-2 rounded-2xl bg-white p-3 text-center transition hover:-translate-y-0.5"
|
||||
>
|
||||
<span className="grid size-[72px] place-items-center overflow-hidden rounded-2xl bg-sky sm:size-[84px]">
|
||||
<Placeholder src={category.image} className="size-full object-cover" />
|
||||
</span>
|
||||
<span className="text-[12px] font-medium text-ink group-hover:text-primary sm:text-[13px]">
|
||||
{category.title}
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import { Container } from "@/components/Container";
|
||||
import { Placeholder } from "@/components/Placeholder";
|
||||
import { heroBanners } from "@/lib/data";
|
||||
import type { Slide } from "@/lib/media";
|
||||
|
||||
export function Hero({ slides }: { slides: Slide[] }) {
|
||||
const [index, setIndex] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
if (slides.length <= 1) return;
|
||||
const timer = setInterval(() => {
|
||||
setIndex((current) => (current + 1) % slides.length);
|
||||
}, 5000);
|
||||
return () => clearInterval(timer);
|
||||
}, [slides.length]);
|
||||
|
||||
const go = (direction: number) => {
|
||||
if (slides.length <= 1) return;
|
||||
setIndex((current) => (current + direction + slides.length) % slides.length);
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="pt-5">
|
||||
<Container>
|
||||
<div className="relative overflow-hidden rounded-2xl bg-sky">
|
||||
<div className="relative aspect-[16/6] sm:aspect-[16/5.2]">
|
||||
{slides.map((slide, i) => (
|
||||
<Link
|
||||
key={slide.id}
|
||||
href={slide.href}
|
||||
className={`absolute inset-0 transition-opacity duration-500 ${i === index ? "opacity-100" : "pointer-events-none opacity-0"}`}
|
||||
>
|
||||
<Placeholder src={slide.image} className="h-full w-full object-cover" />
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
{slides.length > 1 ? (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => go(-1)}
|
||||
className="absolute top-1/2 right-3 grid size-9 -translate-y-1/2 place-items-center rounded-full bg-white/90 text-navy"
|
||||
aria-label="اسلاید قبلی"
|
||||
>
|
||||
<ChevronRight className="size-5" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => go(1)}
|
||||
className="absolute top-1/2 left-3 grid size-9 -translate-y-1/2 place-items-center rounded-full bg-white/90 text-navy"
|
||||
aria-label="اسلاید بعدی"
|
||||
>
|
||||
<ChevronLeft className="size-5" />
|
||||
</button>
|
||||
<div className="absolute bottom-3 left-1/2 flex -translate-x-1/2 gap-1.5">
|
||||
{slides.map((slide, i) => (
|
||||
<button
|
||||
key={slide.id}
|
||||
type="button"
|
||||
onClick={() => setIndex(i)}
|
||||
className={`h-1.5 rounded-full transition-all ${i === index ? "w-6 bg-primary" : "w-2 bg-white/80"}`}
|
||||
aria-label={`اسلاید ${i + 1}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
{heroBanners.map((banner) => (
|
||||
<Link key={banner.id} href={banner.href} className="overflow-hidden rounded-xl bg-sky">
|
||||
<Placeholder src={banner.image} className="h-[92px] w-full object-cover sm:h-[110px]" />
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
"use client";
|
||||
|
||||
import { useRef } from "react";
|
||||
import Link from "next/link";
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react";
|
||||
import { Container } from "@/components/Container";
|
||||
import { ProductCard } from "@/components/ui/ProductCard";
|
||||
import type { Product } from "@/lib/data";
|
||||
|
||||
type Props = {
|
||||
id?: string;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
href?: string;
|
||||
products: Product[];
|
||||
accent?: "default" | "sale";
|
||||
};
|
||||
|
||||
export function ProductCarousel({
|
||||
id,
|
||||
title,
|
||||
subtitle,
|
||||
href = "#",
|
||||
products,
|
||||
accent = "default",
|
||||
}: Props) {
|
||||
const scroller = useRef<HTMLDivElement>(null);
|
||||
|
||||
const scrollBy = (dir: number) => {
|
||||
scroller.current?.scrollBy({ left: dir * -280, behavior: "smooth" });
|
||||
};
|
||||
|
||||
return (
|
||||
<section id={id} className="pt-10">
|
||||
<Container>
|
||||
<div
|
||||
className={`rounded-2xl p-4 sm:p-5 ${accent === "sale" ? "bg-[#fff1f4]" : "bg-transparent"}`}
|
||||
>
|
||||
<div className="mb-4 flex items-center justify-between gap-3">
|
||||
<div>
|
||||
<h2 className={`text-[18px] font-bold ${accent === "sale" ? "text-sale" : "text-navy"}`}>
|
||||
{title}
|
||||
</h2>
|
||||
{subtitle ? <p className="mt-1 text-[13px] text-muted">{subtitle}</p> : null}
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scrollBy(-1)}
|
||||
className="grid size-9 place-items-center rounded-full border border-line bg-white text-navy"
|
||||
aria-label="قبلی"
|
||||
>
|
||||
<ChevronRight className="size-4" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scrollBy(1)}
|
||||
className="grid size-9 place-items-center rounded-full border border-line bg-white text-navy"
|
||||
aria-label="بعدی"
|
||||
>
|
||||
<ChevronLeft className="size-4" />
|
||||
</button>
|
||||
<Link href={href} className="hidden text-[13px] text-primary sm:block">
|
||||
مشاهده همه
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
ref={scroller}
|
||||
className="no-scrollbar flex snap-x snap-mandatory gap-3 overflow-x-auto pb-1"
|
||||
>
|
||||
{products.map((product) => (
|
||||
<div key={product.id} className="w-[210px] shrink-0 snap-start sm:w-[230px]">
|
||||
<ProductCard product={product} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Headphones, RefreshCw, ShieldCheck, Truck } from "lucide-react";
|
||||
import { Container } from "@/components/Container";
|
||||
import { siteFeatures } from "@/lib/data";
|
||||
|
||||
const icons = {
|
||||
headset: Headphones,
|
||||
shield: ShieldCheck,
|
||||
refresh: RefreshCw,
|
||||
truck: Truck,
|
||||
};
|
||||
|
||||
export function SiteFeatures() {
|
||||
return (
|
||||
<section className="pt-8">
|
||||
<Container>
|
||||
<div className="overflow-hidden rounded-2xl border border-line bg-white">
|
||||
<div className="grid grid-cols-2 divide-x divide-x-reverse divide-line lg:grid-cols-4">
|
||||
{siteFeatures.map((feature) => {
|
||||
const Icon = icons[feature.icon];
|
||||
return (
|
||||
<div key={feature.title} className="flex items-center gap-3 px-5 py-5">
|
||||
<span className="grid size-12 shrink-0 place-items-center rounded-xl bg-sky text-primary">
|
||||
<Icon className="size-6" strokeWidth={1.75} />
|
||||
</span>
|
||||
<div>
|
||||
<h3 className="text-[13.5px] font-bold text-navy">{feature.title}</h3>
|
||||
<p className="mt-0.5 text-[12px] leading-5 text-muted">{feature.text}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user