Skip to content

Commit

Permalink
Merge pull request #22 from deco-sites/task/9934-bf
Browse files Browse the repository at this point in the history
Task/9934 bf
  • Loading branch information
lucasdksan authored Nov 21, 2023
2 parents 96eb521 + e839ac0 commit b34538a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
45 changes: 28 additions & 17 deletions components/product/ProductAsideInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,33 @@ function ProductAsideInfo({
offers,
);

const PricePDP = () => {
if (typeof price === "number" && typeof listPrice === "number") {
if(listPrice !== price){
return (
<>
<div class="flex flex-row gap-2 items-center">
<span class="line-through text-base-300 text-xs">
{formatPrice(listPrice, offers!.priceCurrency!)}
</span>
<strong class="text-2xl text-main-bf-theme">
{formatPrice(price, offers!.priceCurrency!)}
</strong>
</div>
</>
);
} else {
return (
<strong class="text-2xl text-main-bf-theme">
{formatPrice(price, offers!.priceCurrency!)}
</strong>
);
}
}

return <></>;
}

const currentURL = window.location?.href;

return (
Expand All @@ -43,23 +70,7 @@ function ProductAsideInfo({
{availability === "https://schema.org/InStock"
? (
<div class="mt-5">
<span class="text-main-bf-theme">
{" "}
<strong class="text-2xl text-main-bf-theme">
{formatPrice(price! * 0.94, offers!.priceCurrency)}
</strong>{" "}
à vista ou
</span>
<div class="flex flex-row gap-2 items-center">
{listPrice !== price && (
<span class="line-through text-base-300 text-xs">
{formatPrice(listPrice, offers!.priceCurrency!)}
</span>
)}
<span class="font-medium text-xl text-[#999BA2]">
{formatPrice(price, offers!.priceCurrency!)}
</span>
</div>
<PricePDP />
<div class="flex flex-col">
<span class="text-[#4A4B51]">
em até <strong>{installment?.billingDuration}x</strong> de{" "}
Expand Down
4 changes: 2 additions & 2 deletions components/product/ProductCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@ function ProductCard(
<>
{l?.hide.allPrices ? "" : (
<div class="flex flex-col mt-2">
<div class="text-xs font-normal text-gray-800 mt-[5px]">
{/* <div class="text-xs font-normal text-gray-800 mt-[5px]">
<span class="text-[1.0rem] text-main-bf-theme font-bold">
{formatPrice(price! * 0.94, offers!.priceCurrency!)}
{" "}
</span>
à vista ou
</div>
</div> */}
<div
class={`flex items-center gap-2.5 ${l?.basics?.oldPriceSize === "Normal" ? "lg:flex-row" : ""
} ${align === "center" ? "justify-center" : "justify-start"
Expand Down
2 changes: 1 addition & 1 deletion static/tailwind.css

Large diffs are not rendered by default.

0 comments on commit b34538a

Please sign in to comment.