@alfalab/core-components-gallery 7.2.3 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Component.js +51 -7
- package/Component.js.map +1 -1
- package/components/bottom-button/index.css +5 -5
- package/components/bottom-button/index.module.css.js +1 -1
- package/components/buttons/index.css +5 -5
- package/components/buttons/index.d.ts +3 -1
- package/components/buttons/index.js +49 -12
- package/components/buttons/index.js.map +1 -1
- package/components/buttons/index.module.css.js +1 -1
- package/components/header/Component.js +1 -0
- package/components/header/Component.js.map +1 -1
- package/components/header/index.css +3 -2
- package/components/header/index.module.css.js +1 -1
- package/components/header/index.module.css.js.map +1 -1
- package/components/header-info-block/Component.js +2 -1
- package/components/header-info-block/Component.js.map +1 -1
- package/components/header-info-block/index.css +4 -4
- package/components/header-info-block/index.module.css.js +1 -1
- package/components/header-mobile/index.css +6 -6
- package/components/header-mobile/index.module.css.js +1 -1
- package/components/image-preview/Component.js +2 -1
- package/components/image-preview/Component.js.map +1 -1
- package/components/image-preview/index.css +20 -20
- package/components/image-preview/index.module.css.js +1 -1
- package/components/image-preview/index.module.css.js.map +1 -1
- package/components/image-viewer/hooks.js +3 -2
- package/components/image-viewer/hooks.js.map +1 -1
- package/components/image-viewer/index.css +30 -31
- package/components/image-viewer/index.module.css.js +1 -1
- package/components/image-viewer/index.module.css.js.map +1 -1
- package/components/image-viewer/single.js +1 -0
- package/components/image-viewer/single.js.map +1 -1
- package/components/image-viewer/slide.js +3 -2
- package/components/image-viewer/slide.js.map +1 -1
- package/components/image-viewer/video/index.css +22 -10
- package/components/image-viewer/video/index.js +50 -15
- package/components/image-viewer/video/index.js.map +1 -1
- package/components/image-viewer/video/index.module.css.js +1 -1
- package/components/image-viewer/video/index.module.css.js.map +1 -1
- package/components/info-bar/Component.js +1 -0
- package/components/info-bar/Component.js.map +1 -1
- package/components/info-bar/index.css +3 -3
- package/components/info-bar/index.module.css.js +1 -1
- package/components/navigation-bar/Component.js +56 -26
- package/components/navigation-bar/Component.js.map +1 -1
- package/components/navigation-bar/index.css +21 -11
- package/components/navigation-bar/index.module.css.js +1 -1
- package/components/navigation-bar/index.module.css.js.map +1 -1
- package/components/subtitles/index.css +3 -3
- package/components/subtitles/index.module.css.js +1 -1
- package/constants.d.ts +1 -1
- package/constants.js +1 -1
- package/constants.js.map +1 -1
- package/cssm/Component.js +51 -7
- package/cssm/Component.js.map +1 -1
- package/cssm/components/buttons/index.d.ts +3 -1
- package/cssm/components/buttons/index.js +54 -17
- package/cssm/components/buttons/index.js.map +1 -1
- package/cssm/components/header/Component.js +1 -0
- package/cssm/components/header/Component.js.map +1 -1
- package/cssm/components/header/index.module.css +2 -1
- package/cssm/components/header-info-block/Component.js +2 -1
- package/cssm/components/header-info-block/Component.js.map +1 -1
- package/cssm/components/image-preview/Component.js +2 -1
- package/cssm/components/image-preview/Component.js.map +1 -1
- package/cssm/components/image-preview/index.module.css +3 -3
- package/cssm/components/image-viewer/hooks.js +3 -2
- package/cssm/components/image-viewer/hooks.js.map +1 -1
- package/cssm/components/image-viewer/index.module.css +2 -3
- package/cssm/components/image-viewer/single.js +1 -0
- package/cssm/components/image-viewer/single.js.map +1 -1
- package/cssm/components/image-viewer/slide.js +3 -2
- package/cssm/components/image-viewer/slide.js.map +1 -1
- package/cssm/components/image-viewer/video/index.js +50 -15
- package/cssm/components/image-viewer/video/index.js.map +1 -1
- package/cssm/components/image-viewer/video/index.module.css +15 -3
- package/cssm/components/info-bar/Component.js +1 -0
- package/cssm/components/info-bar/Component.js.map +1 -1
- package/cssm/components/navigation-bar/Component.js +56 -26
- package/cssm/components/navigation-bar/Component.js.map +1 -1
- package/cssm/components/navigation-bar/index.module.css +13 -3
- package/cssm/constants.d.ts +1 -1
- package/cssm/constants.js +1 -1
- package/cssm/constants.js.map +1 -1
- package/cssm/hooks/use-custom-subtitles.js +57 -11
- package/cssm/hooks/use-custom-subtitles.js.map +1 -1
- package/cssm/index.js +1 -0
- package/cssm/index.js.map +1 -1
- package/cssm/types.d.ts +4 -2
- package/cssm/utils/index.d.ts +1 -0
- package/cssm/utils/index.js +2 -0
- package/cssm/utils/index.js.map +1 -1
- package/cssm/utils/modern-download.d.ts +6 -0
- package/cssm/utils/modern-download.js +113 -0
- package/cssm/utils/modern-download.js.map +1 -0
- package/esm/Component.js +51 -7
- package/esm/Component.js.map +1 -1
- package/esm/components/bottom-button/index.css +5 -5
- package/esm/components/bottom-button/index.module.css.js +1 -1
- package/esm/components/buttons/index.css +5 -5
- package/esm/components/buttons/index.d.ts +3 -1
- package/esm/components/buttons/index.js +50 -13
- package/esm/components/buttons/index.js.map +1 -1
- package/esm/components/buttons/index.module.css.js +1 -1
- package/esm/components/header/Component.js +1 -0
- package/esm/components/header/Component.js.map +1 -1
- package/esm/components/header/index.css +3 -2
- package/esm/components/header/index.module.css.js +1 -1
- package/esm/components/header/index.module.css.js.map +1 -1
- package/esm/components/header-info-block/Component.js +2 -1
- package/esm/components/header-info-block/Component.js.map +1 -1
- package/esm/components/header-info-block/index.css +4 -4
- package/esm/components/header-info-block/index.module.css.js +1 -1
- package/esm/components/header-mobile/index.css +6 -6
- package/esm/components/header-mobile/index.module.css.js +1 -1
- package/esm/components/image-preview/Component.js +2 -1
- package/esm/components/image-preview/Component.js.map +1 -1
- package/esm/components/image-preview/index.css +20 -20
- package/esm/components/image-preview/index.module.css.js +1 -1
- package/esm/components/image-preview/index.module.css.js.map +1 -1
- package/esm/components/image-viewer/hooks.js +3 -2
- package/esm/components/image-viewer/hooks.js.map +1 -1
- package/esm/components/image-viewer/index.css +30 -31
- package/esm/components/image-viewer/index.module.css.js +1 -1
- package/esm/components/image-viewer/index.module.css.js.map +1 -1
- package/esm/components/image-viewer/single.js +1 -0
- package/esm/components/image-viewer/single.js.map +1 -1
- package/esm/components/image-viewer/slide.js +3 -2
- package/esm/components/image-viewer/slide.js.map +1 -1
- package/esm/components/image-viewer/video/index.css +22 -10
- package/esm/components/image-viewer/video/index.js +51 -16
- package/esm/components/image-viewer/video/index.js.map +1 -1
- package/esm/components/image-viewer/video/index.module.css.js +1 -1
- package/esm/components/image-viewer/video/index.module.css.js.map +1 -1
- package/esm/components/info-bar/Component.js +1 -0
- package/esm/components/info-bar/Component.js.map +1 -1
- package/esm/components/info-bar/index.css +3 -3
- package/esm/components/info-bar/index.module.css.js +1 -1
- package/esm/components/navigation-bar/Component.js +56 -25
- package/esm/components/navigation-bar/Component.js.map +1 -1
- package/esm/components/navigation-bar/index.css +21 -11
- package/esm/components/navigation-bar/index.module.css.js +1 -1
- package/esm/components/navigation-bar/index.module.css.js.map +1 -1
- package/esm/components/subtitles/index.css +3 -3
- package/esm/components/subtitles/index.module.css.js +1 -1
- package/esm/constants.d.ts +1 -1
- package/esm/constants.js +1 -1
- package/esm/constants.js.map +1 -1
- package/esm/hooks/use-custom-subtitles.js +57 -11
- package/esm/hooks/use-custom-subtitles.js.map +1 -1
- package/esm/index.css +9 -9
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/index.module.css.js +1 -1
- package/esm/types.d.ts +4 -2
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/modern-download.d.ts +6 -0
- package/esm/utils/modern-download.js +109 -0
- package/esm/utils/modern-download.js.map +1 -0
- package/hooks/use-custom-subtitles.js +57 -11
- package/hooks/use-custom-subtitles.js.map +1 -1
- package/index.css +9 -9
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/index.module.css.js +1 -1
- package/modern/Component.js +50 -7
- package/modern/Component.js.map +1 -1
- package/modern/components/bottom-button/index.css +5 -5
- package/modern/components/bottom-button/index.module.css.js +1 -1
- package/modern/components/buttons/index.css +5 -5
- package/modern/components/buttons/index.d.ts +3 -1
- package/modern/components/buttons/index.js +51 -12
- package/modern/components/buttons/index.js.map +1 -1
- package/modern/components/buttons/index.module.css.js +1 -1
- package/modern/components/header/index.css +3 -2
- package/modern/components/header/index.module.css.js +1 -1
- package/modern/components/header/index.module.css.js.map +1 -1
- package/modern/components/header-info-block/Component.js +1 -1
- package/modern/components/header-info-block/Component.js.map +1 -1
- package/modern/components/header-info-block/index.css +4 -4
- package/modern/components/header-info-block/index.module.css.js +1 -1
- package/modern/components/header-mobile/index.css +6 -6
- package/modern/components/header-mobile/index.module.css.js +1 -1
- package/modern/components/image-preview/Component.js +1 -1
- package/modern/components/image-preview/Component.js.map +1 -1
- package/modern/components/image-preview/index.css +20 -20
- package/modern/components/image-preview/index.module.css.js +1 -1
- package/modern/components/image-preview/index.module.css.js.map +1 -1
- package/modern/components/image-viewer/hooks.js +3 -2
- package/modern/components/image-viewer/hooks.js.map +1 -1
- package/modern/components/image-viewer/index.css +30 -31
- package/modern/components/image-viewer/index.module.css.js +1 -1
- package/modern/components/image-viewer/index.module.css.js.map +1 -1
- package/modern/components/image-viewer/slide.js +2 -2
- package/modern/components/image-viewer/slide.js.map +1 -1
- package/modern/components/image-viewer/video/index.css +22 -10
- package/modern/components/image-viewer/video/index.js +47 -12
- package/modern/components/image-viewer/video/index.js.map +1 -1
- package/modern/components/image-viewer/video/index.module.css.js +1 -1
- package/modern/components/image-viewer/video/index.module.css.js.map +1 -1
- package/modern/components/info-bar/index.css +3 -3
- package/modern/components/info-bar/index.module.css.js +1 -1
- package/modern/components/navigation-bar/Component.js +55 -25
- package/modern/components/navigation-bar/Component.js.map +1 -1
- package/modern/components/navigation-bar/index.css +21 -11
- package/modern/components/navigation-bar/index.module.css.js +1 -1
- package/modern/components/navigation-bar/index.module.css.js.map +1 -1
- package/modern/components/subtitles/index.css +3 -3
- package/modern/components/subtitles/index.module.css.js +1 -1
- package/modern/constants.d.ts +1 -1
- package/modern/constants.js +1 -1
- package/modern/constants.js.map +1 -1
- package/modern/hooks/use-custom-subtitles.js +56 -9
- package/modern/hooks/use-custom-subtitles.js.map +1 -1
- package/modern/index.css +9 -9
- package/modern/index.module.css.js +1 -1
- package/modern/types.d.ts +4 -2
- package/modern/utils/index.d.ts +1 -0
- package/modern/utils/index.js +1 -0
- package/modern/utils/index.js.map +1 -1
- package/modern/utils/modern-download.d.ts +6 -0
- package/modern/utils/modern-download.js +76 -0
- package/modern/utils/modern-download.js.map +1 -0
- package/moderncssm/Component.js +50 -7
- package/moderncssm/Component.js.map +1 -1
- package/moderncssm/components/buttons/index.d.ts +3 -1
- package/moderncssm/components/buttons/index.js +51 -12
- package/moderncssm/components/buttons/index.js.map +1 -1
- package/moderncssm/components/header/index.module.css +1 -1
- package/moderncssm/components/header-info-block/Component.js +1 -1
- package/moderncssm/components/header-info-block/Component.js.map +1 -1
- package/moderncssm/components/image-preview/Component.js +1 -1
- package/moderncssm/components/image-preview/Component.js.map +1 -1
- package/moderncssm/components/image-preview/index.module.css +2 -2
- package/moderncssm/components/image-viewer/hooks.js +3 -2
- package/moderncssm/components/image-viewer/hooks.js.map +1 -1
- package/moderncssm/components/image-viewer/index.module.css +2 -2
- package/moderncssm/components/image-viewer/slide.js +2 -2
- package/moderncssm/components/image-viewer/slide.js.map +1 -1
- package/moderncssm/components/image-viewer/video/index.js +47 -12
- package/moderncssm/components/image-viewer/video/index.js.map +1 -1
- package/moderncssm/components/image-viewer/video/index.module.css +16 -3
- package/moderncssm/components/navigation-bar/Component.js +55 -25
- package/moderncssm/components/navigation-bar/Component.js.map +1 -1
- package/moderncssm/components/navigation-bar/index.module.css +14 -2
- package/moderncssm/constants.d.ts +1 -1
- package/moderncssm/constants.js +1 -1
- package/moderncssm/constants.js.map +1 -1
- package/moderncssm/hooks/use-custom-subtitles.js +56 -9
- package/moderncssm/hooks/use-custom-subtitles.js.map +1 -1
- package/moderncssm/types.d.ts +4 -2
- package/moderncssm/utils/index.d.ts +1 -0
- package/moderncssm/utils/index.js +1 -0
- package/moderncssm/utils/index.js.map +1 -1
- package/moderncssm/utils/modern-download.d.ts +6 -0
- package/moderncssm/utils/modern-download.js +76 -0
- package/moderncssm/utils/modern-download.js.map +1 -0
- package/package.json +2 -2
- package/src/Component.tsx +63 -6
- package/src/components/buttons/index.tsx +157 -62
- package/src/components/header/index.module.css +1 -1
- package/src/components/header-info-block/Component.tsx +2 -2
- package/src/components/image-preview/Component.tsx +1 -1
- package/src/components/image-preview/index.module.css +2 -2
- package/src/components/image-viewer/hooks.ts +3 -2
- package/src/components/image-viewer/index.module.css +2 -2
- package/src/components/image-viewer/slide.tsx +2 -1
- package/src/components/image-viewer/video/index.module.css +16 -3
- package/src/components/image-viewer/video/index.tsx +62 -13
- package/src/components/navigation-bar/Component.tsx +68 -27
- package/src/components/navigation-bar/index.module.css +12 -2
- package/src/constants.ts +1 -1
- package/src/hooks/use-custom-subtitles.ts +72 -12
- package/src/types.ts +4 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/modern-download.ts +107 -0
- package/types.d.ts +4 -2
- package/utils/index.d.ts +1 -0
- package/utils/index.js +2 -0
- package/utils/index.js.map +1 -1
- package/utils/modern-download.d.ts +6 -0
- package/utils/modern-download.js +113 -0
- package/utils/modern-download.js.map +1 -0
|
@@ -2,6 +2,7 @@ import React, { type FC, type MutableRefObject } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { IconButton, type IconButtonProps } from '@alfalab/core-components-icon-button';
|
|
5
|
+
import { useIsDesktop } from '@alfalab/core-components-mq';
|
|
5
6
|
import { TooltipDesktop } from '@alfalab/core-components-tooltip/desktop';
|
|
6
7
|
import { ArrowLeftMIcon } from '@alfalab/icons-glyph/ArrowLeftMIcon';
|
|
7
8
|
import { ArrowsInwardMIcon } from '@alfalab/icons-glyph/ArrowsInwardMIcon';
|
|
@@ -14,6 +15,8 @@ import { ShareMIcon } from '@alfalab/icons-glyph/ShareMIcon';
|
|
|
14
15
|
import { SoundCrossMIcon } from '@alfalab/icons-glyph/SoundCrossMIcon';
|
|
15
16
|
import { SoundMIcon } from '@alfalab/icons-glyph/SoundMIcon';
|
|
16
17
|
|
|
18
|
+
import { downloadFile, isVideo } from '../../utils';
|
|
19
|
+
|
|
17
20
|
import styles from './index.module.css';
|
|
18
21
|
|
|
19
22
|
type Props = Omit<IconButtonProps, 'icon' | 'colors'> & {
|
|
@@ -21,13 +24,10 @@ type Props = Omit<IconButtonProps, 'icon' | 'colors'> & {
|
|
|
21
24
|
download?: string | boolean;
|
|
22
25
|
};
|
|
23
26
|
|
|
24
|
-
export const Fullscreen: FC<Props> = ({ buttonRef, ...restProps }) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
content='Открыть в полноэкранном режиме'
|
|
29
|
-
fallbackPlacements={['bottom-end']}
|
|
30
|
-
>
|
|
27
|
+
export const Fullscreen: FC<Props> = ({ buttonRef, ...restProps }) => {
|
|
28
|
+
const isDesktop = useIsDesktop();
|
|
29
|
+
|
|
30
|
+
const iconButton = (
|
|
31
31
|
<IconButton
|
|
32
32
|
{...restProps}
|
|
33
33
|
ref={buttonRef}
|
|
@@ -35,8 +35,23 @@ export const Fullscreen: FC<Props> = ({ buttonRef, ...restProps }) => (
|
|
|
35
35
|
aria-label='Открыть в полноэкранном режиме'
|
|
36
36
|
className={styles.iconButton}
|
|
37
37
|
/>
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return isDesktop ? (
|
|
41
|
+
<TooltipDesktop
|
|
42
|
+
view='hint'
|
|
43
|
+
colors='inverted'
|
|
44
|
+
trigger='hover'
|
|
45
|
+
position='bottom'
|
|
46
|
+
content='Открыть в полноэкранном режиме'
|
|
47
|
+
fallbackPlacements={['bottom-end']}
|
|
48
|
+
>
|
|
49
|
+
{iconButton}
|
|
50
|
+
</TooltipDesktop>
|
|
51
|
+
) : (
|
|
52
|
+
iconButton
|
|
53
|
+
);
|
|
54
|
+
};
|
|
40
55
|
|
|
41
56
|
export const BackArrow: FC<Props> = ({ buttonRef, ...restProps }) => (
|
|
42
57
|
<IconButton
|
|
@@ -68,13 +83,10 @@ export const Pause: FC<Props> = ({ buttonRef, className, ...restProps }) => (
|
|
|
68
83
|
/>
|
|
69
84
|
);
|
|
70
85
|
|
|
71
|
-
export const ExitFullscreen: FC<Props> = ({ buttonRef, ...restProps }) =>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
content='Выйти из полноэкранного режима'
|
|
76
|
-
fallbackPlacements={['bottom-end']}
|
|
77
|
-
>
|
|
86
|
+
export const ExitFullscreen: FC<Props> = ({ buttonRef, ...restProps }) => {
|
|
87
|
+
const isDesktop = useIsDesktop();
|
|
88
|
+
|
|
89
|
+
const iconButton = (
|
|
78
90
|
<IconButton
|
|
79
91
|
{...restProps}
|
|
80
92
|
ref={buttonRef}
|
|
@@ -82,17 +94,28 @@ export const ExitFullscreen: FC<Props> = ({ buttonRef, ...restProps }) => (
|
|
|
82
94
|
aria-label='Выйти из полноэкранного режима'
|
|
83
95
|
className={styles.iconButton}
|
|
84
96
|
/>
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
return isDesktop ? (
|
|
100
|
+
<TooltipDesktop
|
|
101
|
+
view='hint'
|
|
102
|
+
colors='inverted'
|
|
103
|
+
trigger='hover'
|
|
104
|
+
position='bottom'
|
|
105
|
+
content='Выйти из полноэкранного режима'
|
|
106
|
+
fallbackPlacements={['bottom-end']}
|
|
107
|
+
>
|
|
108
|
+
{iconButton}
|
|
109
|
+
</TooltipDesktop>
|
|
110
|
+
) : (
|
|
111
|
+
iconButton
|
|
112
|
+
);
|
|
113
|
+
};
|
|
87
114
|
|
|
88
|
-
export const MuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) =>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
content='Выключить звук'
|
|
93
|
-
fallbackPlacements={['bottom-end']}
|
|
94
|
-
targetClassName={className}
|
|
95
|
-
>
|
|
115
|
+
export const MuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) => {
|
|
116
|
+
const isDesktop = useIsDesktop();
|
|
117
|
+
|
|
118
|
+
const iconButton = (
|
|
96
119
|
<IconButton
|
|
97
120
|
{...restProps}
|
|
98
121
|
ref={buttonRef}
|
|
@@ -100,17 +123,29 @@ export const MuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) =>
|
|
|
100
123
|
aria-label='Выключить звук'
|
|
101
124
|
className={styles.iconButton}
|
|
102
125
|
/>
|
|
103
|
-
|
|
104
|
-
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
return isDesktop ? (
|
|
129
|
+
<TooltipDesktop
|
|
130
|
+
view='hint'
|
|
131
|
+
colors='inverted'
|
|
132
|
+
trigger='hover'
|
|
133
|
+
position='bottom'
|
|
134
|
+
content='Выключить звук'
|
|
135
|
+
fallbackPlacements={['bottom-end']}
|
|
136
|
+
targetClassName={className}
|
|
137
|
+
>
|
|
138
|
+
{iconButton}
|
|
139
|
+
</TooltipDesktop>
|
|
140
|
+
) : (
|
|
141
|
+
iconButton
|
|
142
|
+
);
|
|
143
|
+
};
|
|
105
144
|
|
|
106
|
-
export const UnmuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) =>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
content='Включить звук'
|
|
111
|
-
fallbackPlacements={['bottom-end']}
|
|
112
|
-
targetClassName={className}
|
|
113
|
-
>
|
|
145
|
+
export const UnmuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) => {
|
|
146
|
+
const isDesktop = useIsDesktop();
|
|
147
|
+
|
|
148
|
+
const iconButton = (
|
|
114
149
|
<IconButton
|
|
115
150
|
{...restProps}
|
|
116
151
|
ref={buttonRef}
|
|
@@ -118,40 +153,100 @@ export const UnmuteVideo: FC<Props> = ({ buttonRef, className, ...restProps }) =
|
|
|
118
153
|
aria-label='Включить звук'
|
|
119
154
|
className={styles.iconButton}
|
|
120
155
|
/>
|
|
121
|
-
|
|
122
|
-
);
|
|
156
|
+
);
|
|
123
157
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
);
|
|
158
|
+
return isDesktop ? (
|
|
159
|
+
<TooltipDesktop
|
|
160
|
+
view='hint'
|
|
161
|
+
colors='inverted'
|
|
162
|
+
trigger='hover'
|
|
163
|
+
position='bottom'
|
|
164
|
+
content='Включить звук'
|
|
165
|
+
fallbackPlacements={['bottom-end']}
|
|
166
|
+
targetClassName={className}
|
|
167
|
+
>
|
|
168
|
+
{iconButton}
|
|
169
|
+
</TooltipDesktop>
|
|
170
|
+
) : (
|
|
171
|
+
iconButton
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const Download: FC<Props & { href?: string }> = ({ href, ...props }) => {
|
|
176
|
+
const isDesktop = useIsDesktop();
|
|
177
|
+
|
|
178
|
+
const handleMobileVideoDownload = async (e: React.MouseEvent) => {
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
|
|
181
|
+
if (!href) return;
|
|
182
|
+
|
|
183
|
+
const fileName = props.download?.toString() || 'video';
|
|
184
|
+
const fileType = isVideo(href) ? 'video/*' : undefined;
|
|
185
|
+
|
|
186
|
+
await downloadFile({
|
|
187
|
+
url: href,
|
|
188
|
+
fileName,
|
|
189
|
+
fileType,
|
|
190
|
+
});
|
|
191
|
+
};
|
|
139
192
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
193
|
+
const iconButtonProps = {
|
|
194
|
+
...props,
|
|
195
|
+
icon: PointerDownMIcon,
|
|
196
|
+
'aria-label': 'Скачать' as const,
|
|
197
|
+
className: styles.iconButton,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const iconButton =
|
|
201
|
+
!isDesktop && isVideo(href) ? (
|
|
202
|
+
<IconButton {...iconButtonProps} onClick={handleMobileVideoDownload} />
|
|
203
|
+
) : (
|
|
204
|
+
<IconButton {...iconButtonProps} href={href} />
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
return isDesktop ? (
|
|
208
|
+
<TooltipDesktop
|
|
209
|
+
view='hint'
|
|
210
|
+
colors='inverted'
|
|
211
|
+
trigger='hover'
|
|
212
|
+
position='bottom'
|
|
213
|
+
content='Скачать'
|
|
214
|
+
fallbackPlacements={['bottom-end']}
|
|
215
|
+
>
|
|
216
|
+
{iconButton}
|
|
217
|
+
</TooltipDesktop>
|
|
218
|
+
) : (
|
|
219
|
+
iconButton
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export const Share: FC<Props> = (props) => {
|
|
224
|
+
const isDesktop = useIsDesktop();
|
|
225
|
+
|
|
226
|
+
const iconButton = (
|
|
147
227
|
<IconButton
|
|
148
228
|
{...props}
|
|
149
229
|
icon={ShareMIcon}
|
|
150
230
|
aria-label='Поделиться'
|
|
151
231
|
className={styles.iconButton}
|
|
152
232
|
/>
|
|
153
|
-
|
|
154
|
-
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
return isDesktop ? (
|
|
236
|
+
<TooltipDesktop
|
|
237
|
+
view='hint'
|
|
238
|
+
colors='inverted'
|
|
239
|
+
trigger='hover'
|
|
240
|
+
position='bottom'
|
|
241
|
+
content='Поделиться'
|
|
242
|
+
fallbackPlacements={['bottom-end']}
|
|
243
|
+
>
|
|
244
|
+
{iconButton}
|
|
245
|
+
</TooltipDesktop>
|
|
246
|
+
) : (
|
|
247
|
+
iconButton
|
|
248
|
+
);
|
|
249
|
+
};
|
|
155
250
|
|
|
156
251
|
export const Exit: FC<Props> = (props) => (
|
|
157
252
|
<IconButton {...props} icon={CrossMIcon} aria-label='Закрыть' className={styles.iconButton} />
|
|
@@ -18,9 +18,9 @@ export const HeaderInfoBlock: FC<HeaderInfoBlockProps> = ({ filename, descriptio
|
|
|
18
18
|
<div className={styles.info}>
|
|
19
19
|
<div className={styles.filenameContainer}>
|
|
20
20
|
<TypographyTitle
|
|
21
|
-
tag='
|
|
21
|
+
tag='h2'
|
|
22
22
|
className={styles.filenameHead}
|
|
23
|
-
view='
|
|
23
|
+
view='small'
|
|
24
24
|
font='system'
|
|
25
25
|
color='static-primary-light'
|
|
26
26
|
>
|
|
@@ -151,7 +151,7 @@ export const ImagePreview: FC<Props> = ({ image, active = false, index, onSelect
|
|
|
151
151
|
return (
|
|
152
152
|
<div
|
|
153
153
|
className={cn(styles.preview, styles.image, {
|
|
154
|
-
[styles.loading]: !meta,
|
|
154
|
+
[styles.loading]: !meta?.loaded,
|
|
155
155
|
[styles.mobile]: isMobile,
|
|
156
156
|
})}
|
|
157
157
|
>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
background-color: var(--color-static-neutral-100-inverted);
|
|
60
60
|
|
|
61
61
|
& .active {
|
|
62
|
-
background-color: var(--color-static-neutral-
|
|
62
|
+
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
display: flex;
|
|
68
68
|
justify-content: center;
|
|
69
69
|
align-items: center;
|
|
70
|
-
background-color: var(--color-static-neutral-
|
|
70
|
+
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
71
71
|
opacity: 0.3;
|
|
72
72
|
|
|
73
73
|
&.active {
|
|
@@ -42,9 +42,10 @@ export const useHandleImageViewer = () => {
|
|
|
42
42
|
|
|
43
43
|
const isPlaceholder = Boolean(eventTarget.closest(`.${styles.placeholder}`));
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const isContentArea = Boolean(eventTarget.closest('[data-content-area]'));
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
// Закрываем галерею только при клике вне элементов контента и только на desktop
|
|
48
|
+
if (!isPlaceholder && !isArrow && !isContentArea && !isMobile) {
|
|
48
49
|
onClose();
|
|
49
50
|
}
|
|
50
51
|
},
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
|
|
133
133
|
max-height: calc(100vh - 80px);
|
|
134
134
|
max-height: calc(100dvh - 80px);
|
|
135
|
-
padding: var(--gap-32);
|
|
135
|
+
padding: var(--gap-0) var(--gap-32) var(--gap-32);
|
|
136
136
|
box-sizing: border-box;
|
|
137
137
|
|
|
138
138
|
&.mobile {
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
width: 100%;
|
|
243
243
|
height: 100%;
|
|
244
244
|
border-radius: var(--border-radius-8);
|
|
245
|
-
background-color: var(--color-static-neutral-
|
|
245
|
+
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
.brokenImgWrapper {
|
|
@@ -53,7 +53,7 @@ const SlideInner: FC<SlideInnerProps> = ({ children, broken, loading, isVideoVie
|
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<div className={cn(styles.slide, { [styles.slideLoading]: loading })}>
|
|
56
|
+
<div className={cn(styles.slide, { [styles.slideLoading]: loading && !isVideoView })}>
|
|
57
57
|
{broken ? <div className={styles.placeholder}>{content}</div> : content}
|
|
58
58
|
<Spinner className={styles.spinner} preset={48} visible={loading} />
|
|
59
59
|
</div>
|
|
@@ -135,6 +135,7 @@ export const Slide: FC<SlideProps> = ({
|
|
|
135
135
|
onLoad={(event) => handleLoad(event, index)}
|
|
136
136
|
onError={() => handleLoadError(index)}
|
|
137
137
|
style={imageStyle}
|
|
138
|
+
data-content-area='true'
|
|
138
139
|
data-test-id={slideVisible ? TestIds.ACTIVE_IMAGE : undefined}
|
|
139
140
|
/>
|
|
140
141
|
</SlideInner>
|
|
@@ -5,10 +5,23 @@
|
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
height: 100%;
|
|
8
|
-
width:
|
|
9
|
-
|
|
10
|
-
min-height: 0;
|
|
8
|
+
width: auto;
|
|
9
|
+
max-width: 100%;
|
|
11
10
|
position: relative;
|
|
11
|
+
min-width: 300px;
|
|
12
|
+
min-height: 200px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mobileWrapper {
|
|
16
|
+
width: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.videoWrapper.loading {
|
|
20
|
+
width: 100%;
|
|
21
|
+
aspect-ratio: 16/9;
|
|
22
|
+
background-color: var(--color-static-neutral-translucent-100-inverted);
|
|
23
|
+
border-radius: var(--border-radius-24);
|
|
24
|
+
align-items: center;
|
|
12
25
|
}
|
|
13
26
|
|
|
14
27
|
.video {
|
|
@@ -27,9 +27,12 @@ type Props = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const Video = ({ url, index, className, isActive }: Props) => {
|
|
30
|
+
const [videoLoaded, setVideoLoaded] = useState(false);
|
|
30
31
|
const playerRef = useRef<HTMLVideoElement>(null);
|
|
31
32
|
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
32
33
|
const [hlsSupported, setHlsSupported] = useState<boolean>(true);
|
|
34
|
+
const abortController = useRef(new AbortController());
|
|
35
|
+
const [videoError, setVideoError] = useState(false);
|
|
33
36
|
|
|
34
37
|
const {
|
|
35
38
|
setImageMeta,
|
|
@@ -83,6 +86,47 @@ export const Video = ({ url, index, className, isActive }: Props) => {
|
|
|
83
86
|
[setImageMeta, index],
|
|
84
87
|
);
|
|
85
88
|
|
|
89
|
+
useEffect(() => () => abortController.current.abort(), []);
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
const video = playerRef.current;
|
|
93
|
+
|
|
94
|
+
if (!video) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const { signal } = abortController.current;
|
|
99
|
+
|
|
100
|
+
const handleCanPlay = () => {
|
|
101
|
+
setVideoLoaded(true);
|
|
102
|
+
setVideoError(false);
|
|
103
|
+
setImageMeta(
|
|
104
|
+
{
|
|
105
|
+
player: playerRef,
|
|
106
|
+
width: video.videoWidth || 1920,
|
|
107
|
+
height: video.videoHeight || 1080,
|
|
108
|
+
loaded: true,
|
|
109
|
+
},
|
|
110
|
+
index,
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const handleError = () => {
|
|
115
|
+
setVideoError(true);
|
|
116
|
+
setVideoLoaded(false);
|
|
117
|
+
setImageMeta({ player: { current: null }, broken: true, loaded: true }, index);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const handleLoadStart = () => {
|
|
121
|
+
setVideoLoaded(false);
|
|
122
|
+
setVideoError(false);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
video.addEventListener('canplay', handleCanPlay, { signal });
|
|
126
|
+
video.addEventListener('error', handleError, { signal });
|
|
127
|
+
video.addEventListener('loadstart', handleLoadStart, { signal });
|
|
128
|
+
}, [setImageMeta, index]);
|
|
129
|
+
|
|
86
130
|
useEffect(() => {
|
|
87
131
|
let hls: Hls | null = null;
|
|
88
132
|
|
|
@@ -158,8 +202,12 @@ export const Video = ({ url, index, className, isActive }: Props) => {
|
|
|
158
202
|
}, [isActive, playingVideo]);
|
|
159
203
|
|
|
160
204
|
useEffect(() => {
|
|
205
|
+
const { signal } = abortController.current;
|
|
206
|
+
|
|
161
207
|
const handleSpacePress = (e: KeyboardEvent) => {
|
|
162
208
|
if ((e.key === ' ' || e.code === 'Space') && isActive) {
|
|
209
|
+
e.preventDefault();
|
|
210
|
+
e.stopPropagation();
|
|
163
211
|
if (playingVideo) {
|
|
164
212
|
setPlayingVideo(false);
|
|
165
213
|
} else {
|
|
@@ -168,11 +216,7 @@ export const Video = ({ url, index, className, isActive }: Props) => {
|
|
|
168
216
|
}
|
|
169
217
|
};
|
|
170
218
|
|
|
171
|
-
document.addEventListener('
|
|
172
|
-
|
|
173
|
-
return () => {
|
|
174
|
-
document.removeEventListener('keyup', handleSpacePress);
|
|
175
|
-
};
|
|
219
|
+
document.addEventListener('keydown', handleSpacePress, { signal });
|
|
176
220
|
}, [isActive, playingVideo, setPlayingVideo]);
|
|
177
221
|
|
|
178
222
|
const handleWrapperClick = (e: MouseEvent) => {
|
|
@@ -189,11 +233,9 @@ export const Video = ({ url, index, className, isActive }: Props) => {
|
|
|
189
233
|
setHideNavigation(true);
|
|
190
234
|
}, 3000);
|
|
191
235
|
}
|
|
192
|
-
|
|
193
|
-
|
|
236
|
+
} else {
|
|
237
|
+
setPlayingVideo(!playingVideo);
|
|
194
238
|
}
|
|
195
|
-
|
|
196
|
-
setPlayingVideo(!playingVideo);
|
|
197
239
|
};
|
|
198
240
|
|
|
199
241
|
const handleBottomButtonClick = useCallback(
|
|
@@ -230,8 +272,15 @@ export const Video = ({ url, index, className, isActive }: Props) => {
|
|
|
230
272
|
};
|
|
231
273
|
|
|
232
274
|
return (
|
|
233
|
-
|
|
234
|
-
|
|
275
|
+
<div
|
|
276
|
+
aria-hidden={true}
|
|
277
|
+
onClick={handleWrapperClick}
|
|
278
|
+
data-content-area='true'
|
|
279
|
+
className={cn(styles.videoWrapper, {
|
|
280
|
+
[styles.loading]: !videoLoaded && !videoError,
|
|
281
|
+
[styles.mobileWrapper]: isMobile,
|
|
282
|
+
})}
|
|
283
|
+
>
|
|
235
284
|
<video
|
|
236
285
|
onPlay={onPlay}
|
|
237
286
|
onPause={onPause}
|
|
@@ -244,7 +293,7 @@ export const Video = ({ url, index, className, isActive }: Props) => {
|
|
|
244
293
|
>
|
|
245
294
|
<track kind='captions' />
|
|
246
295
|
</video>
|
|
247
|
-
{isDesktop && !playingVideo && (
|
|
296
|
+
{isDesktop && !playingVideo && videoLoaded && (
|
|
248
297
|
<div className={styles.videoButton}>
|
|
249
298
|
<Circle size={64} shapeClassName={styles.iconShape}>
|
|
250
299
|
<PlayCompactMIcon className={styles.icon} />
|
|
@@ -252,7 +301,7 @@ export const Video = ({ url, index, className, isActive }: Props) => {
|
|
|
252
301
|
</div>
|
|
253
302
|
)}
|
|
254
303
|
{isDesktop && <Subtitles />}
|
|
255
|
-
{isDesktop && image?.bottomButton && (
|
|
304
|
+
{isDesktop && image?.bottomButton && videoLoaded && (
|
|
256
305
|
<BottomButton
|
|
257
306
|
bottomButton={image.bottomButton}
|
|
258
307
|
onClick={handleBottomButtonClick}
|