diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-01-15 13:54:30 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-01-15 13:54:30 +0700 |
| commit | c42f03768e4c009a247d5cacbecaf4ac952752c9 (patch) | |
| tree | 9199f9b7fae77e1988724159380567b8046c94a9 /src-migrate/modules/product-promo | |
| parent | f62b2345f463695ef0f8f79830cd76b6e0332821 (diff) | |
Improve product detail performance
Diffstat (limited to 'src-migrate/modules/product-promo')
| -rw-r--r-- | src-migrate/modules/product-promo/components/Section.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src-migrate/modules/product-promo/components/Section.tsx b/src-migrate/modules/product-promo/components/Section.tsx index 04cf1363..b6753be7 100644 --- a/src-migrate/modules/product-promo/components/Section.tsx +++ b/src-migrate/modules/product-promo/components/Section.tsx @@ -8,6 +8,7 @@ import ProductPromoCard from './Card' import { IPromotion } from '~/types/promotion' import ProductPromoModal from "./Modal" import { useModalStore } from "../stores/useModalStore" +import clsxm from "~/libs/clsxm" type Props = { productId: number @@ -36,7 +37,13 @@ const ProductPromoSection = ({ productId }: Props) => { </div> )} - <Skeleton isLoaded={promotionsQuery.isSuccess} className="flex gap-x-4 overflow-x-auto min-h-[340px] px-4 md:px-0"> + <Skeleton + isLoaded={promotionsQuery.isSuccess} + className={clsxm( + "flex gap-x-4 overflow-x-auto px-4 md:px-0", { + "min-h-[340px]": promotions?.data && promotions?.data.length > 0 + })} + > {promotions?.data.map((promotion) => ( <div key={promotion.id} className="min-w-[400px] max-w-[400px]"> <ProductPromoCard promotion={promotion} /> |
