import PropTypes from 'prop-types'; import React from 'react'; import Label from 'Components/Label'; import { kinds } from 'Helpers/Props'; import SeriesPoster from 'Series/SeriesPoster'; import styles from './SeriesSearchResult.css'; function SeriesSearchResult(props) { const { match, title, images, alternateTitles, tvdbId, tvMazeId, imdbId, tmdbId, tags } = props; let alternateTitle = null; let tag = null; if (match.key === 'alternateTitles.title') { alternateTitle = alternateTitles[match.arrayIndex]; } else if (match.key === 'tags.label') { tag = tags[match.arrayIndex]; } return (
{title}
{ alternateTitle ?
{alternateTitle.title}
: null } { match.key === 'tvdbId' && tvdbId ?
TvdbId: {tvdbId}
: null } { match.key === 'tvMazeId' && tvMazeId ?
TvMazeId: {tvMazeId}
: null } { match.key === 'imdbId' && imdbId ?
ImdbId: {imdbId}
: null } { match.key === 'tmdbId' && tmdbId ?
TmdbId: {tmdbId}
: null } { tag ?
: null }
); } SeriesSearchResult.propTypes = { title: PropTypes.string.isRequired, images: PropTypes.arrayOf(PropTypes.object).isRequired, alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired, tvdbId: PropTypes.number, tvMazeId: PropTypes.number, imdbId: PropTypes.string, tmdbId: PropTypes.number, tags: PropTypes.arrayOf(PropTypes.object).isRequired, match: PropTypes.object.isRequired }; export default SeriesSearchResult;