Skip to content

Commit 45a61b4

Browse files
working on image
1 parent 766ea33 commit 45a61b4

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

dotcom-rendering/src/components/InlineProductCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const card = css`
2929
strong {
3030
font-weight: 700;
3131
}
32+
img {
33+
height: 165px;
34+
width: 165px;
35+
}
3236
border-top: 1px solid ${palette('--section-border-lifestyle')};
3337
${from.wide} {
3438
display: none;
@@ -131,8 +135,8 @@ export const InlineProductCard = ({
131135
format={format}
132136
master={image}
133137
alt={productName + brandName}
134-
height={1}
135-
width={1}
138+
height={165}
139+
width={165}
136140
loading={'eager'}
137141
/>
138142
)}

dotcom-rendering/src/components/LeftColProductCard.tsx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import {
66
textSans14,
77
textSans17,
88
} from '@guardian/source/foundations';
9+
import type { ArticleFormat } from '../lib/articleFormat';
910
import { palette } from '../palette';
11+
import { Picture } from './Picture';
1012
import { ProductLinkButton } from './ProductLinkButton';
1113

1214
export type Statistics = {
@@ -22,6 +24,7 @@ export type LeftColProductCardProps = {
2224
price: string;
2325
retailer: string;
2426
statistics: Statistics[];
27+
format: ArticleFormat;
2528
};
2629

2730
const card = css`
@@ -35,6 +38,10 @@ const card = css`
3538
width: 220px;
3639
border-top: 1px solid ${palette('--section-border-lifestyle')};
3740
}
41+
img {
42+
height: 200px;
43+
width: 200px;
44+
}
3845
strong {
3946
font-weight: 700;
4047
}
@@ -92,30 +99,19 @@ export const LeftColProductCard = ({
9299
price,
93100
retailer,
94101
statistics,
102+
format,
95103
}: LeftColProductCardProps) => (
96104
<div css={card}>
97105
{!!image && (
98-
<a
99-
href={url}
100-
target="_blank"
101-
rel="noopener noreferrer"
102-
style={{
103-
display: 'block',
104-
marginBottom: '12px',
105-
borderRadius: '6px',
106-
}}
107-
>
108-
<img
109-
src={image}
110-
alt={productName}
111-
css={{
112-
width: '200px',
113-
height: '200px',
114-
borderRadius: '6px',
115-
display: 'block',
116-
}}
117-
/>
118-
</a>
106+
<Picture
107+
role={'productCard'}
108+
format={format}
109+
master={image}
110+
alt={productName + brandName}
111+
height={220}
112+
width={220}
113+
loading={'eager'}
114+
/>
119115
)}
120116
<div css={productInfoContainer}>
121117
<div css={primaryHeading}>{brandName}</div>

dotcom-rendering/src/components/Picture.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ const decideImageWidths = ({
271271
];
272272
case 'productCard':
273273
return [
274-
{ breakpoint: breakpoints.mobile, width: 165 },
275274
{ breakpoint: breakpoints.wide, width: 220 },
275+
{ breakpoint: breakpoints.mobile, width: 165 },
276276
];
277277
case 'inline':
278278
default:

dotcom-rendering/src/components/ProductElement.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const ProductElement = ({
8181
price={product.primaryPrice}
8282
retailer={product.primaryRetailer}
8383
statistics={product.statistics}
84+
format={format}
8485
/>
8586
</LeftColProductCardContainer>
8687
{product.content.map((element, index) => (

0 commit comments

Comments
 (0)