import React from "react";
import { Movie } from "./movie-wall";
import tmdb from "./tmdb";
export interface SidebarProps extends React.ComponentPropsWithRef<"div"> {
  movie: Movie;
  similarMoviesAvailable: boolean;
}
export function Sidebar({ movie, similarMoviesAvailable }: SidebarProps) {
  return <div id="sidebar">
    <h1>{movie?.title ?? "loading"}</h1>
    <figure>
      <a href={tmdb.makeMovieLink(movie)} target="_blank" rel="noopener noreferrer">
        <img src={tmdb.makeImgUrl(movie.poster_path ?? "")} />
      </a>
      <figcaption>
        {similarMoviesAvailable ? "" : "No hay data suficiente para darte pelílculas relacionadas."}
      </figcaption>
    </figure>
    <p>{movie.overview === null ? "Loading"
      : movie.overview === "" ? "Resumen no disponible."
        : movie.overview}
    </p>
  </div>


}
