import PropTypes from 'prop-types'; import React from 'react'; import Label from 'Components/Label'; import { kinds } from 'Helpers/Props'; import styles from './IndexerSearchResult.css'; function IndexerSearchResult(props) { const { match, title, year, alternateTitles, 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 } { tag ?
: null }
); } IndexerSearchResult.propTypes = { title: PropTypes.string.isRequired, year: PropTypes.number.isRequired, alternateTitles: PropTypes.arrayOf(PropTypes.object).isRequired, tags: PropTypes.arrayOf(PropTypes.object).isRequired, match: PropTypes.object.isRequired }; export default IndexerSearchResult;