short desc

This commit is contained in:
hamid zarghami
2025-12-15 16:06:42 +03:30
parent d7119d9b4e
commit 5be1c24bc2
+15 -1
View File
@@ -20,6 +20,14 @@ const BaseInformation: FC<BaseInformationProps> = ({ product, stats }) => {
const brand = product.brand
const descriptionSource =
product.metaDescription || product.seoDescription || product.description
const shortDescription =
descriptionSource && descriptionSource.length > 160
? `${descriptionSource.slice(0, 160)}...`
: descriptionSource
// محاسبه میانگین امتیاز و تعداد دیدگاه‌ها
@@ -90,7 +98,7 @@ const BaseInformation: FC<BaseInformationProps> = ({ product, stats }) => {
}
return (
<div className='mt-4 sm:mt-6'>
<div className='mt-4 sm:mt-6 flex gap-4 flex-wrap'>
{/* بررسی وجود فیلدهای خاص در variant ها */}
{(() => {
// اگر هیچ فیلد خاصی وجود نداشت، نمایش عمومی
@@ -281,6 +289,12 @@ const BaseInformation: FC<BaseInformationProps> = ({ product, stats }) => {
: null
}
{product.specifications.length === 0 && shortDescription && (
<p className='mt-4 sm:mt-6 line-clamp-3 text-xs sm:text-sm text-[#4B4B4B] leading-7'>
{shortDescription}
</p>
)}
<div className='mt-6 sm:mt-10 flex flex-col gap-4 sm:gap-8'>
{product.specifications.slice(0, 3).map((spec, index) => (
<div key={index} className='flex flex-col sm:flex-row sm:gap-3 items-start sm:items-center text-xs sm:text-sm'>