Overview
PeliculaCard is a presentation component that renders a single movie as a card with poster image, title, year, duration, rating, and a link to the detail page. It includes an overlay button to open the trailer modal.
Import
Props
Movie object containing all movie dataRequired properties:
id(number): Unique movie identifiertitle(string): Movie titleyear(number): Release yearduration(number): Runtime in minutesrating(number): Rating score (0-10)image(string): URL to poster imagetrailerUrl(string): YouTube embed URL for trailer
Component Signature
Internal State
Controls visibility of the
TrailerModal componentTracks whether the poster image failed to load (triggers fallback image)
Features
Image Error Handling
If the poster image fails to load, a fallback placeholder image is displayed:Trailer Modal Integration
Clicking the “Ver Tráiler” button opens aTrailerModal component:
Navigation to Detail Page
Uses React Router’sLink component to navigate to the movie detail page:
Usage Example
Rendered Structure
Dependencies
react- useState hookreact-router-dom- Link component for navigationTrailerModal- Modal component for displaying trailers
Source Location
src/components/PeliculaCard.jsx:5