Skip to content

Commit 3346a10

Browse files
changing the CTA to be of type ProductLinkButton as there is only going to be one CTA in the carosuel for now and also keeps the logic simpler in the ProductCardButtons
1 parent 50a0604 commit 3346a10

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

dotcom-rendering/src/components/ProductCardButtons.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ const getLabel = (cta: ProductCta): string => {
88

99
export const ProductCardButtons = ({
1010
productCtas,
11-
buttonLabelOverride,
1211
}: {
1312
productCtas: ProductCta[];
14-
buttonLabelOverride?: string;
1513
}) => (
1614
<>
1715
{productCtas.map((productCta, index) => {
18-
const label = buttonLabelOverride ?? getLabel(productCta);
16+
const label = getLabel(productCta);
1917
return (
2018
<ProductLinkButton
2119
key={label}

dotcom-rendering/src/components/ProductCarouselCard.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
import type { ArticleFormat } from '../lib/articleFormat';
1111
import { palette } from '../palette';
1212
import type { ProductBlockElement } from '../types/content';
13-
import { ProductCardButtons } from './ProductCardButtons';
1413
import { ProductCardImage } from './ProductCardImage';
14+
import { ProductLinkButton } from './ProductLinkButton';
1515

1616
export type ProductCarouselCardProps = {
1717
product: ProductBlockElement;
@@ -112,14 +112,15 @@ export const ProductCarouselCard = ({
112112
)}
113113
<div css={priceStyle}>{firstCta?.price}</div>
114114

115-
<div css={buttonWrapper}>
116-
<ProductCardButtons
117-
productCtas={firstCta ? [firstCta] : []}
118-
buttonLabelOverride={
119-
firstCta ? `Buy at ${firstCta.retailer}` : undefined
120-
}
121-
/>
122-
</div>
115+
{firstCta && (
116+
<div css={buttonWrapper}>
117+
<ProductLinkButton
118+
label={`Buy at ${firstCta.retailer}`}
119+
url={firstCta.url}
120+
minimisePadding={true}
121+
/>
122+
</div>
123+
)}
123124
</div>
124125
);
125126
};

0 commit comments

Comments
 (0)