Compare commits
No commits in common. "a70ddebc8a0b3c688c196f860006c48a8340a7b7" and "f5078240053eecb3db4a9b1c92b16dab177493ca" have entirely different histories.
a70ddebc8a
...
f507824005
58
src/App.css
58
src/App.css
|
@ -10,31 +10,6 @@
|
||||||
width: 100%;
|
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 {
|
main {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
|
@ -42,51 +17,26 @@ main {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#movie-wall-container {
|
#movie-wall-container {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-basis: 60%;
|
flex-basis: 60%;
|
||||||
align-items: center;
|
|
||||||
gap: 1em;
|
gap: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
|
||||||
aspect-ratio: 2/3;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#sidebar {
|
#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 {
|
.poster {
|
||||||
width: var(--poster-width);
|
width: var(--poster-width);
|
||||||
|
aspect-ratio: 2/3;
|
||||||
|
background-size: cover;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
aspect-ratio: 2/3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
33
src/App.tsx
33
src/App.tsx
|
@ -34,26 +34,27 @@ function App() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoadedMovies(movies.length)
|
setLoadedMovies(movies.length)
|
||||||
if (movies[0].backdrop_path) {
|
if (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(tmdb.makeBgImgUrl(movies[0].backdrop_path))
|
||||||
setBackdrop(bgString)
|
|
||||||
}
|
}
|
||||||
}, [movies])
|
}, [movies])
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className='main-container' style={{ backgroundImage: backdrop }}>
|
<header>
|
||||||
<main >
|
<h1>Movie Explorer</h1>
|
||||||
<Sidebar movie={chosenMovie} />
|
</header>
|
||||||
<div id="movie-wall-container">
|
<main style={{ backgroundImage: backdrop }}>
|
||||||
{loadedMovies === movies.length ?
|
<div id="movie-wall-container">
|
||||||
<MovieWall movies={movies}
|
{loadedMovies === movies.length ?
|
||||||
setMovies={setMovies}
|
<MovieWall movies={movies}
|
||||||
config={config}
|
setMovies={setMovies}
|
||||||
setChosenMovie={setChosenMovie}
|
config={config}
|
||||||
setLoadedMovies={setLoadedMovies}
|
setChosenMovie={setChosenMovie}
|
||||||
/>
|
setLoadedMovies={setLoadedMovies}
|
||||||
: "LOADING " + loadedMovies} </div>
|
/>
|
||||||
</main>
|
: "LOADING " + loadedMovies} </div>
|
||||||
</div>
|
<Sidebar movie={chosenMovie} />
|
||||||
|
</main>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,22 @@
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
|
@ -5,9 +5,11 @@ export interface SidebarProps extends React.ComponentPropsWithRef<"div"> {
|
||||||
movie: Movie;
|
movie: Movie;
|
||||||
}
|
}
|
||||||
export function Sidebar({ movie }: SidebarProps) {
|
export function Sidebar({ movie }: SidebarProps) {
|
||||||
return <div id="sidebar">
|
const style = {
|
||||||
|
backgroundImage: tmdb.makeBgImgUrl(movie.backdrop_path ?? "")
|
||||||
|
}
|
||||||
|
return <div id="sidebar" style={style}>
|
||||||
<h1>{movie?.title ?? "loading"}</h1>
|
<h1>{movie?.title ?? "loading"}</h1>
|
||||||
<img src={tmdb.makeImgUrl(movie.poster_path ?? "")} />
|
|
||||||
<p>{movie?.overview ?? "loading"}</p>
|
<p>{movie?.overview ?? "loading"}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default {
|
||||||
return e.poster_path
|
return e.poster_path
|
||||||
})
|
})
|
||||||
array.splice(19)
|
array.splice(19)
|
||||||
// array.unshift(movie)
|
array.unshift(movie)
|
||||||
callback(array)
|
callback(array)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue