Skip to content

Commit 5ff7967

Browse files
improving css
1 parent 78532cd commit 5ff7967

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

dotcom-rendering/src/components/ProductCarouselCard.tsx

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type ProductCarouselCardProps = {
1919
format: ArticleFormat;
2020
};
2121

22-
const productCarouselCardHeading = css`
22+
const headingFont = css`
2323
${headlineBold20};
2424
color: ${palette('--product-card-headline')};
2525
`;
@@ -31,7 +31,7 @@ const productCardRowFour = css`
3131
grid-row: 4;
3232
`;
3333

34-
const brandAndProductName = css`
34+
const brandNameFont = css`
3535
${headlineMedium17};
3636
`;
3737

@@ -44,7 +44,7 @@ const readMoreCta = css`
4444
padding-bottom: ${space[2]}px;
4545
`;
4646

47-
const priceStyle = css`
47+
const price = css`
4848
${textSansBold17};
4949
padding-top: ${space[1]}px;
5050
padding-bottom: ${space[2]}px;
@@ -66,15 +66,15 @@ const imageArea = css`
6666
}
6767
`;
6868

69-
const brandAndProductNameRow = css`
70-
line-height: 1.3;
69+
const readMoreArea = css`
70+
grid-row: 2;
7171
`;
72-
73-
const brandAndProductNameInline = css`
72+
const brandAndProductNameFont = css`
7473
${headlineMedium17};
74+
line-height: 1.3;
7575
`;
7676

77-
const productNameStyle = css`
77+
const productNameFont = css`
7878
${textSans17};
7979
`;
8080

@@ -91,46 +91,44 @@ export const ProductCarouselCard = ({
9191
{hasHeading && (
9292
<>
9393
<div
94-
css={productCarouselCardHeading}
94+
css={headingFont}
9595
dangerouslySetInnerHTML={{
9696
__html: product.primaryHeadingHtml,
9797
}}
9898
/>
99-
<div css={brandAndProductNameRow}>
100-
<span css={brandAndProductNameInline}>
101-
{product.brandName}{' '}
102-
</span>
103-
<span css={brandAndProductNameInline}>
104-
{product.productName}
105-
</span>
99+
<div css={brandAndProductNameFont}>
100+
{`${product.brandName} ${product.productName}`}
106101
</div>
107102
</>
108103
)}
109104
</div>
110-
{!isUndefined(h2Id) &&
111-
product.displayType !== 'ProductCardOnly' && (
112-
<a
113-
href={`#${h2Id}`}
114-
onFocus={(event) => event.stopPropagation()}
115-
css={readMoreCta}
116-
>
117-
Read more
118-
</a>
119-
)}
105+
<div css={readMoreArea}>
106+
{!isUndefined(h2Id) &&
107+
hasHeading &&
108+
product.displayType !== 'ProductCardOnly' && (
109+
<a
110+
href={`#${h2Id}`}
111+
onFocus={(event) => event.stopPropagation()}
112+
css={readMoreCta}
113+
>
114+
Read more
115+
</a>
116+
)}
117+
</div>
120118
<div css={imageArea}>
121119
<ProductCardImage format={format} image={product.image} />
122120
</div>
123121
<div css={productCardRowFour}>
124122
{!hasHeading && (
125123
<div>
126-
<div css={brandAndProductName}>{product.brandName}</div>
127-
<div css={productNameStyle}>{product.productName}</div>
124+
<div css={brandNameFont}>{product.brandName}</div>
125+
<div css={productNameFont}>{product.productName}</div>
128126
</div>
129127
)}
130128

131129
{firstCta && (
132130
<>
133-
<div css={priceStyle}>{firstCta.price}</div>
131+
<div css={price}>{firstCta.price}</div>
134132
<div css={buttonWrapper}>
135133
<ProductLinkButton
136134
label={`Buy at ${firstCta.retailer}`}

0 commit comments

Comments
 (0)