frontend/src/components/VideoItem.js

26 lines
724 B
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { getThumbnail } from '../utils/video';
class VideoItem extends React.Component {
render() {
2018-12-08 00:01:09 +02:00
const videoLink = `/videos/${this.props.id}`;
return (
2018-12-08 00:01:09 +02:00
<Link to={ videoLink }>
<section className="video-item">
<section className="video-thumbnail-container">
<img className="video-thumbnail" src={ getThumbnail(this.props.id) } alt=""/>
</section>
<h3 className="video-title">{ this.props.title }</h3>
</section>
2018-12-08 00:01:09 +02:00
</Link>
)
}
}
VideoItem.propTypes = {
id: PropTypes.string,
title: PropTypes.string,
}
export default (VideoItem);