VideoBestMatch.tsx 997 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react'
  2. import { VideoFields } from '@/api/queries/__generated__/VideoFields'
  3. import { formatVideoViewsAndDate } from '@/utils/video'
  4. import {
  5. Container,
  6. Content,
  7. InnerContainer,
  8. Poster,
  9. PosterContainer,
  10. Title,
  11. TitleContainer,
  12. } from './VideoBestMatch.style'
  13. type BestVideoMatchProps = {
  14. video: VideoFields
  15. onClick: (e: React.MouseEvent<HTMLImageElement>) => void
  16. }
  17. const BestVideoMatch: React.FC<BestVideoMatchProps> = ({
  18. video: { thumbnailURL, title, views, publishedOnJoystreamAt },
  19. onClick,
  20. }) => (
  21. <Container>
  22. <h3>Best Match</h3>
  23. <Content>
  24. <PosterContainer>
  25. <Poster src={thumbnailURL} onClick={onClick} />
  26. </PosterContainer>
  27. <InnerContainer>
  28. <TitleContainer>
  29. <Title>{title}</Title>
  30. <span>{formatVideoViewsAndDate(views, publishedOnJoystreamAt, { fullViews: true })}</span>
  31. </TitleContainer>
  32. </InnerContainer>
  33. </Content>
  34. </Container>
  35. )
  36. export default BestVideoMatch