File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { css } from '@emotion/react' ;
2
2
import { breakpoints , from , space } from '@guardian/source/foundations' ;
3
- import { Fragment , useCallback , useEffect , useState } from 'react' ;
3
+ import {
4
+ type CSSProperties ,
5
+ Fragment ,
6
+ useCallback ,
7
+ useEffect ,
8
+ useState ,
9
+ } from 'react' ;
4
10
import { grid } from '../grid' ;
5
11
import {
6
12
ArticleDesign ,
@@ -482,6 +488,14 @@ const galleryBodyImageStyles = css`
482
488
}
483
489
` ;
484
490
491
+ const imageMaxWidth = (
492
+ design : ArticleDesign ,
493
+ ratio : number ,
494
+ ) : CSSProperties | undefined =>
495
+ design === ArticleDesign . Gallery
496
+ ? { maxWidth : `calc(${ ratio } * 96vh)` }
497
+ : undefined ;
498
+
485
499
const styles = (
486
500
{ design } : ArticleFormat ,
487
501
isLightbox : boolean ,
@@ -563,7 +577,10 @@ export const Picture = ({
563
577
const fallbackSource = getFallbackSource ( sources ) ;
564
578
565
579
return (
566
- < picture css = { styles ( format , isLightbox , isMainMedia ) } >
580
+ < picture
581
+ css = { styles ( format , isLightbox , isMainMedia ) }
582
+ style = { imageMaxWidth ( format . design , 1 / ratio ) }
583
+ >
567
584
{ /* Immersive Main Media images get additional sources specifically for when in portrait orientation */ }
568
585
{ format . display === ArticleDisplay . Immersive && isMainMedia && (
569
586
< >
You can’t perform that action at this time.
0 commit comments