solidify styling
Gitea/movie-explorer/pipeline/head There was a failure building this commit Details

This commit is contained in:
andrzej 2024-10-06 23:46:47 +02:00
parent 2fb34e23b0
commit 206b9cdda5
6 changed files with 57 additions and 42 deletions

View File

@ -61,9 +61,10 @@ function App() {
tmdb.getSimilar(config, chosenMovie, setMoviesHandler, setSimilarMoviesAvailable) tmdb.getSimilar(config, chosenMovie, setMoviesHandler, setSimilarMoviesAvailable)
}, [config]) }, [config])
const crossfadeImageStyles = { const crossfadeImageStyles = {
width: "2560px", width: "100vw",
minHeight: "100%", height: "100vh",
aspectRatio: "16/9" aspectRatio: "16/9",
objectFit: "clip"
} }
const { width } = useWindowDimensions() const { width } = useWindowDimensions()
@ -84,13 +85,16 @@ function App() {
return ( return (
<> <>
<div id="background" className="-z-10 absolute">
<div className="w-screen h-screen flex flex-col absolute overflow-hidden">
<div className="-z-10 absolute h-full blur-xl">
<CrossfadeImage src={backdrop} style={crossfadeImageStyles} /> <CrossfadeImage src={backdrop} style={crossfadeImageStyles} />
</div> </div>
<header className="bg-black py-2">
<HamburgerMenu setConfig={setConfig} /> <HamburgerMenu setConfig={setConfig} />
<main className="flex justify-center items-center gap-8"> </header>
WIDTH: {width} <main className="flex flex-col sm:flex-row justify-center items-center gap-8 grow">
<Sidebar className="flex flex-col max-w-sm" movie={chosenMovie} similarMoviesAvailable={similarMoviesAvailable} watchProviders={watchProviders} config={config} /> <Sidebar className="flex flex-col justify-between items-center max-w-sm bg-black/80 text-white w-96 h-full" movie={chosenMovie} similarMoviesAvailable={similarMoviesAvailable} watchProviders={watchProviders} config={config} />
<MovieWall <MovieWall
className="flex flex-wrap gap-2 max-w-5xl justify-center" className="flex flex-wrap gap-2 max-w-5xl justify-center"
movies={movies} movies={movies}
@ -100,6 +104,8 @@ function App() {
setSimilarMoviesAvailable={setSimilarMoviesAvailable} setSimilarMoviesAvailable={setSimilarMoviesAvailable}
/> />
</main> </main>
<footer className="bg-black min-h-10"></footer>
</div>
</> </>
) )
} }

View File

@ -3,7 +3,7 @@ export interface HamburgerMenuProps extends React.ComponentPropsWithRef<"div"> {
setConfig: Function; setConfig: Function;
} }
export function HamburgerMenu({ setConfig }: HamburgerMenuProps) { export function HamburgerMenu({ setConfig, className }: HamburgerMenuProps) {
const languages = [ const languages = [
{ {
value: "es", value: "es",
@ -41,7 +41,7 @@ export function HamburgerMenu({ setConfig }: HamburgerMenuProps) {
// } // }
// }) // })
// } // }
return <div id="hamburger"> return <div id="hamburger" className={className}>
<select onChange={handleLangChange}> <select onChange={handleLangChange}>
{languages.map((language) => <option value={language.value} key={language.value}>{language.label}</option>)} {languages.map((language) => <option value={language.value} key={language.value}>{language.label}</option>)}
</select> </select>

View File

@ -45,7 +45,7 @@ export function MovieWall({ movies, setMovies, config, setChosenMovie, setSimila
const movie = movies[i] const movie = movies[i]
const isHighlighted = movie.vote_average ? movie.vote_average > 6 : false const isHighlighted = movie.vote_average ? movie.vote_average > 6 : false
posters.push( posters.push(
<Poster className="w-36 h-58 rounded-xl overflow-hidden flex justify-center relative" isHighlighted={isHighlighted} movie={movie} key={movie.id} index={i} <Poster className=" w-24 sm:w-36 aspect-poster rounded-xl overflow-hidden flex justify-center relative" isHighlighted={isHighlighted} movie={movie} key={movie.id} index={i}
listSimilar={tmdb.getSimilar} listSimilar={tmdb.getSimilar}
config={config} config={config}
setMovies={setMovies} setMovies={setMovies}

View File

@ -19,17 +19,20 @@ export function Sidebar({ movie, similarMoviesAvailable, watchProviders, config,
"Summary unavailable." : "Summary unavailable." :
"" ""
return <div id="sidebar" className={className}> return <div id="sidebar" className={className}>
<h1>{movie?.title ?? "loading"}</h1> <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"> <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 ?? "")} containerClass="chosen-movie-poster" style={{ objectFit: "cover", height: "100%" }} /> <CrossfadeImage src={tmdb.makeImgUrl(movie.poster_path ?? "")} style={{
objectFit: "clip",
height: "100%"
}} />
</a> </a>
{similarMoviesAvailable ? "" : "No hay data suficiente para darte pelílculas relacionadas."} {similarMoviesAvailable ? "" : "No hay data suficiente para darte pelílculas relacionadas."}
<p id="summary" className="">{movie.overview === null ? "Loading" <p id="summary" className="h-44 overflow-scroll mt-4 p-2">{movie.overview === null ? "Loading"
: movie.overview === "" ? apology : movie.overview === "" ? apology
: movie.overview} : movie.overview}
</p> </p>
<WhereToWatch watchProviders={watchProviders} config={config} /> <WhereToWatch watchProviders={watchProviders} config={config} className="w-full h-32 flex flex-col justify-end mb-4" />
</div> </div >
} }

View File

@ -63,12 +63,12 @@ interface ProviderIconsProps extends React.ComponentPropsWithRef<"div"> {
} }
function ProviderIcons({ providerList, link }: ProviderIconsProps) { function ProviderIcons({ providerList, link }: ProviderIconsProps) {
const list = providerList.map((e: any, i: number) => { const list = providerList.map((e: any, i: number) => {
return <div className="watch-logo"> return <div className="w-6 aspect-square">
<a href={link}> <a href={link}>
<img src={tmdb.makeLogoPath(e.logo_path)} key={e.provider_id + "_" + i} /></a> <img src={tmdb.makeLogoPath(e.logo_path)} key={e.provider_id + "_" + i} /></a>
</div> </div>
}) })
return <div className="watch-logos-container"> return <div id="logos-container" className="w-full flex">
{list} {list}
</div> </div>
} }
@ -76,17 +76,19 @@ function watchProvidersExist(watchProviders: any) {
return watchProviders?.link return watchProviders?.link
} }
export function WhereToWatch({ watchProviders, config }: WhereToWatchProps) { export function WhereToWatch({ watchProviders, config, className }: WhereToWatchProps) {
if (!watchProvidersExist(watchProviders)) { return <><footer id="sidebar-footer" className={className}>
return <p>{config.language == "es" ? "Por el momento no hay opciónes streaming." : config.language == "en" ? "There are no online viewing options right now." : ""}</p> {watchProvidersExist(watchProviders) ?
} <>
return <><footer id="sidebar-footer"> <div className="flex w-full justify-around">
<div id="watch-providers-container"> {watchProviders?.flatrate?.length > 0 ? <div className=""><h1>Streaming:</h1><ProviderIcons providerList={watchProviders.flatrate} link={watchProviders.link} /></div> : ""}
{watchProviders?.flatrate?.length > 0 ? <div className="watch-providers"><h1>Streaming:</h1><ProviderIcons providerList={watchProviders.flatrate} link={watchProviders.link} /></div> : ""} {watchProviders?.rent?.length > 0 ? <div className=""><h1>{config.language == "es" ? "Alquiler:" : config.language == "en" ? "To Rent:" : ""}</h1><ProviderIcons providerList={watchProviders.rent} link={watchProviders.link} /></div> : ""}
{watchProviders?.rent?.length > 0 ? <div className="watch-providers"><h1>{config.language == "es" ? "Alquiler:" : config.language == "en" ? "To Rent:" : ""}</h1><ProviderIcons providerList={watchProviders.rent} link={watchProviders.link} /></div> : ""}
{watchProviders?.buy?.length > 0 ? <div className="watch-providers"><h1>{config.language == "es" ? "Comprar:" : config.language == "en" ? "To Buy:" : ""}</h1><ProviderIcons providerList={watchProviders.buy} link={watchProviders.link} /></div> : ""} {watchProviders?.buy?.length > 0 ? <div className="watch-providers"><h1>{config.language == "es" ? "Comprar:" : config.language == "en" ? "To Buy:" : ""}</h1><ProviderIcons providerList={watchProviders.buy} link={watchProviders.link} /></div> : ""}
</div> </div>
<p>Powered by Just Watch.</p> <p className="w-fit mx-auto mt-4">Powered by Just Watch.</p>
</footer> </> :
<p className="w-fit mx-auto">{config.language == " es" ? "Por el momento no hay opciónes streaming." : config.language == "en" ? "There are no online viewing options right now." : ""}</p>
}
</footer >
</> </>
} }

View File

@ -2,7 +2,11 @@
export default { export default {
content: ["./dist/index.html", "./src/**/*.{js,ts,jsx,tsx}"], content: ["./dist/index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: { theme: {
extend: {}, extend: {
aspectRatio: {
poster: "2 / 3",
},
},
}, },
plugins: [], plugins: [],
}; };