Skip to content

Commit 58b06f8

Browse files
author
Kubit
committed
Add linkContainer to Video component
Add linkContainer to Video component and improve mediabutton styles
1 parent 9955b04 commit 58b06f8

File tree

5 files changed

+60
-54
lines changed

5 files changed

+60
-54
lines changed

src/components/video/components/linkAndActionButton.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { GenericLinkType } from '@/provider/genericComponents';
77

88
import { LinkAndActionButtonAlignment, VideoButtonType } from '../types';
99
import { VideoStyleType } from '../types/videoTheme';
10-
import { BottomContainerStyled } from '../video.styled';
10+
import { BottomContainerStyled, LinkContainerStyled } from '../video.styled';
1111

1212
interface ILinkAndActionButton {
1313
styles: VideoStyleType;
@@ -40,16 +40,18 @@ export const LinkAndActionButton = ({
4040
</Button>
4141
)}
4242
{props.linkUrl && (
43-
<Text
44-
component={props.componentLink}
45-
customTypography={props.styles.link}
46-
decoration={TextDecorationType.UNDERLINE}
47-
target={linkTarget}
48-
url={props.linkUrl}
49-
onClick={props.onLinkClick}
50-
>
51-
{props.linkText}
52-
</Text>
43+
<LinkContainerStyled styles={props.styles}>
44+
<Text
45+
component={props.componentLink}
46+
customTypography={props.styles.link}
47+
decoration={TextDecorationType.UNDERLINE}
48+
target={linkTarget}
49+
url={props.linkUrl}
50+
onClick={props.onLinkClick}
51+
>
52+
{props.linkText}
53+
</Text>
54+
</LinkContainerStyled>
5355
)}
5456
</BottomContainerStyled>
5557
) : null;

src/components/video/components/playStopButton.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,29 @@ interface IPlayStopButton {
1818
handlePlayStopVideo?: React.MouseEventHandler<HTMLButtonElement>;
1919
}
2020

21-
export const PlayStopButton = (props: IPlayStopButton): JSX.Element => {
21+
export const PlayStopButton = (props: IPlayStopButton): JSX.Element | null => {
2222
const device = useMediaDevice();
23-
const ButtonBarPlay = (): JSX.Element | null =>
24-
props.styles.buttonsBarPlayIcon?.size?.[device] ? (
25-
<MediaButton
26-
hasBackground={false}
27-
icon={props.buttonsBarPlayIcon}
28-
size={props.styles.buttonsBarPlayIcon?.size?.[device] as MediaButtonSizeType}
29-
twisted={props.playing}
30-
twistedIcon={props.buttonsBarPlayIconToTransition}
31-
variant={props.styles.buttonsBarPlayIcon?.variant}
32-
onClick={props.handlePlayStopVideo}
33-
/>
34-
) : null;
23+
const ButtonBarPlay = props.styles.buttonsBarPlayIcon?.size?.[device] ? (
24+
<MediaButton
25+
hasBackground={false}
26+
icon={props.buttonsBarPlayIcon}
27+
size={props.styles.buttonsBarPlayIcon?.size?.[device] as MediaButtonSizeType}
28+
twisted={props.playing}
29+
twistedIcon={props.buttonsBarPlayIconToTransition}
30+
variant={props.styles.buttonsBarPlayIcon?.variant}
31+
onClick={props.handlePlayStopVideo}
32+
/>
33+
) : null;
3534
return device === DeviceBreakpointsType.DESKTOP ? (
3635
<Tooltip
3736
childrenAsButton={false}
3837
content={{ content: props.buttonsBarPlayIconTooltip }}
3938
tooltipAsModal={false}
4039
variant={props.styles.tooltip?.variant}
4140
>
42-
<ButtonBarPlay />
41+
{ButtonBarPlay}
4342
</Tooltip>
4443
) : (
45-
<ButtonBarPlay />
44+
ButtonBarPlay
4645
);
4746
};

src/components/video/components/subtitleFullScreenButtons.tsx

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,29 @@ interface ISubtitleFullScreenButtons extends IButtonBarSubtitles, IButtonBarFull
3333
export const SubtitleFullScreenButtons = (props: ISubtitleFullScreenButtons): JSX.Element => {
3434
const device = useMediaDevice();
3535

36-
const ButtonBarSubtitles = (props: IButtonBarSubtitles): JSX.Element | null =>
37-
props.styles.buttonsBarSubtitlesIcon?.size?.[device] ? (
38-
<MediaButton
39-
hasBackground={false}
40-
icon={props.buttonsBarSubtitlesIcon}
41-
size={props.styles.buttonsBarSubtitlesIcon?.size?.[device] as MediaButtonSizeType}
42-
twisted={props.subtitlesActivated}
43-
twistedIcon={props.buttonsBarSubtitlesIconToTransition}
44-
variant={props.styles.buttonsBarSubtitlesIcon?.variant}
45-
onClick={props.onSubtitlesClick}
46-
/>
47-
) : null;
36+
const ButtonBarSubtitles = props.styles.buttonsBarSubtitlesIcon?.size?.[device] ? (
37+
<MediaButton
38+
hasBackground={false}
39+
icon={props.buttonsBarSubtitlesIcon}
40+
size={props.styles.buttonsBarSubtitlesIcon?.size?.[device] as MediaButtonSizeType}
41+
twisted={props.subtitlesActivated}
42+
twistedIcon={props.buttonsBarSubtitlesIconToTransition}
43+
variant={props.styles.buttonsBarSubtitlesIcon?.variant}
44+
onClick={props.onSubtitlesClick}
45+
/>
46+
) : null;
4847

49-
const ButtonBarFullScreen = (props: IButtonBarFullScreen): JSX.Element | null =>
50-
props.styles.buttonsBarFullScreenIcon?.size?.[device] ? (
51-
<MediaButton
52-
hasBackground={false}
53-
icon={props.buttonsBarFullScreenIcon}
54-
size={props.styles.buttonsBarFullScreenIcon?.size?.[device] as MediaButtonSizeType}
55-
twisted={props.fullScreen}
56-
twistedIcon={props.buttonsBarFullScreenIconToTransition}
57-
variant={props.styles.buttonsBarFullScreenIcon?.variant}
58-
onClick={props.onFullScreenClick}
59-
/>
60-
) : null;
48+
const ButtonBarFullScreen = props.styles.buttonsBarFullScreenIcon?.size?.[device] ? (
49+
<MediaButton
50+
hasBackground={false}
51+
icon={props.buttonsBarFullScreenIcon}
52+
size={props.styles.buttonsBarFullScreenIcon?.size?.[device] as MediaButtonSizeType}
53+
twisted={props.fullScreen}
54+
twistedIcon={props.buttonsBarFullScreenIconToTransition}
55+
variant={props.styles.buttonsBarFullScreenIcon?.variant}
56+
onClick={props.onFullScreenClick}
57+
/>
58+
) : null;
6159

6260
return device === DeviceBreakpointsType.DESKTOP ? (
6361
<>
@@ -67,21 +65,21 @@ export const SubtitleFullScreenButtons = (props: ISubtitleFullScreenButtons): JS
6765
tooltipAsModal={false}
6866
variant={props.styles.tooltip?.variant}
6967
>
70-
<ButtonBarSubtitles {...props} />
68+
{ButtonBarSubtitles}
7169
</Tooltip>
7270
<Tooltip
7371
childrenAsButton={false}
7472
content={{ content: props.buttonsBarFullScreenIconTooltip }}
7573
tooltipAsModal={false}
7674
variant={props.styles.tooltip?.variant}
7775
>
78-
<ButtonBarFullScreen {...props} />
76+
{ButtonBarFullScreen}
7977
</Tooltip>
8078
</>
8179
) : (
8280
<>
83-
<ButtonBarSubtitles {...props} />
84-
<ButtonBarFullScreen {...props} />
81+
{ButtonBarSubtitles}
82+
{ButtonBarFullScreen}
8583
</>
8684
);
8785
};

src/components/video/types/videoTheme.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export type VideoStyleType = {
3939
buttonsBarFirstSubcontainer?: CommonStyleType;
4040
buttonsBarSecondSubcontainer?: CommonStyleType;
4141
bottomContainer?: CommonStyleType;
42+
linkContainer?: CommonStyleType;
4243
link?: TypographyTypes;
4344
actionButton?: {
4445
size?: string;

src/components/video/video.styled.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ export const BottomContainerStyled = styled.div<
149149
${({ styles }) => getStyles(styles?.bottomContainer)}
150150
`;
151151

152+
export const LinkContainerStyled = styled.div<VideoPropsStyleType>`
153+
> * {
154+
${({ styles }) => getStyles(styles?.linkContainer)}
155+
}
156+
`;
157+
152158
export const VideoSkeletonContainerStyled = styled.div<VideoPropsStyleType>`
153159
${({ styles }) => getStyles(styles?.videoSkeletonContainer)}
154160
`;

0 commit comments

Comments
 (0)