VideoPreview.styles.tsx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import styled from '@emotion/styled'
  2. import { colors, spacing, typography } from '../../theme'
  3. import Avatar from '../Avatar'
  4. import { Play } from '../../icons'
  5. const HOVER_BORDER_SIZE = '2px'
  6. type CoverImageProps = {
  7. displayPosterPlaceholder?: boolean
  8. }
  9. type ContainerProps = {
  10. clickable: boolean
  11. }
  12. type ChannelProps = {
  13. channelClickable: boolean
  14. }
  15. export const CoverContainer = styled.div`
  16. width: 320px;
  17. height: 190px;
  18. transition-property: box-shadow, transform;
  19. transition-duration: 0.4s;
  20. transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);
  21. position: relative;
  22. `
  23. export const CoverImage = styled.img<CoverImageProps>`
  24. width: 100%;
  25. height: 100%;
  26. background-image: ${({ displayPosterPlaceholder }) =>
  27. displayPosterPlaceholder ? `linear-gradient(${colors.gray[300]}, ${colors.gray[700]})` : 'none'};
  28. background-size: cover;
  29. object-fit: cover;
  30. `
  31. export const CoverHoverOverlay = styled.div`
  32. position: absolute;
  33. top: 0;
  34. right: 0;
  35. bottom: 0;
  36. left: 0;
  37. opacity: 0;
  38. transition: opacity 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  39. border: ${HOVER_BORDER_SIZE} solid ${colors.white};
  40. background: linear-gradient(180deg, #000000 0%, rgba(0, 0, 0, 0) 100%);
  41. display: flex;
  42. justify-content: center;
  43. align-items: center;
  44. `
  45. // Play icon is incorrectly typed as string
  46. export const CoverPlayIcon = styled(Play as any)`
  47. transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  48. transform: translateY(40px);
  49. `
  50. export const ProgressOverlay = styled.div`
  51. position: absolute;
  52. left: 0;
  53. right: 0;
  54. bottom: 0;
  55. height: ${spacing.xxs};
  56. background-color: ${colors.white};
  57. `
  58. export const ProgressBar = styled.div`
  59. position: absolute;
  60. left: 0;
  61. bottom: 0;
  62. height: 100%;
  63. width: 0;
  64. background-color: ${colors.blue['500']};
  65. `
  66. export const Container = styled.div<ContainerProps>`
  67. color: ${colors.gray[300]};
  68. cursor: ${({ clickable }) => (clickable ? 'pointer' : 'auto')};
  69. display: inline-block;
  70. ${({ clickable }) =>
  71. clickable &&
  72. `
  73. &:hover {
  74. ${CoverContainer} {
  75. transform: translate(-${spacing.xs}, -${spacing.xs});
  76. box-shadow: ${spacing.xs} ${spacing.xs} 0 ${colors.blue['500']};
  77. }
  78. ${CoverHoverOverlay} {
  79. opacity: 1;
  80. }
  81. ${CoverPlayIcon} {
  82. transform: translateY(0);
  83. }
  84. ${ProgressOverlay} {
  85. bottom: ${HOVER_BORDER_SIZE};
  86. }
  87. }
  88. `}
  89. `
  90. export const CoverDurationOverlay = styled.div`
  91. position: absolute;
  92. bottom: ${spacing.xs};
  93. right: ${spacing.xs};
  94. padding: ${spacing.xxs} ${spacing.xs};
  95. background-color: ${colors.black};
  96. color: ${colors.white};
  97. font-size: ${typography.sizes.body2};
  98. `
  99. export const InfoContainer = styled.div`
  100. display: flex;
  101. margin-top: ${spacing.s};
  102. `
  103. export const StyledAvatar = styled(Avatar)<ChannelProps>`
  104. width: 40px;
  105. height: 40px;
  106. margin-right: ${spacing.xs};
  107. cursor: ${({ channelClickable }) => (channelClickable ? 'pointer' : 'auto')};
  108. `
  109. export const TextContainer = styled.div`
  110. display: flex;
  111. flex-direction: column;
  112. align-items: start;
  113. `
  114. export const TitleHeader = styled.h3`
  115. margin: 0;
  116. font-weight: ${typography.weights.bold};
  117. font-size: ${typography.sizes.h6};
  118. line-height: 1.25rem;
  119. color: ${colors.white};
  120. display: inline-block;
  121. `
  122. export const ChannelName = styled.span<ChannelProps>`
  123. font-size: ${typography.sizes.subtitle2};
  124. line-height: 1.25rem;
  125. display: inline-block;
  126. cursor: ${({ channelClickable }) => (channelClickable ? 'pointer' : 'auto')};
  127. `
  128. export const MetaText = styled.span`
  129. margin-top: ${spacing.xs};
  130. font-size: ${typography.sizes.subtitle2};
  131. `