Compare commits

...

5 Commits

Author SHA1 Message Date
andrzej a70ddebc8a delete function module
better to have that stuff in tmdb
2024-05-08 16:52:25 +02:00
andrzej 562f91f61c move sidebar 2024-05-08 16:50:49 +02:00
andrzej d523372464 font styling 2024-05-08 16:50:39 +02:00
andrzej b9f2833283 move sidebar 2024-05-08 16:50:27 +02:00
andrzej d0bc6faec0 install fonts 2024-05-08 16:50:12 +02:00
8 changed files with 73 additions and 48 deletions

View File

@ -10,6 +10,31 @@
width: 100%;
}
@font-face {
font-family: "Jura";
src: url("fonts/Jura-VariableFont_wght.ttf");
}
@font-face {
font-family: "RobotoBold";
src: url("fonts/Roboto-Bold.ttf")
}
body {
font-family: Jura;
color: white;
}
.main-container {
width: 100%;
height: 100%;
background-size: cover;
display: flex;
align-items: center;
}
main {
display: flex;
background-size: cover;
@ -17,26 +42,51 @@ main {
}
#movie-wall-container {
display: inline-flex;
flex-wrap: wrap;
flex-basis: 60%;
align-items: center;
gap: 1em;
}
img {
aspect-ratio: 2/3;
}
#sidebar {
flex-basis: calc(var(--poster-width)*2)
flex-basis: calc(var(--poster-width)*2);
font-size: 1.6rem;
h1 {
font-size: 2em;
margin-bottom: 0.2em;
/* line-height: 0.8em; */
font-family: RobotoBold;
padding: 0.1em 0.2em 0 0.2em;
}
p {
font-family: Jura;
}
img {
width: 90%;
aspect-ratio: 2/3;
box-shadow: 1em 1em 1em rgba(0, 0, 0, 0.5);
}
}
.poster {
width: var(--poster-width);
aspect-ratio: 2/3;
background-size: cover;
display: grid;
img {
height: 100%;
aspect-ratio: 2/3;
}
}

View File

@ -34,27 +34,26 @@ function App() {
useEffect(() => {
setLoadedMovies(movies.length)
if (movies[0].backdrop_path) {
setBackdrop(tmdb.makeBgImgUrl(movies[0].backdrop_path))
const bgString = "linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)), " + tmdb.makeBgImgUrl(movies[0].backdrop_path)
setBackdrop(bgString)
}
}, [movies])
return (
<>
<header>
<h1>Movie Explorer</h1>
</header>
<main style={{ backgroundImage: backdrop }}>
<div id="movie-wall-container">
{loadedMovies === movies.length ?
<MovieWall movies={movies}
setMovies={setMovies}
config={config}
setChosenMovie={setChosenMovie}
setLoadedMovies={setLoadedMovies}
/>
: "LOADING " + loadedMovies} </div>
<Sidebar movie={chosenMovie} />
</main>
<div className='main-container' style={{ backgroundImage: backdrop }}>
<main >
<Sidebar movie={chosenMovie} />
<div id="movie-wall-container">
{loadedMovies === movies.length ?
<MovieWall movies={movies}
setMovies={setMovies}
config={config}
setChosenMovie={setChosenMovie}
setLoadedMovies={setLoadedMovies}
/>
: "LOADING " + loadedMovies} </div>
</main>
</div>
</>
)
}

Binary file not shown.

Binary file not shown.

BIN
src/fonts/Roboto-Bold.ttf Normal file

Binary file not shown.

View File

@ -1,22 +0,0 @@
/**
* Move array item from provided index to specified index
* @remarks 'to' index refers to position in original array, i.e. if to > from, to = to -1
* @param array
* @param from - the index of the item we want moved
* @param to - the index we want the item moved to
* @returns The modified array
*
* @beta
*/
export function relocateArrayItem(array: Array<any>, from: number, to: number) {
const newArray = structuredClone(array)
const element = newArray.splice(from, 1)[0]
newArray.splice(to < from ? to : to - 1, 0, element)
console.log("reordered array: ")
console.log(newArray)
return newArray
}
/**
* Returns a complete tmdb image url
*/

View File

@ -5,11 +5,9 @@ export interface SidebarProps extends React.ComponentPropsWithRef<"div"> {
movie: Movie;
}
export function Sidebar({ movie }: SidebarProps) {
const style = {
backgroundImage: tmdb.makeBgImgUrl(movie.backdrop_path ?? "")
}
return <div id="sidebar" style={style}>
return <div id="sidebar">
<h1>{movie?.title ?? "loading"}</h1>
<img src={tmdb.makeImgUrl(movie.poster_path ?? "")} />
<p>{movie?.overview ?? "loading"}</p>
</div>

View File

@ -51,7 +51,7 @@ export default {
return e.poster_path
})
array.splice(19)
array.unshift(movie)
// array.unshift(movie)
callback(array)
return true
} else {