Skip to content

Instantly share code, notes, and snippets.

@koss-lebedev
Created July 6, 2022 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koss-lebedev/df163d6d1f6efd2afd4d82e27b2531f6 to your computer and use it in GitHub Desktop.
Save koss-lebedev/df163d6d1f6efd2afd4d82e27b2531f6 to your computer and use it in GitHub Desktop.
type Props = {
items: Array<Video | LiveStream>
}
const VideoList = ({ items }) => {
return (
<ul>
{items.map(item => {
if ('coverUrl' in item) {
// it's a video
return <Thumbnail coverUrl={item.coverUrl} />
} else {
// it's a live stream
return <Thumbnail coverUrl={item.previewUrl} />
}
})}
</ul>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment