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,37 @@
|
||||
import { NextRequest } from "next/server";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const IMAGES_ROOT = path.join(process.cwd(), "src/assets/images");
|
||||
|
||||
const MIME: Record<string, string> = {
|
||||
".jpg": "image/jpeg",
|
||||
".jpeg": "image/jpeg",
|
||||
".png": "image/png",
|
||||
".webp": "image/webp",
|
||||
".gif": "image/gif",
|
||||
".avif": "image/avif",
|
||||
".svg": "image/svg+xml",
|
||||
};
|
||||
|
||||
export async function GET(
|
||||
_request: NextRequest,
|
||||
{ params }: { params: Promise<{ path: string[] }> },
|
||||
) {
|
||||
const segments = (await params).path.map((part) => decodeURIComponent(part));
|
||||
const filePath = path.resolve(IMAGES_ROOT, ...segments);
|
||||
|
||||
if (!filePath.startsWith(IMAGES_ROOT + path.sep) || !fs.existsSync(filePath) || !fs.statSync(filePath).isFile()) {
|
||||
return new Response("Not found", { status: 404 });
|
||||
}
|
||||
|
||||
const ext = path.extname(filePath).toLowerCase();
|
||||
const body = fs.readFileSync(filePath);
|
||||
|
||||
return new Response(body, {
|
||||
headers: {
|
||||
"Content-Type": MIME[ext] ?? "application/octet-stream",
|
||||
"Cache-Control": "public, max-age=3600",
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--primary: #2261fe;
|
||||
--primary-hover: #1a52e0;
|
||||
--navy: #002685;
|
||||
--navy-deep: #001a5c;
|
||||
--sky: #e8f0fe;
|
||||
--mist: #f4f7fc;
|
||||
--text: #1a2332;
|
||||
--muted: #64748b;
|
||||
--line: #e3eaf6;
|
||||
--sale: #e11d48;
|
||||
--ok: #0d9488;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-hover: var(--primary-hover);
|
||||
--color-navy: var(--navy);
|
||||
--color-navy-deep: var(--navy-deep);
|
||||
--color-sky: var(--sky);
|
||||
--color-mist: var(--mist);
|
||||
--color-ink: var(--text);
|
||||
--color-muted: var(--muted);
|
||||
--color-line: var(--line);
|
||||
--color-sale: var(--sale);
|
||||
--color-ok: var(--ok);
|
||||
--font-sans: var(--font-vazir), Tahoma, sans-serif;
|
||||
--font-latin: "Fredoka", var(--font-vazir), sans-serif;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--mist);
|
||||
color: var(--text);
|
||||
font-family: var(--font-sans);
|
||||
}
|
||||
|
||||
.font-latin {
|
||||
font-family: var(--font-latin);
|
||||
}
|
||||
|
||||
.no-scrollbar::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.no-scrollbar {
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||
<rect width="32" height="32" rx="8" fill="#002685"/>
|
||||
<path d="M16 6.5c.6 0 1.1.3 1.4.8l7.2 12.4c.6 1-.1 2.3-1.4 2.3H8.8c-1.3 0-2-1.3-1.4-2.3L14.6 7.3c.3-.5.8-.8 1.4-.8z" fill="#2261FE"/>
|
||||
<circle cx="16" cy="18.2" r="2.1" fill="#fff"/>
|
||||
<rect x="15.2" y="11.4" width="1.6" height="4.2" rx="0.8" fill="#fff"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 383 B |
@@ -0,0 +1,33 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Vazirmatn } from "next/font/google";
|
||||
import "./globals.css";
|
||||
|
||||
const vazir = Vazirmatn({
|
||||
subsets: ["arabic", "latin"],
|
||||
variable: "--font-vazir",
|
||||
display: "swap",
|
||||
weight: ["300", "400", "500", "600", "700", "800"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "داروخانه دکتر ارجمند | صفحه اصلی",
|
||||
description:
|
||||
"خرید آنلاین دارو، مکمل، محصولات بهداشتی و آرایشی از داروخانه دکتر ارجمند در قم، سالاریه.",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="fa" dir="rtl" className={vazir.variable}>
|
||||
<head>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
<body className={`${vazir.className} min-h-screen antialiased`}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { TopBar } from "@/components/layout/TopBar";
|
||||
import { Header } from "@/components/layout/Header";
|
||||
import { Footer } from "@/components/layout/Footer";
|
||||
import { Hero } from "@/components/home/Hero";
|
||||
import { FeaturedCategories } from "@/components/home/FeaturedCategories";
|
||||
import { SiteFeatures } from "@/components/home/SiteFeatures";
|
||||
import { ProductCarousel } from "@/components/home/ProductCarousel";
|
||||
import { BannerRow } from "@/components/home/BannerRow";
|
||||
import { AboutDoctor } from "@/components/home/AboutDoctor";
|
||||
import { BlogCarousel } from "@/components/home/BlogCarousel";
|
||||
import { FaqPreview } from "@/components/home/FaqPreview";
|
||||
import { specialSale, topSelling, twoBanners, tripleBanners, yeganehProducts } from "@/lib/data";
|
||||
import { getLogoSrc, getSlides } from "@/lib/media";
|
||||
|
||||
export default function HomePage() {
|
||||
const slides = getSlides();
|
||||
const logoSrc = getLogoSrc();
|
||||
|
||||
return (
|
||||
<>
|
||||
<TopBar />
|
||||
<Header logoSrc={logoSrc} />
|
||||
<main className="pb-12">
|
||||
<Hero slides={slides} />
|
||||
<FeaturedCategories />
|
||||
<SiteFeatures />
|
||||
<ProductCarousel
|
||||
id="special-sale"
|
||||
title="فروش ویژه"
|
||||
subtitle="تخفیفهای منتخب امروز داروخانه"
|
||||
products={specialSale}
|
||||
accent="sale"
|
||||
/>
|
||||
<BannerRow banners={twoBanners} columns={2} />
|
||||
<ProductCarousel
|
||||
id="top-selling"
|
||||
title="پرفروشترین محصولات"
|
||||
subtitle="پیشنهاد ویژه مشتریان"
|
||||
products={topSelling}
|
||||
/>
|
||||
<BannerRow banners={tripleBanners} columns={3} />
|
||||
<ProductCarousel
|
||||
id="yeganeh"
|
||||
title="محصولات برند یگانه"
|
||||
subtitle="مکملهای منتخب Yeganeh"
|
||||
products={yeganehProducts}
|
||||
/>
|
||||
<AboutDoctor />
|
||||
<BlogCarousel />
|
||||
<FaqPreview />
|
||||
</main>
|
||||
<Footer logoSrc={logoSrc} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user