@latte-macchiat-io/latte-vanilla-components 0.0.202 → 0.0.203
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/package.json +1 -1
- package/src/components/Carousel/export.tsx +2 -4
- package/src/components/Carousel/index.tsx +159 -191
- package/src/components/Carousel/theme.ts +102 -0
- package/src/components/Columns/export.tsx +2 -5
- package/src/components/Columns/index.tsx +10 -15
- package/src/components/Columns/styles.css.ts +3 -1
- package/src/components/Columns/theme.ts +24 -0
- package/src/components/ConsentCookie/export.tsx +2 -4
- package/src/components/ConsentCookie/index.tsx +104 -0
- package/src/components/Footer/export.tsx +1 -4
- package/src/components/Footer/index.tsx +1 -8
- package/src/components/Footer/theme.ts +51 -0
- package/src/components/Form/export.tsx +17 -3
- package/src/components/Header/export.tsx +1 -4
- package/src/components/Header/index.tsx +19 -35
- package/src/components/Header/styles.css.ts +2 -2
- package/src/components/Header/theme.ts +51 -0
- package/src/components/Heading/export.tsx +1 -0
- package/src/components/Heading/index.tsx +3 -8
- package/src/components/Icon/export.tsx +1 -4
- package/src/components/Icon/index.tsx +4 -5
- package/src/components/Icon/theme.ts +17 -0
- package/src/components/KeyNumber/export.tsx +2 -4
- package/src/components/KeyNumber/index.tsx +3 -3
- package/src/components/KeyNumber/theme.ts +22 -0
- package/src/components/LanguageSwitcher/export.tsx +2 -4
- package/src/components/LanguageSwitcher/index.tsx +37 -63
- package/src/components/Logo/export.tsx +1 -4
- package/src/components/Logo/index.tsx +2 -5
- package/src/components/Logo/styles.css.ts +2 -2
- package/src/components/Main/export.tsx +1 -4
- package/src/components/Main/index.tsx +1 -9
- package/src/components/Main/theme.ts +19 -0
- package/src/components/Modal/export.tsx +2 -4
- package/src/components/Modal/index.tsx +4 -5
- package/src/components/Modal/theme.ts +31 -0
- package/src/components/Nav/export.tsx +1 -4
- package/src/components/Nav/index.tsx +6 -14
- package/src/components/Nav/styles.css.ts +3 -1
- package/src/components/Nav/theme.ts +24 -0
- package/src/components/NavLegal/export.tsx +1 -4
- package/src/components/NavLegal/index.tsx +1 -7
- package/src/components/NavLegal/theme.ts +24 -0
- package/src/components/NavSocial/export.tsx +2 -5
- package/src/components/NavSocial/index.tsx +14 -18
- package/src/components/NavSocial/theme.ts +34 -0
- package/src/components/Section/export.tsx +2 -6
- package/src/components/Section/index.tsx +4 -8
- package/src/components/Section/theme.ts +40 -0
- package/src/components/Video/export.tsx +2 -2
- package/src/components/Video/index.tsx +78 -83
- package/src/components/Video/theme.ts +104 -0
- package/src/index.ts +19 -49
- package/src/theme/baseThemeValues.ts +40 -712
- package/src/theme/contract.css.ts +0 -16
- package/src/utils/useWindowSize.ts +29 -0
- package/src/components/ConsentCookie/ConsentCookie.tsx +0 -200
- package/src/components/Header/HeaderOverlay/index.tsx +0 -32
- package/src/components/Header/HeaderOverlay/styles.css.ts +0 -33
- package/src/components/Header/ToggleNav/index.tsx +0 -29
- package/src/components/Header/ToggleNav/styles.css.ts +0 -40
- package/src/components/ThemeTest/ThemeTest.css.ts +0 -11
- package/src/components/ThemeTest/ThemeTest.tsx +0 -12
- /package/src/components/ConsentCookie/{ConsentCookie.css.ts → styles.css.ts} +0 -0
@@ -1,17 +1,9 @@
|
|
1
1
|
import { clsx } from 'clsx';
|
2
|
-
import { forwardRef } from 'react';
|
3
2
|
|
4
3
|
import { main } from './styles.css';
|
5
4
|
|
6
5
|
export type MainProps = React.HTMLAttributes<HTMLDivElement> & {
|
7
|
-
css?: string;
|
8
6
|
children: React.ReactNode;
|
9
7
|
};
|
10
8
|
|
11
|
-
export const Main =
|
12
|
-
return (
|
13
|
-
<main ref={ref} className={clsx(main, css, className)} {...htmlProps}>
|
14
|
-
{children}
|
15
|
-
</main>
|
16
|
-
);
|
17
|
-
});
|
9
|
+
export const Main = ({ className, children }: MainProps) => <main className={clsx(main, className)}>{children}</main>;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
const themeMainBase = {
|
2
|
+
main: {
|
3
|
+
minHeight: '45vh',
|
4
|
+
},
|
5
|
+
};
|
6
|
+
|
7
|
+
export const themeMainLight = {
|
8
|
+
main: {
|
9
|
+
...themeMainBase.main,
|
10
|
+
backgroundColor: '#FCEFE6',
|
11
|
+
},
|
12
|
+
};
|
13
|
+
|
14
|
+
export const themeMainDark = {
|
15
|
+
main: {
|
16
|
+
...themeMainBase.main,
|
17
|
+
backgroundColor: '#FCEFE6',
|
18
|
+
},
|
19
|
+
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { clsx } from 'clsx';
|
4
|
-
import {
|
4
|
+
import { useState } from 'react';
|
5
5
|
|
6
6
|
import { modal, modalContentCloseButton, modalContentRecipe, type ModalVariants } from './styles.css';
|
7
7
|
|
@@ -11,12 +11,11 @@ import { Icon } from '../Icon';
|
|
11
11
|
|
12
12
|
export type ModalProps = React.HTMLAttributes<HTMLDivElement> &
|
13
13
|
ModalVariants & {
|
14
|
-
css?: string;
|
15
14
|
triggerLabel: string;
|
16
15
|
children: React.ReactNode;
|
17
16
|
};
|
18
17
|
|
19
|
-
export const Modal =
|
18
|
+
export const Modal = ({ triggerLabel, className, children, align }: ModalProps) => {
|
20
19
|
const [isOpen, setIsOpen] = useState(false);
|
21
20
|
|
22
21
|
return (
|
@@ -27,7 +26,7 @@ export const Modal = forwardRef<HTMLDivElement, ModalProps>(({ triggerLabel, css
|
|
27
26
|
|
28
27
|
{isOpen && (
|
29
28
|
<div className={modal} role="dialog" aria-modal="true">
|
30
|
-
<div
|
29
|
+
<div className={clsx(modalContentRecipe({ align }), className)}>
|
31
30
|
<button type="button" className={modalContentCloseButton} onClick={() => setIsOpen(false)}>
|
32
31
|
<Icon icon="close" />
|
33
32
|
</button>
|
@@ -37,4 +36,4 @@ export const Modal = forwardRef<HTMLDivElement, ModalProps>(({ triggerLabel, css
|
|
37
36
|
)}
|
38
37
|
</>
|
39
38
|
);
|
40
|
-
}
|
39
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
const themeModalBase = {
|
2
|
+
modal: {
|
3
|
+
border: 'none',
|
4
|
+
overlayBlur: '0',
|
5
|
+
borderRadius: '30px',
|
6
|
+
|
7
|
+
closeButtonRightPosition: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
|
8
|
+
closeButtonTopPosition: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
|
9
|
+
|
10
|
+
gap: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
|
11
|
+
width: { mobile: '100%', sm: '200px', md: '600px', lg: '600px', xl: '800px', '2xl': '800px' },
|
12
|
+
paddingTop: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
|
13
|
+
paddingBottom: { mobile: '15px', sm: '15px', md: '30px', lg: '30px', xl: '50px', '2xl': '50px' },
|
14
|
+
},
|
15
|
+
};
|
16
|
+
|
17
|
+
export const themeModalLight = {
|
18
|
+
modal: {
|
19
|
+
...themeModalBase.modal,
|
20
|
+
backgroundColor: '#000000',
|
21
|
+
overlayBackgroundColor: '#000000',
|
22
|
+
},
|
23
|
+
};
|
24
|
+
|
25
|
+
export const themeModalDark = {
|
26
|
+
modal: {
|
27
|
+
...themeModalBase.modal,
|
28
|
+
backgroundColor: '#000000',
|
29
|
+
overlayBackgroundColor: '#000000',
|
30
|
+
},
|
31
|
+
};
|
@@ -1,20 +1,12 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { clsx } from 'clsx';
|
4
|
-
import { forwardRef } from 'react';
|
5
4
|
|
6
|
-
import { navRecipe } from './styles.css';
|
5
|
+
import { navRecipe, NavVariants } from './styles.css';
|
7
6
|
|
8
|
-
export type NavProps = React.HTMLAttributes<HTMLDivElement> &
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
};
|
7
|
+
export type NavProps = React.HTMLAttributes<HTMLDivElement> &
|
8
|
+
NavVariants & {
|
9
|
+
children: React.ReactNode;
|
10
|
+
};
|
13
11
|
|
14
|
-
export const Nav =
|
15
|
-
return (
|
16
|
-
<div ref={ref} className={clsx(navRecipe({ direction }), css, className)}>
|
17
|
-
{children}
|
18
|
-
</div>
|
19
|
-
);
|
20
|
-
});
|
12
|
+
export const Nav = ({ children, className, direction }: NavProps) => <div className={clsx(navRecipe({ direction }), className)}>{children}</div>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { recipe } from '@vanilla-extract/recipes';
|
1
|
+
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
2
2
|
|
3
3
|
import { themeContract } from '../../theme/contract.css';
|
4
4
|
import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
|
@@ -28,3 +28,5 @@ export const navRecipe = recipe({
|
|
28
28
|
direction: 'column',
|
29
29
|
},
|
30
30
|
});
|
31
|
+
|
32
|
+
export type NavVariants = RecipeVariants<typeof navRecipe>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
const themeNavBase = {
|
2
|
+
nav: {
|
3
|
+
gap: {
|
4
|
+
mobile: '5px',
|
5
|
+
sm: '5px',
|
6
|
+
md: '10px',
|
7
|
+
lg: '10px',
|
8
|
+
xl: '15px',
|
9
|
+
'2xl': '15px',
|
10
|
+
},
|
11
|
+
},
|
12
|
+
};
|
13
|
+
|
14
|
+
export const themeNavLight = {
|
15
|
+
nav: {
|
16
|
+
...themeNavBase.nav,
|
17
|
+
},
|
18
|
+
};
|
19
|
+
|
20
|
+
export const themeNavDark = {
|
21
|
+
nav: {
|
22
|
+
...themeNavBase.nav,
|
23
|
+
},
|
24
|
+
};
|
@@ -1,15 +1,9 @@
|
|
1
1
|
import { clsx } from 'clsx';
|
2
|
-
import { forwardRef } from 'react';
|
3
2
|
|
4
3
|
import { navLegalRecipe } from './styles.css';
|
5
4
|
|
6
5
|
export type NavLegalProps = React.HTMLAttributes<HTMLDivElement> & {
|
7
|
-
css?: string;
|
8
6
|
children: React.ReactNode;
|
9
7
|
};
|
10
8
|
|
11
|
-
export const NavLegal =
|
12
|
-
<div ref={ref} className={clsx(navLegalRecipe(), css, className)}>
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
));
|
9
|
+
export const NavLegal = ({ className, children }: NavLegalProps) => <div className={clsx(navLegalRecipe(), className)}>{children}</div>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
const themeNavLegalBase = {
|
2
|
+
navLegal: {
|
3
|
+
gap: {
|
4
|
+
mobile: '5px',
|
5
|
+
sm: '5px',
|
6
|
+
md: '10px',
|
7
|
+
lg: '10px',
|
8
|
+
xl: '15px',
|
9
|
+
'2xl': '15px',
|
10
|
+
},
|
11
|
+
},
|
12
|
+
};
|
13
|
+
|
14
|
+
export const themeNavLegalLight = {
|
15
|
+
navLegal: {
|
16
|
+
...themeNavLegalBase.navLegal,
|
17
|
+
},
|
18
|
+
};
|
19
|
+
|
20
|
+
export const themeNavLegalDark = {
|
21
|
+
navLegal: {
|
22
|
+
...themeNavLegalBase.navLegal,
|
23
|
+
},
|
24
|
+
};
|
@@ -1,5 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
// export type { Social as SocialType } from './types';
|
5
|
-
// export { styles as NavSocialStyles } from './styles.css';
|
1
|
+
export { NavSocial, type NavSocialProps } from './';
|
2
|
+
export { type Social } from './types';
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { clsx } from 'clsx';
|
2
|
-
import { forwardRef } from 'react';
|
3
2
|
|
4
3
|
import { navSocialLink, navSocialRecipe } from './styles.css';
|
5
4
|
import { Social } from './types';
|
@@ -8,23 +7,20 @@ import icons from '../Icon/path';
|
|
8
7
|
|
9
8
|
export type NavSocialProps = React.HTMLAttributes<HTMLDivElement> & {
|
10
9
|
navSocial: { name: Social; link: string }[];
|
11
|
-
css?: string;
|
12
10
|
};
|
13
11
|
|
14
|
-
export const NavSocial =
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
const capitalized = name[0].toUpperCase() + name.slice(1);
|
12
|
+
export const NavSocial = ({ navSocial, className }: NavSocialProps) => (
|
13
|
+
<div className={clsx(navSocialRecipe(), className)}>
|
14
|
+
{navSocial?.map(({ name, link }, index) => {
|
15
|
+
const capitalized = name[0].toUpperCase() + name.slice(1);
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
});
|
17
|
+
return (
|
18
|
+
<div key={`navSocialItem-${index}`} className={navSocialLink}>
|
19
|
+
<a target="_blank" rel="noopener noreferrer" aria-label={name} href={link}>
|
20
|
+
<Icon icon={`social${capitalized}` as keyof typeof icons} />
|
21
|
+
</a>
|
22
|
+
</div>
|
23
|
+
);
|
24
|
+
})}
|
25
|
+
</div>
|
26
|
+
);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
const themeNavSocialBase = {
|
2
|
+
navSocial: {
|
3
|
+
transition: 'all 0.5s ease-in-out',
|
4
|
+
|
5
|
+
gap: {
|
6
|
+
mobile: '5px',
|
7
|
+
sm: '5px',
|
8
|
+
md: '10px',
|
9
|
+
lg: '10px',
|
10
|
+
xl: '15px',
|
11
|
+
'2xl': '15px',
|
12
|
+
},
|
13
|
+
},
|
14
|
+
};
|
15
|
+
|
16
|
+
export const themeNavSocialLight = {
|
17
|
+
navSocial: {
|
18
|
+
...themeNavSocialBase.navSocial,
|
19
|
+
colors: {
|
20
|
+
defaultIcon: '#FF7377',
|
21
|
+
defaultIconHover: '#000000',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
};
|
25
|
+
|
26
|
+
export const themeNavSocialDark = {
|
27
|
+
navSocial: {
|
28
|
+
...themeNavSocialBase.navSocial,
|
29
|
+
colors: {
|
30
|
+
defaultIcon: '#FF7377',
|
31
|
+
defaultIconHover: '#000000',
|
32
|
+
},
|
33
|
+
},
|
34
|
+
};
|
@@ -1,6 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
// export { Align as SectionAlign } from './types';
|
4
|
-
|
5
|
-
// export * as allStyles from './styles.css';
|
6
|
-
// export { styles as SectionStyles } from './styles.css';
|
1
|
+
export { Section, type SectionProps } from './';
|
2
|
+
export { type SectionVariants } from './styles.css';
|
@@ -1,18 +1,14 @@
|
|
1
1
|
import { clsx } from 'clsx';
|
2
|
-
import { forwardRef } from 'react';
|
3
2
|
|
4
3
|
import { sectionContent, sectionRecipe, type SectionVariants } from './styles.css';
|
5
4
|
|
6
5
|
export type SectionProps = React.HTMLAttributes<HTMLDivElement> &
|
7
6
|
SectionVariants & {
|
8
|
-
css?: string;
|
9
7
|
children: React.ReactNode;
|
10
8
|
};
|
11
9
|
|
12
|
-
export const Section =
|
13
|
-
({ align, isDark, isFullHeight, withPaddingTop, withPaddingBottom
|
14
|
-
<
|
15
|
-
|
16
|
-
</section>
|
17
|
-
)
|
10
|
+
export const Section = ({ align, isDark, isFullHeight, withPaddingTop, withPaddingBottom, className, children }: SectionProps) => (
|
11
|
+
<section className={clsx(sectionRecipe({ align, isDark, isFullHeight, withPaddingTop, withPaddingBottom }), className)}>
|
12
|
+
<div className={sectionContent}>{children}</div>
|
13
|
+
</section>
|
18
14
|
);
|
@@ -0,0 +1,40 @@
|
|
1
|
+
const themeSectionBase = {
|
2
|
+
section: {
|
3
|
+
gap: {
|
4
|
+
mobile: '15px',
|
5
|
+
sm: '15px',
|
6
|
+
md: '30px',
|
7
|
+
lg: '30px',
|
8
|
+
xl: '50px',
|
9
|
+
'2xl': '50px',
|
10
|
+
},
|
11
|
+
paddingTop: {
|
12
|
+
mobile: '15px',
|
13
|
+
sm: '15px',
|
14
|
+
md: '30px',
|
15
|
+
lg: '30px',
|
16
|
+
xl: '50px',
|
17
|
+
'2xl': '50px',
|
18
|
+
},
|
19
|
+
paddingBottom: {
|
20
|
+
mobile: '15px',
|
21
|
+
sm: '15px',
|
22
|
+
md: '30px',
|
23
|
+
lg: '30px',
|
24
|
+
xl: '50px',
|
25
|
+
'2xl': '50px',
|
26
|
+
},
|
27
|
+
},
|
28
|
+
};
|
29
|
+
|
30
|
+
export const themeSectionLight = {
|
31
|
+
section: {
|
32
|
+
...themeSectionBase.section,
|
33
|
+
},
|
34
|
+
};
|
35
|
+
|
36
|
+
export const themeSectionDark = {
|
37
|
+
section: {
|
38
|
+
...themeSectionBase.section,
|
39
|
+
},
|
40
|
+
};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
export { Video, type VideoProps } from './';
|
2
|
+
export { type VideoVariants } from './styles.css';
|
@@ -1,7 +1,8 @@
|
|
1
1
|
'use client';
|
2
2
|
|
3
3
|
import { clsx } from 'clsx';
|
4
|
-
import {
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
5
|
+
|
5
6
|
import {
|
6
7
|
closeButton,
|
7
8
|
pauseButton,
|
@@ -29,85 +30,79 @@ export type VideoProps = React.HTMLAttributes<HTMLDivElement> &
|
|
29
30
|
onEnded?: () => void;
|
30
31
|
};
|
31
32
|
|
32
|
-
export const Video =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
) => {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<
|
90
|
-
<
|
91
|
-
</
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<button className={soundButton} onClick={toggleMutedVideo} aria-label={isMuted ? 'Unmute video' : 'Mute video'} type="button" />
|
109
|
-
)}
|
110
|
-
</div>
|
111
|
-
);
|
112
|
-
}
|
113
|
-
);
|
33
|
+
export const Video = ({
|
34
|
+
video,
|
35
|
+
poster,
|
36
|
+
isAutoPlay = false,
|
37
|
+
startMuted = false,
|
38
|
+
showControls = false,
|
39
|
+
hidePlayButton = false,
|
40
|
+
isPlayingFullScreen = false,
|
41
|
+
onPlay,
|
42
|
+
onClose,
|
43
|
+
onEnded,
|
44
|
+
size,
|
45
|
+
className,
|
46
|
+
}: VideoProps) => {
|
47
|
+
const videoRef = useRef<HTMLVideoElement>(null);
|
48
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
49
|
+
const [isMuted, setIsMuted] = useState(isAutoPlay || startMuted);
|
50
|
+
|
51
|
+
const playVideo = () => {
|
52
|
+
onPlay?.();
|
53
|
+
videoRef.current?.play();
|
54
|
+
setIsPlaying(true);
|
55
|
+
};
|
56
|
+
|
57
|
+
const closeVideo = () => {
|
58
|
+
onClose?.();
|
59
|
+
videoRef.current?.pause();
|
60
|
+
setIsPlaying(false);
|
61
|
+
};
|
62
|
+
|
63
|
+
const pauseVideo = () => {
|
64
|
+
videoRef.current?.pause();
|
65
|
+
setIsPlaying(false);
|
66
|
+
};
|
67
|
+
|
68
|
+
const toggleMutedVideo = () => {
|
69
|
+
const newIsMuted = !isMuted;
|
70
|
+
setIsMuted(newIsMuted);
|
71
|
+
if (videoRef.current) videoRef.current.muted = newIsMuted;
|
72
|
+
};
|
73
|
+
|
74
|
+
const handleVideoEnded = () => {
|
75
|
+
onEnded?.();
|
76
|
+
closeVideo();
|
77
|
+
};
|
78
|
+
|
79
|
+
useEffect(() => {
|
80
|
+
if (videoRef.current) videoRef.current.muted = isMuted;
|
81
|
+
}, [isMuted]);
|
82
|
+
|
83
|
+
return (
|
84
|
+
<div className={clsx(videoRecipe({ size }), className)}>
|
85
|
+
<video ref={videoRef} className={videoElement} playsInline muted={isMuted} autoPlay={isAutoPlay} onEnded={handleVideoEnded}>
|
86
|
+
<source src={video} type="video/mp4" />
|
87
|
+
</video>
|
88
|
+
|
89
|
+
{poster && (
|
90
|
+
<div className={videoPoster} data-playing={isPlaying}>
|
91
|
+
<img src={poster} alt="Video poster" className={posterImage} />
|
92
|
+
</div>
|
93
|
+
)}
|
94
|
+
|
95
|
+
{!hidePlayButton && !isAutoPlay && (
|
96
|
+
<button className={playButton} data-playing={isPlaying} onClick={playVideo} aria-label="Play video" type="button" />
|
97
|
+
)}
|
98
|
+
|
99
|
+
{isPlayingFullScreen && <button className={closeButton} onClick={closeVideo} aria-label="Close video" type="button" />}
|
100
|
+
|
101
|
+
{isPlaying && showControls && <button className={pauseButton} onClick={pauseVideo} aria-label="Pause video" type="button" />}
|
102
|
+
|
103
|
+
{showControls && (
|
104
|
+
<button className={soundButton} onClick={toggleMutedVideo} aria-label={isMuted ? 'Unmute video' : 'Mute video'} type="button" />
|
105
|
+
)}
|
106
|
+
</div>
|
107
|
+
);
|
108
|
+
};
|