movie-explorer/src/objects/sidebar.tsx

39 lines
1.5 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-10-05 15:16:08 +00:00
className: string
2024-05-06 11:33:00 +00:00
}
2024-10-05 15:16:08 +00:00
export function Sidebar({ movie, similarMoviesAvailable, watchProviders, config, className }: SidebarProps) {
2024-05-22 13:05:38 +00:00
const apology = config.language == "es" ?
"Resumen no disponible" :
config.language == "en" ?
"Summary unavailable." :
""
2024-10-05 15:16:08 +00:00
return <div id="sidebar" className={className}>
2024-10-06 21:46:47 +00:00
<h1 className="font-bold text-lg my-4 h-14 overflow-hidden">{movie?.title ?? "loading"}</h1>
<a href={tmdb.makeMovieLink(movie)} target="_blank" rel="noopener noreferrer" className="w-72 aspect-poster flex justify-center">
<CrossfadeImage src={tmdb.makeImgUrl(movie.poster_path ?? "")} style={{
objectFit: "clip",
height: "100%"
}} />
2024-05-22 08:55:28 +00:00
</a>
{similarMoviesAvailable ? "" : "No hay data suficiente para darte pelílculas relacionadas."}
2024-10-06 21:46:47 +00:00
<p id="summary" className="h-44 overflow-scroll mt-4 p-2">{movie.overview === null ? "Loading"
2024-05-22 13:05:38 +00:00
: movie.overview === "" ? apology
: movie.overview}
</p>
2024-10-06 21:46:47 +00:00
<WhereToWatch watchProviders={watchProviders} config={config} className="w-full h-32 flex flex-col justify-end mb-4" />
</div >
2024-05-06 11:33:00 +00:00
}