Fix/BOOK-257 video player * fix(BOOK-257): Fixes to VideoPlayerButton and added stories * fix(BOOK-257): Hiding mute button when the user has interacted with it * fix(BOOK-257): Added support for poster image * fix(BOOK-257): add crossOrigin attr to videoplayer * fix(BOOK-257): comment Approved-by: Anton Gunnarsson
46 lines
976 B
TypeScript
46 lines
976 B
TypeScript
'use client'
|
|
|
|
import { Button as ButtonRAC } from 'react-aria-components'
|
|
import { MaterialIcon } from '../../Icons/MaterialIcon'
|
|
import { VideoPlayerButtonProps } from './types'
|
|
import { variants } from './variants'
|
|
import styles from './videoPlayerButton.module.css'
|
|
|
|
export function VideoPlayerButton({
|
|
iconName,
|
|
size,
|
|
className,
|
|
...props
|
|
}: VideoPlayerButtonProps) {
|
|
const classNames = variants({
|
|
size,
|
|
className,
|
|
})
|
|
|
|
return (
|
|
<ButtonRAC className={classNames} {...props}>
|
|
<span className={styles.transparentBackground} />
|
|
<span className={styles.iconWrapper}>
|
|
<MaterialIcon
|
|
icon={iconName}
|
|
size={getIconSize(size)}
|
|
color="CurrentColor"
|
|
isFilled
|
|
/>
|
|
</span>
|
|
</ButtonRAC>
|
|
)
|
|
}
|
|
|
|
function getIconSize(size: VideoPlayerButtonProps['size']) {
|
|
switch (size) {
|
|
case 'sm':
|
|
return 28
|
|
case 'lg':
|
|
return 40
|
|
case 'md':
|
|
default:
|
|
return 32
|
|
}
|
|
}
|