-
Notifications
You must be signed in to change notification settings - Fork 417
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
Lina and Emilia Movie Site #317
base: master
Are you sure you want to change the base?
Changes from all commits
210d353
a12538b
c4f8128
ada9d54
7f7ba24
ca79092
b66a63f
0642719
a38c518
0344e76
dc526bd
b9b8008
a72e199
c256c51
165002a
4007e32
e417da9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This favicon was generated using the following font: | ||
|
||
- Font Title: Leckerli One | ||
- Font Author: Copyright (c) 2011 Gesine Todt (www.gesine-todt.de), with Reserved Font Names "Leckerli" | ||
- Font Source: http://fonts.gstatic.com/s/leckerlione/v16/V8mCoQH8VCsNttEnxnGQ-1itLZxcBtItFw.ttf | ||
- Font License: SIL Open Font License, 1.1 (http://scripts.sil.org/OFL)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta property="og:title" content="Lina and Emilia movie site" > | ||
<meta property="og:description" content="Top 20 popular movies right now"> | ||
<meta propert="og:image" content="🎬"> | ||
Comment on lines
+7
to
+9
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. Nice that you added some og tags! |
||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
|
@@ -13,7 +16,8 @@ | |
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>Technigo React App</title> | ||
<link rel="shortcut icon" href="./favicon_io/favicon.ico" type="image/x-icon"> | ||
<title>Lina and Emilia movie site</title> | ||
</head> | ||
|
||
<body> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
/* eslint-disable react/react-in-jsx-scope */ | ||
/* eslint-disable */ | ||
import React from 'react'; | ||
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. Your app component is nice and clean! |
||
import { BrowserRouter, Routes, Route } from 'react-router-dom'; | ||
import { MoviesList } from 'components/MoviesList'; | ||
import { MoviesDetails } from 'components/MoviesDetails'; | ||
import NotFound from 'components/NotFound'; | ||
import Footer from 'components/Footer' | ||
|
||
|
||
export const App = () => { | ||
return ( | ||
<div> | ||
Find me in src/app.js! | ||
</div> | ||
); | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<MoviesList />} /> | ||
<Route path="/movies/:movieId" element={<MoviesDetails />} /> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes> | ||
<Footer /> | ||
</BrowserRouter> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable react/react-in-jsx-scope */ | ||
/* eslint-disable */ | ||
import React, { useState, useEffect } from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { API_KEY } from '../data/Url'; | ||
|
||
const Credits = () => { | ||
const [ credits, setCredits ] = useState([]) | ||
const { movieId } = useParams() | ||
|
||
useEffect(() => { | ||
fetch(`https://api.themoviedb.org/3/movie/${movieId}/credits?api_key=${API_KEY}&language=en-US`) | ||
.then((res) => res.json()) | ||
.then((data) => setCredits(data.cast.slice(0, 5))) | ||
}, [movieId]) | ||
|
||
return ( | ||
<div className="credits"> | ||
{credits.map((credit) => ( | ||
<p key={credit.name}>{credit.name}</p> | ||
))} | ||
</div> | ||
) | ||
} | ||
|
||
export default Credits; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* eslint-disable */ | ||
import React from 'react'; | ||
import '../css/Footer.css'; | ||
|
||
const Footer = () => { | ||
return ( | ||
<section className="footer-container"> | ||
<span className="text">Made by Emilia Saberski and Lina Adamsson Technigo 2023</span> | ||
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. Is there a reason this a span and not a paragraph? |
||
</section> | ||
) | ||
} | ||
|
||
export default Footer; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* eslint-disable react/react-in-jsx-scope */ | ||
/* eslint-disable */ | ||
import React, { useState, useEffect } from 'react'; | ||
import { useParams, useNavigate } from 'react-router-dom'; | ||
import { DETAILS_URL } from '../data/Url'; | ||
import '../css/MoviesDetails.css'; | ||
import Credits from './Credits'; | ||
import '../css/Credits.css' | ||
|
||
export const MoviesDetails = () => { | ||
const [movie, setMovie] = useState() | ||
const navigate = useNavigate(); | ||
const { movieId } = useParams() | ||
|
||
const onBackButtonClick = () => { | ||
navigate(-1) | ||
} | ||
|
||
useEffect(() => { | ||
fetch(DETAILS_URL(movieId)) | ||
.then((res) => res.json()) | ||
.then((json) => { | ||
setMovie(json) | ||
}) | ||
}, [movieId]) | ||
console.log(movie) | ||
|
||
return ( | ||
<section className="movie-container"> | ||
{movie && ( | ||
<><img src={`https://image.tmdb.org/t/p/w1280${movie.backdrop_path}`} alt={movie.title} className="background" /><div className="summary"> | ||
<button className="back-button" type="button" onClick={(onBackButtonClick)}> Back </button> | ||
<img src={`https://image.tmdb.org/t/p/w342${movie.poster_path}`} alt={movie.title} className="poster" /> | ||
<div className="details"> | ||
<h1>{movie.title}</h1> | ||
<span className="tagline">{movie.tagline} | ||
</span> | ||
<span className="overview">{movie.overview} | ||
</span> | ||
<Credits /> | ||
<span className="rating">⭐️ {Math.round(movie.vote_average * 10) / 10} | ||
</span> | ||
<span className="length">{movie.runtime} min | ||
</span> | ||
Comment on lines
+36
to
+44
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. What is the reason behind using span here instead of paragraph? |
||
</div> | ||
</div></> | ||
)} | ||
</section> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { LIST_URL } from '../data/Url'; | ||
import '../css/MoviesList.css' | ||
|
||
export const MoviesList = () => { | ||
const [movies, setMovies] = useState([]) | ||
const [loading, setLoading] = useState(false) | ||
|
||
useEffect(() => { | ||
setLoading(true) | ||
fetch(LIST_URL) | ||
.then((res) => res.json()) | ||
.then((json) => { | ||
setMovies(json.results) | ||
setTimeout(() => setLoading(false), 200) | ||
}) | ||
}, []) | ||
console.log(movies) | ||
|
||
if (loading) { | ||
return <p className="loader">Loading</p> | ||
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. When the page is loading it also shows the footer high up on the page which, so maybe the footer needs to be in a fixed position at the bottom of the page? |
||
} | ||
|
||
return ( | ||
<section className="movies-container"> | ||
{movies.map((movie) => ( | ||
<Link key={movie.id} to={`/movies/${movie.id}`}> | ||
<div className="movie-overlay"> | ||
<img src={`https://image.tmdb.org/t/p/w342${movie.poster_path}`} alt={movie.title} className="movie-poster" /> | ||
<h1 className="movie-text">{movie.title}</h1> | ||
</div> | ||
</Link> | ||
))} | ||
</section> | ||
) | ||
} | ||
Comment on lines
+1
to
+37
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. Clean code with really good structure! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import '../css/NotFound.css'; | ||
|
||
const NotFound = () => { | ||
const navigate = useNavigate(); | ||
const onHomeButtonClick = () => { | ||
navigate('/') | ||
} | ||
return ( | ||
<div className="error-container"> | ||
<p className="error-message">We can't seem to find the page you're looking for. Please go back to main page and try again. | ||
</p> | ||
<button className="link-to-main" type="button" onClick={onHomeButtonClick}>Take me back</button> | ||
<span className="film-emoji">🎬</span> | ||
</div> | ||
) | ||
} | ||
|
||
export default NotFound; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* { | ||
color: white; | ||
} |
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.
Nice touch with the favicon!