Skip to content

Commit f7c1468

Browse files
committed
Add new image size for fronts cards
1 parent 1272f2b commit f7c1468

File tree

5 files changed

+117
-39
lines changed

5 files changed

+117
-39
lines changed

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

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,43 @@ const flexBasisStyles = ({
3030
`;
3131
}
3232

33+
if (!isBetaContainer) {
34+
switch (imageSize) {
35+
default:
36+
case 'small':
37+
return css`
38+
flex-basis: 75%;
39+
${between.tablet.and.desktop} {
40+
flex-basis: 60%;
41+
}
42+
${from.desktop} {
43+
flex-basis: 70%;
44+
}
45+
`;
46+
case 'medium':
47+
return css`
48+
${from.tablet} {
49+
flex-basis: 50%;
50+
}
51+
`;
52+
case 'large':
53+
return css`
54+
${from.tablet} {
55+
flex-basis: 34%;
56+
}
57+
`;
58+
case 'jumbo':
59+
return css`
60+
${from.tablet} {
61+
flex-basis: 25%;
62+
}
63+
`;
64+
}
65+
}
66+
3367
switch (imageSize) {
3468
default:
3569
case 'small':
36-
return isBetaContainer
37-
? css`
38-
${from.tablet} {
39-
flex-basis: 50%;
40-
}
41-
`
42-
: css`
43-
flex-basis: 75%;
44-
${between.tablet.and.desktop} {
45-
flex-basis: 60%;
46-
}
47-
${from.desktop} {
48-
flex-basis: 70%;
49-
}
50-
`;
5170
case 'medium':
5271
return css`
5372
${from.tablet} {
@@ -57,14 +76,24 @@ const flexBasisStyles = ({
5776
case 'large':
5877
return css`
5978
${from.tablet} {
60-
flex-basis: 34%;
79+
flex-basis: 220px;
80+
}
81+
${from.desktop} {
82+
flex-basis: 300px;
6183
}
6284
`;
63-
case 'jumbo':
85+
case 'xlarge':
6486
return css`
6587
${from.tablet} {
66-
flex-basis: 25%;
88+
flex-basis: 160px;
6789
}
90+
${from.desktop} {
91+
flex-basis: 220px;
92+
}
93+
`;
94+
case 'jumbo':
95+
return css`
96+
flex-basis: 100%;
6897
`;
6998
}
7099
};

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

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type ImageSizeType =
2323
| 'medium'
2424
| 'large'
2525
| 'jumbo'
26+
| 'xlarge'
2627
| 'carousel'
2728
| 'podcast'
2829
| 'highlights-card'
@@ -87,33 +88,62 @@ const flexBasisStyles = ({
8788
imageSize: ImageSizeType;
8889
isBetaContainer: boolean;
8990
}): SerializedStyles => {
91+
if (!isBetaContainer) {
92+
switch (imageSize) {
93+
default:
94+
case 'small':
95+
return css`
96+
flex-basis: 25%;
97+
${between.tablet.and.desktop} {
98+
flex-basis: 40%;
99+
}
100+
${from.desktop} {
101+
flex-basis: 30%;
102+
}
103+
`;
104+
case 'medium':
105+
return css`
106+
flex-basis: 50%;
107+
`;
108+
case 'large':
109+
return css`
110+
flex-basis: 66%;
111+
`;
112+
case 'jumbo':
113+
return css`
114+
flex-basis: 75%;
115+
`;
116+
}
117+
}
118+
90119
switch (imageSize) {
91120
default:
92121
case 'small':
93-
return isBetaContainer
94-
? css`
95-
flex-basis: 50%;
96-
`
97-
: css`
98-
flex-basis: 25%;
99-
${between.tablet.and.desktop} {
100-
flex-basis: 40%;
101-
}
102-
${from.desktop} {
103-
flex-basis: 30%;
104-
}
105-
`;
106122
case 'medium':
107123
return css`
108124
flex-basis: 50%;
109125
`;
110126
case 'large':
111127
return css`
112-
flex-basis: 66%;
128+
${from.tablet} {
129+
flex-basis: 460px;
130+
}
131+
${from.desktop} {
132+
flex-basis: 620px;
133+
}
134+
`;
135+
case 'xlarge':
136+
return css`
137+
${from.tablet} {
138+
flex-basis: 520px;
139+
}
140+
${from.desktop} {
141+
flex-basis: 700px;
142+
}
113143
`;
114144
case 'jumbo':
115145
return css`
116-
flex-basis: 75%;
146+
flex-basis: 100%;
117147
`;
118148
}
119149
};

dotcom-rendering/src/components/CardPicture.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export type Props = {
2424
/**
2525
* **WIP – Some size may be unaccounted for**
2626
*
27-
* Currently, this only handles the five (5) image sizes of `ImageSizeType`.
28-
*
2927
* This method should cover all use cases with a lot more precision once
3028
* implemented thoroughly
3129
*/
@@ -68,6 +66,18 @@ const decideImageWidths = (
6866
];
6967

7068
case 'large':
69+
return [
70+
{ breakpoint: breakpoints.mobile, width: 465, aspectRatio },
71+
{
72+
breakpoint: breakpoints.mobileLandscape,
73+
width: 480,
74+
aspectRatio,
75+
},
76+
{ breakpoint: breakpoints.tablet, width: 460, aspectRatio },
77+
{ breakpoint: breakpoints.desktop, width: 620, aspectRatio },
78+
];
79+
80+
case 'xlarge':
7181
return [
7282
{ breakpoint: breakpoints.mobile, width: 465, aspectRatio },
7383
{

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const decideSplashCardProperties = (
192192
},
193193
imagePositionOnDesktop: 'right',
194194
imagePositionOnMobile: mediaCard ? 'top' : 'bottom',
195-
imageSize: avatarUrl ? 'large' : 'jumbo',
195+
imageSize: avatarUrl ? 'large' : 'xlarge',
196196
supportingContentAlignment:
197197
supportingContentLength >= 4 ? 'horizontal' : 'vertical',
198198
liveUpdatesAlignment: 'vertical',
@@ -372,7 +372,7 @@ const decideCardProperties = (
372372
tablet: 'small',
373373
mobile: 'medium',
374374
},
375-
imageSize: 'jumbo',
375+
imageSize: 'xlarge',
376376
liveUpdatesPosition: 'outer',
377377
supportingContentAlignment:
378378
supportingContentLength >= 2 ? 'horizontal' : 'vertical',

dotcom-rendering/src/components/FlexibleSpecial.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import type {
99
DCRFrontCard,
1010
DCRGroupedTrails,
1111
} from '../types/front';
12-
import type { ImagePositionType } from './Card/components/ImageWrapper';
12+
import type {
13+
ImagePositionType,
14+
ImageSizeType,
15+
} from './Card/components/ImageWrapper';
1316
import { LI } from './Card/components/LI';
1417
import type { TrailTextSize } from './Card/components/TrailText';
1518
import { UL } from './Card/components/UL';
@@ -33,6 +36,7 @@ type Props = {
3336

3437
type BoostProperties = {
3538
headlineSizes: ResponsiveFontSize;
39+
imageSize: ImageSizeType;
3640
imagePositionOnDesktop: ImagePositionType;
3741
imagePositionOnMobile: ImagePositionType;
3842
supportingContentAlignment: Alignment;
@@ -59,6 +63,7 @@ const determineCardProperties = (
5963
tablet: 'large',
6064
mobile: 'medium',
6165
},
66+
imageSize: 'xlarge',
6267
imagePositionOnDesktop: 'right',
6368
imagePositionOnMobile: mediaCard ? 'top' : 'bottom',
6469
supportingContentAlignment:
@@ -73,6 +78,7 @@ const determineCardProperties = (
7378
tablet: 'xlarge',
7479
mobile: 'large',
7580
},
81+
imageSize: 'xlarge',
7682
imagePositionOnDesktop: 'right',
7783
imagePositionOnMobile: mediaCard ? 'top' : 'bottom',
7884
supportingContentAlignment:
@@ -87,6 +93,7 @@ const determineCardProperties = (
8793
tablet: 'xlarge',
8894
mobile: 'xlarge',
8995
},
96+
imageSize: 'jumbo',
9097
imagePositionOnDesktop: mediaCard ? 'top' : 'bottom',
9198
imagePositionOnMobile: mediaCard ? 'top' : 'bottom',
9299
supportingContentAlignment: 'horizontal',
@@ -100,6 +107,7 @@ const determineCardProperties = (
100107
tablet: 'xxlarge',
101108
mobile: 'xxlarge',
102109
},
110+
imageSize: 'jumbo',
103111
imagePositionOnDesktop: mediaCard ? 'top' : 'bottom',
104112
imagePositionOnMobile: mediaCard ? 'top' : 'bottom',
105113
supportingContentAlignment: 'horizontal',
@@ -143,6 +151,7 @@ export const OneCardLayout = ({
143151

144152
const {
145153
headlineSizes,
154+
imageSize,
146155
imagePositionOnDesktop,
147156
imagePositionOnMobile,
148157
supportingContentAlignment,
@@ -166,7 +175,7 @@ export const OneCardLayout = ({
166175
headlineSizes={headlineSizes}
167176
imagePositionOnDesktop={imagePositionOnDesktop}
168177
imagePositionOnMobile={imagePositionOnMobile}
169-
imageSize={'jumbo'}
178+
imageSize={imageSize}
170179
trailText={card.trailText}
171180
supportingContent={card.supportingContent}
172181
supportingContentAlignment={supportingContentAlignment}

0 commit comments

Comments
 (0)