11import { css } from '@emotion/react' ;
2- import { log , storage } from '@guardian/libs' ;
2+ import { isUndefined , log , storage } from '@guardian/libs' ;
33import { from , space } from '@guardian/source/foundations' ;
44import { SvgAudio , SvgAudioMute } from '@guardian/source/react-components' ;
55import { useCallback , useEffect , useRef , useState } from 'react' ;
@@ -32,8 +32,8 @@ import { ophanTrackerWeb } from './YoutubeAtom/eventEmitters';
3232
3333const videoContainerStyles = (
3434 isCinemagraph : boolean ,
35- videoAspectRatio : number ,
36- aspectRatio ?: number , // The aspect ratio of the container
35+ aspectRatio : number ,
36+ containerAspectRatio ?: number , // The aspect ratio of the container
3737) => css `
3838 position : relative;
3939 display : flex;
@@ -48,9 +48,10 @@ const videoContainerStyles = (
4848 * From tablet breakpoints, the aspect ratio of the slot is maintained, for consistency with other content.
4949 * This will result in grey bars on either side of the video if the video is narrower than the slot.
5050 */
51- aspect- ratio: ${ videoAspectRatio } ;
51+ aspect- ratio: ${ aspectRatio } ;
5252 ${ from . tablet } {
53- ${ typeof aspectRatio === 'number' && `aspect-ratio: ${ aspectRatio } ;` }
53+ ${ ! isUndefined ( containerAspectRatio ) &&
54+ `aspect-ratio: ${ containerAspectRatio } ;` }
5455 }
5556` ;
5657
0 commit comments