Skip to content

Commit 9682a6c

Browse files
authored
Merge pull request #15738 from guardian/doml/sh-video-refactor-icons-position
Refactor `ControlsPosition` in self-hosted video
2 parents d8f8cd0 + eee5196 commit 9682a6c

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { Caption } from './Caption';
3131
import { CardPicture, type Props as CardPictureProps } from './CardPicture';
3232
import { useConfig } from './ConfigContext';
3333
import type {
34+
ControlsPosition,
3435
PLAYER_STATES,
3536
PlayerStates,
3637
SubtitleSize,
@@ -297,7 +298,7 @@ type Props = {
297298
/**
298299
* The position of subtitles and the audio icon.
299300
*/
300-
controlsPosition?: 'top' | 'bottom';
301+
controlsPosition?: ControlsPosition;
301302
/**
302303
* The minimum/maximum aspect ratio the video will have. The video will be cropped if this
303304
* value is defined and the video aspect ratio is less/greater than this value.
@@ -965,7 +966,7 @@ export const SelfHostedVideo = ({
965966
subtitleSource={subtitleSource}
966967
subtitleSize={subtitleSize}
967968
showIcons={showIcons}
968-
controlsPosition={controlsPosition}
969+
iconsPosition={controlsPosition}
969970
subtitlesPosition={subtitlesPosition}
970971
activeCue={activeCue}
971972
shouldLoop={shouldLoop}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const Default: Story = {
7373
export const WithoutProgressBar: Story = {
7474
args: {
7575
...Loop.args,
76-
hideProgressBar: false,
76+
hideProgressBar: true,
7777
},
7878
} satisfies Story;
7979

dotcom-rendering/src/components/SelfHostedVideoPlayer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export type Props = {
140140
activeCue?: ActiveCue | null;
141141
shouldLoop: boolean;
142142
isInteractive: boolean;
143-
controlsPosition: ControlsPosition;
143+
iconsPosition: ControlsPosition;
144144
subtitlesPosition: SubtitlesPosition;
145145
};
146146

@@ -193,7 +193,7 @@ export const SelfHostedVideoPlayer = forwardRef(
193193
activeCue,
194194
shouldLoop,
195195
isInteractive,
196-
controlsPosition,
196+
iconsPosition,
197197
subtitlesPosition,
198198
}: Props,
199199
ref: React.ForwardedRef<HTMLVideoElement>,
@@ -302,9 +302,9 @@ export const SelfHostedVideoPlayer = forwardRef(
302302
css={[
303303
iconsContainerStyles,
304304
iconSize === 'large' &&
305-
largeIconsPositionStyles(controlsPosition),
305+
largeIconsPositionStyles(iconsPosition),
306306
iconSize === 'small' &&
307-
smallIconsPositionStyles(controlsPosition),
307+
smallIconsPositionStyles(iconsPosition),
308308
]}
309309
>
310310
{showFullscreenIcon && (

dotcom-rendering/src/components/SelfHostedVideoPlayerIcons.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { SvgArrowExpand } from '@guardian/source/react-components';
44
import { palette } from '../palette';
55
import type { Props as SelfHostedVideoPlayerProps } from './SelfHostedVideoPlayer';
66

7-
export type SubtitleSize = 'small' | 'medium' | 'large';
8-
export type ControlsPosition = 'top' | 'bottom';
9-
107
const buttonStyles = css`
118
border: none;
129
background: none;

0 commit comments

Comments
 (0)