import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { icons, kinds, sizes } from 'Helpers/Props'; import HeartRating from 'Components/HeartRating'; import Icon from 'Components/Icon'; import Label from 'Components/Label'; import Link from 'Components/Link/Link'; import MoviePoster from 'Movie/MoviePoster'; import AddNewMovieModal from './AddNewMovieModal'; import styles from './AddNewMovieSearchResult.css'; class AddNewMovieSearchResult extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isNewAddMovieModalOpen: false }; } componentDidUpdate(prevProps) { if (!prevProps.isExistingMovie && this.props.isExistingMovie) { this.onAddSerisModalClose(); } } // // Listeners onPress = () => { this.setState({ isNewAddMovieModalOpen: true }); } onAddSerisModalClose = () => { this.setState({ isNewAddMovieModalOpen: false }); } // // Render render() { const { tmdbId, title, titleSlug, year, studio, status, overview, ratings, images, isExistingMovie, isSmallScreen } = this.props; const { isNewAddMovieModalOpen } = this.state; const linkProps = isExistingMovie ? { to: `/movie/${titleSlug}` } : { onPress: this.onPress }; return (