Skip to content

Commit 7c8ba3c

Browse files
committed
small refactor
1 parent c0e0f4d commit 7c8ba3c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

dotcom-rendering/src/components/SelfHostedVideo.importable.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { css } from '@emotion/react';
2-
import { log, storage } from '@guardian/libs';
2+
import { isUndefined, log, storage } from '@guardian/libs';
33
import { from, space } from '@guardian/source/foundations';
44
import { SvgAudio, SvgAudioMute } from '@guardian/source/react-components';
55
import { useCallback, useEffect, useRef, useState } from 'react';
@@ -32,8 +32,8 @@ import { ophanTrackerWeb } from './YoutubeAtom/eventEmitters';
3232

3333
const 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

Comments
 (0)