movie-explorer/src/objects/sidebar.tsx

35 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-05-06 11:33:00 +00:00
import React from "react";
import { Movie } from "./movie-wall";
2024-05-07 16:58:39 +00:00
import tmdb from "./tmdb";
2024-05-23 13:54:06 +00:00
import { WatchProviders, WhereToWatch } from "./whereToWatch";
2024-05-19 15:17:30 +00:00
import CrossfadeImage from 'react-crossfade-image'
2024-05-22 13:05:38 +00:00
import { Config } from "../App";
2024-05-23 13:54:06 +00:00
2024-05-06 11:33:00 +00:00
export interface SidebarProps extends React.ComponentPropsWithRef<"div"> {
movie: Movie;
similarMoviesAvailable: boolean;
2024-05-23 13:54:06 +00:00
watchProviders: WatchProviders;
2024-05-22 13:05:38 +00:00
config: Config;
2024-05-06 11:33:00 +00:00
}
2024-05-22 13:05:38 +00:00
export function Sidebar({ movie, similarMoviesAvailable, watchProviders, config }: SidebarProps) {
const apology = config.language == "es" ?
"Resumen no disponible" :
config.language == "en" ?
"Summary unavailable." :
""
2024-05-08 14:50:27 +00:00
return <div id="sidebar">
2024-05-06 11:33:00 +00:00
<h1>{movie?.title ?? "loading"}</h1>
2024-05-22 08:55:28 +00:00
<a href={tmdb.makeMovieLink(movie)} target="_blank" rel="noopener noreferrer">
<CrossfadeImage src={tmdb.makeImgUrl(movie.poster_path ?? "")} containerClass="chosen-movie-poster" style={{ objectFit: "cover", height: "100%" }} />
</a>
{similarMoviesAvailable ? "" : "No hay data suficiente para darte pelílculas relacionadas."}
2024-05-18 12:49:21 +00:00
<p id="summary">{movie.overview === null ? "Loading"
2024-05-22 13:05:38 +00:00
: movie.overview === "" ? apology
: movie.overview}
</p>
2024-05-22 13:05:38 +00:00
<WhereToWatch watchProviders={watchProviders} config={config} />
2024-05-06 11:33:00 +00:00
</div>
}