@latte-macchiat-io/latte-vanilla-components 0.0.224 → 0.0.226
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
CHANGED
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
videoRecipe,
|
15
15
|
type VideoVariants,
|
16
16
|
} from './styles.css';
|
17
|
+
import { themeContract } from '../../theme/contract.css';
|
17
18
|
import { Icon } from '../Icon';
|
18
19
|
|
19
20
|
export type VideoProps = React.HTMLAttributes<HTMLDivElement> &
|
@@ -94,25 +95,29 @@ export const Video = ({
|
|
94
95
|
|
95
96
|
{!hidePlayButton && !isAutoPlay && (
|
96
97
|
<button className={playButton} data-playing={isPlaying} onClick={playVideo} aria-label="Play video" type="button">
|
97
|
-
<Icon icon="play" />
|
98
|
+
<Icon icon="play" color={themeContract.video.playButton.iconColor} />
|
98
99
|
</button>
|
99
100
|
)}
|
100
101
|
|
101
102
|
{isPlayingFullScreen && (
|
102
103
|
<button className={closeButton} onClick={closeVideo} aria-label="Close video" type="button">
|
103
|
-
<Icon icon="close" />
|
104
|
+
<Icon icon="close" color={themeContract.video.closeButton.iconColor} />
|
104
105
|
</button>
|
105
106
|
)}
|
106
107
|
|
107
108
|
{isPlaying && showControls && (
|
108
109
|
<button className={pauseButton} onClick={pauseVideo} aria-label="Pause video" type="button">
|
109
|
-
<Icon icon="pause" />
|
110
|
+
<Icon icon="pause" color={themeContract.video.pauseButton.iconColor} />
|
110
111
|
</button>
|
111
112
|
)}
|
112
113
|
|
113
114
|
{showControls && (
|
114
115
|
<button className={soundButton} onClick={toggleMutedVideo} aria-label={isMuted ? 'Unmute video' : 'Mute video'} type="button">
|
115
|
-
{isMuted ?
|
116
|
+
{isMuted ? (
|
117
|
+
<Icon icon="volumeUp" color={themeContract.video.soundButton.iconColor} />
|
118
|
+
) : (
|
119
|
+
<Icon icon="volumeMute" color={themeContract.video.soundButton.iconColor} />
|
120
|
+
)}
|
116
121
|
</button>
|
117
122
|
)}
|
118
123
|
</div>
|
@@ -4,6 +4,7 @@ import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
|
4
4
|
|
5
5
|
import { queries } from '../../styles/mediaqueries';
|
6
6
|
import { themeContract } from '../../theme/contract.css';
|
7
|
+
import { addPixelsToBreakpoints } from '../../utils/addPixelsToBreakpoints';
|
7
8
|
import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
|
8
9
|
|
9
10
|
export const videoRecipe = recipe({
|
@@ -162,8 +163,6 @@ export const closeButton = style([
|
|
162
163
|
export const pauseButton = style([
|
163
164
|
controlButton,
|
164
165
|
{
|
165
|
-
right: '80px',
|
166
|
-
|
167
166
|
bottom: themeContract.space.md,
|
168
167
|
border: themeContract.video.pauseButton.border,
|
169
168
|
color: themeContract.video.pauseButton.iconColor,
|
@@ -174,6 +173,7 @@ export const pauseButton = style([
|
|
174
173
|
...generateResponsiveMedia({
|
175
174
|
width: themeContract.video.pauseButton.width,
|
176
175
|
height: themeContract.video.pauseButton.height,
|
176
|
+
right: addPixelsToBreakpoints(themeContract.video.pauseButton.width, 20),
|
177
177
|
}),
|
178
178
|
},
|
179
179
|
},
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { Breakpoints } from '../styles/mediaqueries';
|
2
|
+
|
3
|
+
export function addPixelsToBreakpoints(map: Record<Breakpoints, string>, pixels: number) {
|
4
|
+
return Object.fromEntries(Object.entries(map).map(([bp, value]) => [bp, `calc(${value} + ${pixels}px)`])) as Record<Breakpoints, string>;
|
5
|
+
}
|