fix: Parse JSON description in NewHero component
- Import parseDescription in NewHero.tsx - Use parseDescription for featured product description
This commit is contained in:
@@ -6,7 +6,7 @@ import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { useSaleorCheckoutStore } from "@/stores/saleorCheckoutStore";
|
||||
import type { Product } from "@/types/saleor";
|
||||
import { getProductPrice, getProductImage, formatPrice } from "@/lib/saleor";
|
||||
import { getProductPrice, getProductImage, formatPrice, parseDescription } from "@/lib/saleor";
|
||||
|
||||
interface NewHeroProps {
|
||||
featuredProduct?: Product;
|
||||
@@ -87,7 +87,7 @@ export default function NewHero({ featuredProduct }: NewHeroProps) {
|
||||
|
||||
{/* Description */}
|
||||
<p className="text-sm text-[#4A4A4A]/70 mt-1 line-clamp-2">
|
||||
{featuredProduct.description?.replace(/<[^>]*>/g, "").slice(0, 100) ||
|
||||
{parseDescription(featuredProduct.description).slice(0, 100) ||
|
||||
"Premium natural oil for hair and skin care"}
|
||||
</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user