From 77cecfb374038ad832d58d41e634770182fe1fcb Mon Sep 17 00:00:00 2001 From: kkmch Date: Fri, 29 Sep 2023 12:04:32 +0200 Subject: [PATCH] feat: muteButtonShown --- src/blocks/Media/__stories__/data.json | 6 +++--- src/components/ReactPlayer/CustomBarControls.tsx | 8 ++++---- src/components/ReactPlayer/ReactPlayer.tsx | 4 ++-- src/models/constructor-items/common.ts | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/blocks/Media/__stories__/data.json b/src/blocks/Media/__stories__/data.json index 04c5d2eb1..b83ef9c02 100644 --- a/src/blocks/Media/__stories__/data.json +++ b/src/blocks/Media/__stories__/data.json @@ -115,7 +115,7 @@ } }, "videoWithAutoPlayCustomControlsWithUiKitPlayPauseButton": { - "title": "Video with autoplay and custom controls with UIKit play/pause button", + "title": "Video with autoplay and custom controls with UIKit icon controls", "media": { "light": { "video": { @@ -130,7 +130,7 @@ "controls": "custom", "customControlsOptions": { "type": "with-uikit-play-pause-button", - "muteButtonHidden": true, + "muteButtonShown": false, "backgroundShadowHidden": true, "positioning": "left" }, @@ -153,7 +153,7 @@ "controls": "custom", "customControlsOptions": { "type": "with-uikit-play-pause-button", - "muteButtonHidden": true, + "muteButtonShown": false, "backgroundShadowHidden": true, "positioning": "left" }, diff --git a/src/components/ReactPlayer/CustomBarControls.tsx b/src/components/ReactPlayer/CustomBarControls.tsx index b8c7ff721..38cfe902c 100644 --- a/src/components/ReactPlayer/CustomBarControls.tsx +++ b/src/components/ReactPlayer/CustomBarControls.tsx @@ -43,7 +43,7 @@ export interface CustomBarControlsProps extends ClassNameProps, CustomControlsOp type?: CustomControlsType; isPaused?: boolean; onPlayClick?: () => void; - shown: boolean; + shown?: boolean; } const CustomBarControls = (props: CustomBarControlsProps) => { @@ -54,7 +54,7 @@ const CustomBarControls = (props: CustomBarControlsProps) => { type = CustomControlsType.WithMuteButton, isPaused, onPlayClick, - muteButtonHidden: isMuteButtonHidden, + muteButtonShown: isMuteButtonShown = true, shown, positioning, } = props; @@ -65,7 +65,7 @@ const CustomBarControls = (props: CustomBarControlsProps) => { const pauseIcon = pauseIconsMap[type]; const muteButton = useMemo(() => { - if (!mute || isMuteButtonHidden) { + if (!mute || !isMuteButtonShown) { return null; } @@ -83,7 +83,7 @@ const CustomBarControls = (props: CustomBarControlsProps) => { )} ); - }, [elapsedTimePercent, isMuteButtonHidden, mute, muteIcon, type, unmuteIcon]); + }, [elapsedTimePercent, isMuteButtonShown, mute, muteIcon, type, unmuteIcon]); const playPauseButton = useMemo(() => { const icon = isPaused ? playIcon : pauseIcon; diff --git a/src/components/ReactPlayer/ReactPlayer.tsx b/src/components/ReactPlayer/ReactPlayer.tsx index 1b66003b5..5014b8abc 100644 --- a/src/components/ReactPlayer/ReactPlayer.tsx +++ b/src/components/ReactPlayer/ReactPlayer.tsx @@ -95,7 +95,7 @@ export const ReactPlayerBlock = React.forwardRef diff --git a/src/models/constructor-items/common.ts b/src/models/constructor-items/common.ts index 6bd3e7aa7..eec10f08e 100644 --- a/src/models/constructor-items/common.ts +++ b/src/models/constructor-items/common.ts @@ -218,7 +218,7 @@ export interface ButtonImageProps { export interface CustomControlsOptions { type?: CustomControlsType; - muteButtonHidden?: boolean; + muteButtonShown?: boolean; positioning?: CustomControlsButtonPositioning; }