VideoPlayer.style.tsx 652 B

123456789101112131415161718192021222324252627282930313233
  1. import { css } from '@emotion/core'
  2. import { breakpoints } from '../../theme'
  3. export type VideoPlayerStyleProps = {
  4. width?: string | number
  5. height?: string | number
  6. responsive?: boolean
  7. ratio?: string
  8. }
  9. export let makeStyles = ({
  10. width = '100%',
  11. height = '100%',
  12. responsive = true,
  13. ratio = '16:9',
  14. }: VideoPlayerStyleProps) => {
  15. let ratioPerc = ratio
  16. .split(':')
  17. .map((x) => Number(x))
  18. .reduce((x, y) => (y / x) * 100)
  19. return {
  20. containerStyles: css`
  21. max-width: ${breakpoints.medium};
  22. & .video-player {
  23. }
  24. `,
  25. playerStyles: css`
  26. width: ${width};
  27. height: ${height};
  28. `,
  29. }
  30. }