generated from deco-sites/storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (PDP): Product Description added
- Loading branch information
1 parent
e96ac61
commit d8aba9d
Showing
6 changed files
with
99 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { ProductDetailsPage } from "apps/commerce/types.ts"; | ||
|
||
export interface Props { | ||
page: ProductDetailsPage | null; | ||
} | ||
|
||
export default function ProductDescription({ page }: Props) { | ||
if (!page || !page.product) return null; | ||
|
||
const { description: productDescription, isVariantOf } = page.product; | ||
|
||
const description = productDescription || isVariantOf?.description || ""; | ||
|
||
return ( | ||
<div | ||
id="descricao" | ||
class="flex items-center justify-center w-full h-full py-8 lg:py-10 border-b-4 border-[#E4E4E4]" | ||
> | ||
<div class="w-full container flex flex-col gap-8"> | ||
<h2 class="text-2xl text-black-neutral"> | ||
Descrição do <b>Produto</b> | ||
</h2> | ||
|
||
<div class="flex flex-col gap-8 px-6"> | ||
<div class="flex flex-col gap-7"> | ||
<h3 class="text-black-neutral"> | ||
<b>Descrição</b> | ||
</h3> | ||
<div | ||
dangerouslySetInnerHTML={{ | ||
__html: description.replace(/\r?\n/g, "<br />"), | ||
}} | ||
/> | ||
</div> | ||
|
||
<div class="flex flex-col gap-7"> | ||
<h3 class="text-black-neutral"> | ||
<b>Características</b> | ||
</h3> | ||
|
||
{isVariantOf?.additionalProperty?.filter((item) => | ||
item.name !== "sellerId" | ||
)?.map((property) => ( | ||
<div class="even:bg-[#EEEEEE] odd:bg-white-normal grid grid-cols-2 w-full text-sm leading-6 px-4"> | ||
<span class="text-[#444] font-bold">{property.name}</span> | ||
<span>{property.value}</span> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export { default } from "../../components/product/ProductDescription.tsx"; | ||
|
||
export function LoadingFallback() { | ||
return ( | ||
<div | ||
style={{ height: "710px" }} | ||
class="w-full flex justify-center items-center" | ||
> | ||
<span class="loading loading-spinner" /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters