Skip to content

Commit 50fd5bb

Browse files
committed
use separate image width definition for hosted content pages + include aspect ratio
1 parent cac36f6 commit 50fd5bb

1 file changed

Lines changed: 42 additions & 4 deletions

File tree

dotcom-rendering/src/components/Picture.tsx

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,7 @@ const decideImageWidths = ({
140140
if (isMainMedia) {
141141
if (
142142
format.display === ArticleDisplay.Immersive ||
143-
format.design === ArticleDesign.Gallery ||
144-
format.design === ArticleDesign.HostedArticle ||
145-
format.design === ArticleDesign.HostedVideo ||
146-
format.design === ArticleDesign.HostedGallery
143+
format.design === ArticleDesign.Gallery
147144
) {
148145
// If display is Immersive then main media should *always*
149146
// use these larger image sources
@@ -169,6 +166,47 @@ const decideImageWidths = ({
169166
{ breakpoint: breakpoints.wide, width: 1900 },
170167
];
171168
}
169+
/**
170+
* We allow larger images for Hosted Content pages due to
171+
* the design of these being wider
172+
*/
173+
if (
174+
format.design === ArticleDesign.HostedArticle ||
175+
format.design === ArticleDesign.HostedVideo ||
176+
format.design === ArticleDesign.HostedGallery
177+
) {
178+
return [
179+
{
180+
breakpoint: breakpoints.mobile,
181+
width: 660,
182+
aspectRatio: '5:4',
183+
},
184+
{
185+
breakpoint: breakpoints.mobileLandscape,
186+
width: 660,
187+
aspectRatio: '5:3',
188+
},
189+
{
190+
breakpoint: breakpoints.phablet,
191+
width: 740,
192+
aspectRatio: '5:3',
193+
},
194+
{
195+
breakpoint: breakpoints.tablet,
196+
width: 980,
197+
aspectRatio: '5:3',
198+
},
199+
{
200+
breakpoint: breakpoints.desktop,
201+
width: 1140,
202+
},
203+
{
204+
breakpoint: breakpoints.leftCol,
205+
width: 1300,
206+
},
207+
{ breakpoint: breakpoints.wide, width: 1300 },
208+
];
209+
}
172210
switch (format.display) {
173211
case ArticleDisplay.Showcase:
174212
case ArticleDisplay.NumberedList: {

0 commit comments

Comments
 (0)