Skip to content

Commit 5231f88

Browse files
committed
Add new image size for fronts cards.
1 parent 22ff26d commit 5231f88

File tree

5 files changed

+142
-38
lines changed

5 files changed

+142
-38
lines changed

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

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,52 @@ 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-
`;
70+
return css`
71+
flex-basis: 75%;
72+
${between.tablet.and.desktop} {
73+
flex-basis: 60%;
74+
}
75+
${from.desktop} {
76+
flex-basis: 70%;
77+
}
78+
`;
5179
case 'medium':
5280
return css`
5381
${from.tablet} {
@@ -57,15 +85,34 @@ const flexBasisStyles = ({
5785
case 'large':
5886
return css`
5987
${from.tablet} {
60-
flex-basis: 34%;
88+
flex-basis: 220px;
89+
}
90+
${from.desktop} {
91+
flex-basis: 300px;
6192
}
6293
`;
63-
case 'jumbo':
94+
case 'fronts-large':
6495
return css`
6596
${from.tablet} {
66-
flex-basis: 25%;
97+
flex-basis: 220px;
98+
}
99+
${from.desktop} {
100+
flex-basis: 300px;
67101
}
68102
`;
103+
case 'fronts-xlarge':
104+
return css`
105+
${from.tablet} {
106+
flex-basis: 160px;
107+
}
108+
${from.desktop} {
109+
flex-basis: 220px;
110+
}
111+
`;
112+
case 'jumbo':
113+
return css`
114+
flex-basis: 100%;
115+
`;
69116
}
70117
};
71118

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

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export type ImageSizeType =
2323
| 'medium'
2424
| 'large'
2525
| 'jumbo'
26+
| 'fronts-large'
27+
| 'fronts-xlarge'
2628
| 'carousel'
2729
| 'podcast'
2830
| 'highlights-card'
@@ -87,33 +89,66 @@ const flexBasisStyles = ({
8789
imageSize: ImageSizeType;
8890
isBetaContainer: boolean;
8991
}): SerializedStyles => {
92+
if (!isBetaContainer) {
93+
switch (imageSize) {
94+
default:
95+
case 'small':
96+
return css`
97+
flex-basis: 25%;
98+
${between.tablet.and.desktop} {
99+
flex-basis: 40%;
100+
}
101+
${from.desktop} {
102+
flex-basis: 30%;
103+
}
104+
`;
105+
case 'medium':
106+
return css`
107+
flex-basis: 50%;
108+
`;
109+
case 'large':
110+
return css`
111+
flex-basis: 66%;
112+
`;
113+
case 'jumbo':
114+
return css`
115+
flex-basis: 75%;
116+
`;
117+
}
118+
}
119+
90120
switch (imageSize) {
91121
default:
92122
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-
`;
123+
return css`
124+
flex-basis: 50%;
125+
`;
106126
case 'medium':
107127
return css`
108128
flex-basis: 50%;
109129
`;
110130
case 'large':
131+
case 'fronts-large':
132+
return css`
133+
${from.tablet} {
134+
flex-basis: 460px;
135+
}
136+
${from.desktop} {
137+
flex-basis: 620px;
138+
}
139+
`;
140+
case 'fronts-xlarge':
111141
return css`
112-
flex-basis: 66%;
142+
${from.tablet} {
143+
flex-basis: 520px;
144+
}
145+
${from.desktop} {
146+
flex-basis: 700px;
147+
}
113148
`;
114149
case 'jumbo':
115150
return css`
116-
flex-basis: 75%;
151+
flex-basis: 100%;
117152
`;
118153
}
119154
};

dotcom-rendering/src/components/CardPicture.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,20 @@ const decideImageWidths = (
6767
{ breakpoint: breakpoints.desktop, width: 460, aspectRatio },
6868
];
6969

70+
case 'fronts-large':
71+
return [
72+
{ breakpoint: breakpoints.mobile, width: 465, aspectRatio },
73+
{
74+
breakpoint: breakpoints.mobileLandscape,
75+
width: 480,
76+
aspectRatio,
77+
},
78+
{ breakpoint: breakpoints.tablet, width: 460, aspectRatio },
79+
{ breakpoint: breakpoints.desktop, width: 620, aspectRatio },
80+
];
81+
7082
case 'large':
83+
case 'fronts-xlarge':
7184
return [
7285
{ breakpoint: breakpoints.mobile, width: 465, aspectRatio },
7386
{

dotcom-rendering/src/components/FlexibleGeneral.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const decideSplashCardProperties = (
177177
},
178178
imagePositionOnDesktop: 'right',
179179
imagePositionOnMobile: mediaCard ? 'top' : 'bottom',
180-
imageSize: 'large',
180+
imageSize: 'fronts-large',
181181
supportingContentAlignment:
182182
supportingContentLength >= 4 ? 'horizontal' : 'vertical',
183183
liveUpdatesAlignment: 'vertical',
@@ -192,7 +192,7 @@ const decideSplashCardProperties = (
192192
},
193193
imagePositionOnDesktop: 'right',
194194
imagePositionOnMobile: mediaCard ? 'top' : 'bottom',
195-
imageSize: avatarUrl ? 'large' : 'jumbo',
195+
imageSize: avatarUrl ? 'large' : 'fronts-large',
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: 'fronts-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: 'fronts-large',
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: 'fronts-large',
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)