import PropTypes from 'prop-types';
import React from 'react';
import Label from 'Components/Label';
import { kinds } from 'Helpers/Props';
import MoviePoster from 'Movie/MoviePoster';
import styles from './MovieSearchResult.css';
function MovieSearchResult(props) {
const {
match,
title,
year,
images,
alternateTitles,
tmdbId,
imdbId,
tags
} = props;
let alternateTitle = null;
let tag = null;
if (match.key === 'alternateTitles.title') {
alternateTitle = alternateTitles[match.refIndex];
} else if (match.key === 'tags.label') {
tag = tags[match.refIndex];
}
return (
{title} { year > 0 ? `(${year})` : ''}
{
alternateTitle ?
{alternateTitle.title}
:
null
}
{
match.key === 'tmdbId' && tmdbId ?
TmdbId: {tmdbId}
:
null
}
{
match.key === 'imdbId' && imdbId ?
ImdbId: {imdbId}
:
null
}
{
tag ?
:
null
}
);
}
MovieSearchResult.propTypes = {
title: PropTypes.string.isRequired,
year: PropTypes.number.isRequired,
images: PropTypes.arrayOf(PropTypes.object).isRequired,
alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired,
tmdbId: PropTypes.number,
imdbId: PropTypes.string,
tags: PropTypes.arrayOf(PropTypes.object).isRequired,
match: PropTypes.object.isRequired
};
export default MovieSearchResult;