Skip to content

Commit 84c0d5c

Browse files
feat(promotions): PROMO-1574 add featured promotions callout on homepage (#3108)
* feat(promotions): PROMO-1574 add featured promotions callout on homepage * feat(promotions): PROMO-1574 resolve moreOffers label inline in productCard
1 parent 42dfe9e commit 84c0d5c

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@bigcommerce/catalyst-core": minor
3+
---
4+
5+
Show featured promotion callouts on the homepage product cards (featured and newest carousels), consistent with the existing PDP and PLP callouts.

core/app/[locale]/(default)/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default async function Home({ params }: Props) {
5656
showOutOfStockMessage ? defaultOutOfStockMessage : undefined,
5757
showBackorderMessage,
5858
taxDisplay,
59-
).map((p) => ({ ...p, promotions: undefined }));
59+
);
6060
});
6161

6262
const streamableNewestProducts = Streamable.from(async () => {
@@ -74,7 +74,7 @@ export default async function Home({ params }: Props) {
7474
showOutOfStockMessage ? defaultOutOfStockMessage : undefined,
7575
showBackorderMessage,
7676
taxDisplay,
77-
).map((p) => ({ ...p, promotions: undefined }));
77+
);
7878
});
7979

8080
const streamableShowNewsletterSignup = Streamable.from(async () => {

core/messages/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,9 @@
568568
"search": "Search"
569569
},
570570
"Components": {
571+
"ProductCard": {
572+
"moreOffers": "+{count, plural, =1 {# more offer} other {# more offers}}"
573+
},
571574
"Header": {
572575
"home": "Home",
573576
"toggleNavigation": "Toggle navigation",

core/vibes/soul/primitives/product-card/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { clsx } from 'clsx';
2+
import { useTranslations } from 'next-intl';
23
import {
34
Content as CalloutContent,
45
Description as CalloutDescription,
@@ -40,7 +41,6 @@ export interface ProductCardProps {
4041
imageSizes?: string;
4142
compareLabel?: string;
4243
compareParamName?: string;
43-
moreOffersLabel?: string;
4444
product: Product;
4545
showRating?: boolean;
4646
}
@@ -88,10 +88,11 @@ export function ProductCard({
8888
aspectRatio = '5:6',
8989
compareLabel,
9090
compareParamName,
91-
moreOffersLabel = 'more offers',
9291
imagePriority = false,
9392
imageSizes = '(min-width: 80rem) 20vw, (min-width: 64rem) 25vw, (min-width: 42rem) 33vw, (min-width: 24rem) 50vw, 100vw',
9493
}: ProductCardProps) {
94+
const t = useTranslations('Components.ProductCard');
95+
9596
return (
9697
<article
9798
className={clsx(
@@ -196,7 +197,7 @@ export function ProductCard({
196197
</CalloutTitle>
197198
{promotions.length > 1 && (
198199
<CalloutDescription className="text-xs text-yellow-900/70">
199-
+{promotions.length - 1} {moreOffersLabel}
200+
{t('moreOffers', { count: promotions.length - 1 })}
200201
</CalloutDescription>
201202
)}
202203
</CalloutHeader>

0 commit comments

Comments
 (0)