ChannelGallery.tsx 882 B

1234567891011121314151617181920212223242526272829303132333435
  1. import React from 'react'
  2. import { css } from '@emotion/core'
  3. import { ChannelPreview, Gallery } from '@/shared/components'
  4. import { ChannelFields } from '@/api/queries/__generated__/ChannelFields'
  5. type ChannelGalleryProps = {
  6. title: string
  7. action?: string
  8. channels?: ChannelFields[]
  9. loading?: boolean
  10. }
  11. const ChannelGallery: React.FC<ChannelGalleryProps> = ({ title, action, channels, loading }) => {
  12. if (loading || !channels) {
  13. return <p>Loading</p>
  14. }
  15. return (
  16. <Gallery title={title} action={action}>
  17. {channels.map((channel) => (
  18. <ChannelPreview
  19. name={channel.handle}
  20. avatarURL={channel.avatarPhotoURL}
  21. views={channel.totalViews}
  22. key={channel.id}
  23. outerContainerCss={css`
  24. margin-right: 1.5rem;
  25. `}
  26. />
  27. ))}
  28. </Gallery>
  29. )
  30. }
  31. export default ChannelGallery