-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Movies Sofie #67
Open
SofieFerrari
wants to merge
27
commits into
Technigo:main
Choose a base branch
from
SofieFerrari:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Movies Sofie #67
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
56c7bee
startup code for project
SofieFerrari e7ea0ee
getting components and routes in place and playing with colors
SofieFerrari 425fef0
pushing before starting to fetch API
SofieFerrari 1b80757
fetched the data from the movieAPI
SofieFerrari b91bf2b
working on components
SofieFerrari 1851161
worked on loading animation and tried to fix setTimeout
SofieFerrari e03572f
working on rendering data from api to moviecard
SofieFerrari 2cb7821
wrapped app.jsx in route
SofieFerrari 366775f
formatting code after lecture
SofieFerrari fdfb810
working with moviecard
SofieFerrari bda5d30
something
SofieFerrari 915d1eb
got help from the moons
SofieFerrari 8722dc4
got fetch to work, rendered data to movielist
SofieFerrari a828182
sucessfully rendered data from detail-api
SofieFerrari 069a5e1
added a notfound-page. working on adding info to detailslist
SofieFerrari 2c28160
got backgroundpic in place for detaillist
SofieFerrari 8c47c74
all elements to second page -details - are in place
SofieFerrari 0b86e37
hover in place
SofieFerrari 7c215c1
working on styling mobile
SofieFerrari 262187b
working on responsiveness
SofieFerrari 58ff6dd
made placeholder button, will put icon there later
SofieFerrari 2919289
finally finished project
SofieFerrari a75d66b
changed loader lottie, added backarrow lottie, fixed la
SofieFerrari 89f5c85
fixed minor bug
SofieFerrari 5e294b2
added env-file and toml-file for deploy
SofieFerrari 7dd6d64
cleaned and formatted code
SofieFerrari 8cefaba
formatted code
SofieFerrari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_OPENDB_KEY= 23ace2b0c27910f5cec13f5bdb014044 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, | ||
settings: { react: { version: '18.2' } }, | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:react-hooks/recommended", | ||
], | ||
ignorePatterns: ["dist", ".eslintrc.cjs"], | ||
parserOptions: { ecmaVersion: "latest", sourceType: "module" }, | ||
settings: { react: { version: "18.2" } }, | ||
plugins: ["react-refresh"], | ||
rules: { | ||
"react-refresh/only-export-components": [ | ||
"warn", | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[[redirects]] | ||
from = "/*" | ||
to = "/index.html" | ||
status = 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
import { BrowserRouter, Routes, Route } from "react-router-dom" | ||
import { useParams } from "react-router-dom" | ||
import { Movies } from "./components/FirstPage.jsx" | ||
import { Details } from "./components/SecondPage.jsx" | ||
import { Nav } from "./components/Nav" | ||
import { useEffect, useState } from "react" | ||
import { NotFound } from "./components/NotFound.jsx" | ||
|
||
export const App = () => { | ||
return <div>Find me in src/app.jsx!</div>; | ||
}; | ||
return ( | ||
<BrowserRouter> | ||
<main> | ||
{/* <Nav /> */} | ||
<Routes> | ||
<Route path="/" element={<Movies />} /> | ||
<Route path="/details/:slug" element={<Details />} /> | ||
<Route path="/notfound/" element={<NotFound />} /> | ||
</Routes> | ||
</main> | ||
</BrowserRouter> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Lottie from "react-lottie" | ||
import animationData from "../lotties/backanimation.json" | ||
|
||
export const BackImage = () => { | ||
const defaultOptions = { | ||
loop: true, | ||
autoplay: true, | ||
animationData: animationData, | ||
rendererSettings: { | ||
preserveAspectRatio: "xMidYMid slice", | ||
}, | ||
} | ||
|
||
return ( | ||
<div> | ||
<Lottie options={defaultOptions} height={200} width={200} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Link } from "react-router-dom" | ||
import "../styling/DetailList.css" | ||
import { BackImage } from "./BackImage" | ||
|
||
export const DetailList = ({ detailData }) => { | ||
console.log("check data in DetailList", detailData) | ||
return ( | ||
<> | ||
{/* {detailData && | ||
detailData.results.map((detail) => ( */} | ||
<div className="detail-wrapper"> | ||
<div | ||
className="detail-background" | ||
style={{ | ||
backgroundImage: `url(https://media.themoviedb.org/t/p/w780${detailData.backdrop_path})`, | ||
backgroundRepeat: "no-repeat", | ||
backgroundSize: "cover", | ||
minWidth: "100VW", | ||
}}> | ||
<div className="details-card"> | ||
<Link to={"/"}> | ||
<BackImage className="back-btn" /> | ||
</Link> | ||
<img | ||
className="poster-image" | ||
src={`https://image.tmdb.org/t/p/w342${detailData.poster_path}`} | ||
alt={`Movie poster for ${detailData.title}`} | ||
/> | ||
<div className="poster-text"> | ||
<h1>{detailData.title}</h1> | ||
<h2>⭐ {detailData.vote_average.toFixed(1)}</h2> | ||
<p>{detailData.overview}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useState, useEffect } from "react" | ||
import { PopularList } from "./PopularList.jsx" | ||
import { Loader } from "./Loader" | ||
|
||
export const Movies = () => { | ||
const [movieData, setMovieData] = useState(null) | ||
const [isLoading, setIsLoading] = useState(true) | ||
|
||
const apiEnv = import.meta.env.VITE_OPENDB_KEY | ||
const testUrl = `https://api.themoviedb.org/3/movie/popular?api_key=${apiEnv}&language=en-US&page=1` | ||
|
||
useEffect(() => { | ||
fetch(testUrl) | ||
.then((result) => result.json()) | ||
.then((json) => { | ||
setMovieData(json) | ||
setIsLoading(false) | ||
}) | ||
.catch((error) => { | ||
console.error(error) | ||
}) | ||
}, [testUrl]) | ||
console.log("moviedata firstpage", movieData) | ||
return ( | ||
<> | ||
{isLoading && <Loader />} | ||
<PopularList movieData={movieData} /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const Images = ({ url, altText }) => { | ||
return <img className="images" src=""></img> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Lottie from "react-lottie" | ||
import animationData from "../lotties/animation.json" | ||
|
||
export const Loader = () => { | ||
const defaultOptions = { | ||
loop: true, | ||
autoplay: true, | ||
animationData: animationData, | ||
rendererSettings: { | ||
preserveAspectRatio: "xMidYMid slice", | ||
}, | ||
} | ||
|
||
return ( | ||
<div> | ||
<Lottie options={defaultOptions} height={300} width={300} /> | ||
</div> | ||
) | ||
} | ||
|
||
//nedan är försök att få animationen att visas längre. | ||
|
||
// useEffect(() => { | ||
// export const DelayLottie = setTimeout(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the next time you might want to consider creating the function "DelayLottie" before (for example, around line 5) and then you can call the function inside of the useEffect. 👍 |
||
// setLoading(true) | ||
// }, 3000) | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react" | ||
import { Link, NavLink } from "react-router-dom" | ||
import "../styling/Nav.css" | ||
|
||
export const Nav = () => { | ||
return ( | ||
<> | ||
<div className="navbar-title"> | ||
<h1>RomComs</h1> | ||
</div> | ||
<ul className="navbar"> | ||
<li> | ||
<NavLink to="/">Movies</NavLink> | ||
</li> | ||
<li> | ||
<NavLink to="/details">Details</NavLink> | ||
</li> | ||
</ul> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const NotFound = () => { | ||
return <div>Page not found</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import "../styling/PopularList.css" | ||
import { Link } from "react-router-dom" | ||
|
||
//functional component | ||
export const PopularList = ({ movieData }) => { | ||
return ( | ||
<div className="movie-wrapper"> | ||
<div className="movie-list"> | ||
{movieData && | ||
movieData.results.map((movie) => ( | ||
<Link key={movie.id} to={`/details/${movie.id}`}> | ||
<div className="movie-card" key={movie.id}> | ||
<div className="hover-text"> | ||
<h1 className="title">{movie.title}</h1> | ||
<h2 className="release-date"> | ||
Released {movie.release_date} | ||
</h2> | ||
</div> | ||
<div className="poster"> | ||
<img | ||
className="movie-image" | ||
src={`https://image.tmdb.org/t/p/w342${movie.poster_path}`} | ||
alt={`Movie poster for ${movie.title}`} | ||
/> | ||
</div> | ||
</div> | ||
</Link> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
// return ( | ||
// <> | ||
// {jsonMovies.map((movie) => ( | ||
// <article className="movie-card" key={movie.id}> | ||
// <Link to={`/details/${movie.id}`}></Link> | ||
// </article> | ||
// ))} | ||
// </> | ||
// ) | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import "../styling/SecondPage.css" | ||
import { useState, useEffect } from "react" | ||
import { Loader } from "./Loader" | ||
import { NotFound } from "./NotFound" | ||
import { Link, useParams } from "react-router-dom" | ||
import { DetailList } from "./DetailList" | ||
|
||
export const Details = () => { | ||
const [detailData, setDetailData] = useState(null) | ||
const [isLoading, setIsLoading] = useState(true) | ||
|
||
const params = useParams() | ||
const movieId = params.slug | ||
const API_KEY = "23ace2b0c27910f5cec13f5bdb014044" | ||
|
||
const listUrl = `https://api.themoviedb.org/3/movie/${movieId}?api_key=${API_KEY}&language=en-US` | ||
|
||
useEffect(() => { | ||
fetch(listUrl) | ||
.then((result) => result.json()) | ||
.then((json) => { | ||
setDetailData(json) | ||
setIsLoading(false) | ||
}) | ||
.catch((error) => { | ||
console.error(error) | ||
}) | ||
}, [listUrl]) | ||
|
||
if (!detailData || detailData === undefined) { | ||
return <Loader /> | ||
} | ||
|
||
if (detailData.success === false) { | ||
return <NotFound /> | ||
} | ||
console.log("detailtdata secondpage", detailData) | ||
return ( | ||
<> | ||
{isLoading && <Loader />} | ||
<DetailList detailData={detailData} /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
:root { | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", | ||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", | ||
sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", | ||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", | ||
sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
background-color: rgb(252, 213, 220); | ||
} | ||
|
||
code { | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", | ||
monospace; | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", | ||
monospace; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there are screens that are bigger than 780; maybe next time you could consider on taking 1280px for background images.
-Izabel&Etna