Skip to content

Commit 99dfac7

Browse files
authored
Merge pull request #14761 from guardian/doml/scrollable-medium-images
Use correct image size for images in Scrollable containers
2 parents 69758a8 + 4289d6e commit 99dfac7

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

dotcom-rendering/src/components/Card/Card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const HorizontalDivider = () => (
229229

230230
const podcastImageStyles = (imageSize: MediaSizeType) => {
231231
switch (imageSize) {
232-
case 'small':
232+
case 'scrollable-small':
233233
return css`
234234
width: 69px;
235235
height: 69px;
@@ -239,7 +239,7 @@ const podcastImageStyles = (imageSize: MediaSizeType) => {
239239
}
240240
`;
241241

242-
case 'medium':
242+
case 'scrollable-medium':
243243
return css`
244244
width: 98px;
245245
height: 98px;

dotcom-rendering/src/components/Card/components/AvatarContainer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const sizingStyles = (
8181

8282
switch (imageSize) {
8383
case 'small':
84+
case 'scrollable-small':
8485
return isFlexibleContainer
8586
? css`
8687
width: 90px;

dotcom-rendering/src/components/Card/components/MediaWrapper.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export type MediaSizeType =
2525
| 'xlarge'
2626
| 'jumbo'
2727
| 'carousel'
28+
| 'scrollable-small'
29+
| 'scrollable-medium'
2830
| 'podcast'
2931
| 'highlights-card'
3032
| 'feature'

dotcom-rendering/src/components/CardPicture.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ const decideImageWidths = (
5050
{ breakpoint: breakpoints.mobile, width: 220, aspectRatio },
5151
];
5252

53+
case 'scrollable-small':
54+
return [
55+
{ breakpoint: breakpoints.mobile, width: 86, aspectRatio },
56+
{ breakpoint: breakpoints.tablet, width: 123, aspectRatio },
57+
];
58+
case 'scrollable-medium':
59+
return [
60+
{ breakpoint: breakpoints.mobile, width: 200, aspectRatio },
61+
{
62+
breakpoint: breakpoints.mobileLandscape,
63+
width: 324,
64+
aspectRatio,
65+
},
66+
{ breakpoint: breakpoints.tablet, width: 160, aspectRatio },
67+
{ breakpoint: breakpoints.desktop, width: 220, aspectRatio },
68+
];
69+
5370
case 'small':
5471
return [
5572
{

dotcom-rendering/src/components/ScrollableMedium.importable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const ScrollableMedium = ({
6363
}}
6464
mediaPositionOnDesktop={imagePosition}
6565
mediaPositionOnMobile={imagePosition}
66-
mediaSize="medium"
66+
mediaSize="scrollable-medium"
6767
trailText={undefined} // unsupported
6868
supportingContent={undefined} // unsupported
6969
aspectRatio={aspectRatio}

dotcom-rendering/src/components/ScrollableSmall.importable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const ScrollableSmall = ({
9292
}}
9393
mediaPositionOnDesktop="left"
9494
mediaPositionOnMobile="left"
95-
mediaSize="small"
95+
mediaSize="scrollable-small"
9696
trailText={undefined} // unsupported
9797
supportingContent={undefined} // unsupported
9898
aspectRatio={aspectRatio}

0 commit comments

Comments
 (0)