From 6fcb8a69040c645116bd735c5aaf7c2b943b24e2 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Sun, 10 Aug 2025 09:05:14 +0330 Subject: [PATCH] blog card --- src/app/home/components/BlogCard.tsx | 32 ++++++++++++++++++++++++---- src/app/home/components/Blogs.tsx | 22 +++++++++++++------ src/app/page.tsx | 10 +++------ src/components/GridWrapper.tsx | 13 ++++++----- 4 files changed, 54 insertions(+), 23 deletions(-) diff --git a/src/app/home/components/BlogCard.tsx b/src/app/home/components/BlogCard.tsx index 12c4f1d..45e7b1b 100644 --- a/src/app/home/components/BlogCard.tsx +++ b/src/app/home/components/BlogCard.tsx @@ -1,11 +1,35 @@ +import { ArrowLeft } from 'iconsax-react' +import Image from 'next/image' import { FC } from 'react' const BlogCard: FC = () => { return ( -
-
- بررسی - گوشی گیمینگ ایسوس +
+ + +
+
تکنولوژی
+
+

+ نسل جدید پردازنده اینتل +

+ +

+ لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ، و با استفاده از طراحان گرافیک است.... +

+ +
+
1401/7/21
+
+
ادامه مطلب
+ +
) diff --git a/src/app/home/components/Blogs.tsx b/src/app/home/components/Blogs.tsx index e06ca45..ca169e0 100644 --- a/src/app/home/components/Blogs.tsx +++ b/src/app/home/components/Blogs.tsx @@ -4,13 +4,21 @@ import GridWrapper from '@/components/GridWrapper' const Blogs: FC = () => { return ( - - - - - - - +
+

رسانه و مطالب

+
+ برای مشاهده ی آخرین مطالب رسانه و مطالب اینجا کلیک کنید +
+
+ + + + + + + +
+
) } diff --git a/src/app/page.tsx b/src/app/page.tsx index 96b4acd..04ab4c7 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -22,9 +22,6 @@ const Home: NextPage = () => {
-
- -
@@ -35,10 +32,9 @@ const Home: NextPage = () => {
-
- -
- +
+ +
) diff --git a/src/components/GridWrapper.tsx b/src/components/GridWrapper.tsx index da18013..85f280a 100644 --- a/src/components/GridWrapper.tsx +++ b/src/components/GridWrapper.tsx @@ -5,8 +5,8 @@ type GridWrapperProps = { children: React.ReactNode; desktop: number; // تعداد ستون‌ها در دسکتاپ mobile: number; // تعداد ستون‌ها در موبایل - gapDesktop?: number; // فاصله بین آیتم‌ها در دسکتاپ (بر اساس scale پیش‌فرض Tailwind) - gapMobile?: number; // فاصله بین آیتم‌ها در موبایل + gapDesktop?: number; // فاصله بین آیتم‌ها در دسکتاپ. اگر مقدار > 12 باشد به عنوان px تفسیر می‌شود (مثلاً 24 => 24px) + gapMobile?: number; // فاصله بین آیتم‌ها در موبایل. اگر مقدار > 12 باشد به عنوان px تفسیر می‌شود className?: string; }; @@ -56,7 +56,7 @@ const LG_GRID_COLS_CLASS: Record = { 12: "lg:grid-cols-12", }; -// Gap mapping (scale رایج Tailwind) +// نگاشت Gap بر اساس scale رایج Tailwind: gap-N که هر N معادل 4px است (N * 4px) const GAP_CLASS: Record = { 0: "gap-0", 1: "gap-1", 2: "gap-2", 3: "gap-3", 4: "gap-4", 5: "gap-5", 6: "gap-6", 7: "gap-7", 8: "gap-8", 9: "gap-9", 10: "gap-10", 11: "gap-11", @@ -92,13 +92,16 @@ function getMdGridColsClass(count: number): string { function getGapClass(value?: number): string | undefined { if (value === undefined) return undefined; - const safe = clampToRange(value, 0, 12); + // اگر کاربر مقدار را به صورت px فرستاده باشد (بزرگ‌تر از 12)، آن را به scale تبدیل می‌کنیم: N = round(px/4) + const interpretedAsScale = value > 12 ? Math.round(value / 4) : value; + const safe = clampToRange(interpretedAsScale, 0, 24); return GAP_CLASS[safe]; } function getLgGapClass(value?: number): string | undefined { if (value === undefined) return undefined; - const safe = clampToRange(value, 0, 12); + const interpretedAsScale = value > 12 ? Math.round(value / 4) : value; + const safe = clampToRange(interpretedAsScale, 0, 24); return LG_GAP_CLASS[safe]; }