Skip to content
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

Week 8: Movies - Alexander & Malin #312

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Project Movies

Replace this readme with your own information about your project.

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.
Movies project - week 8

## The problem

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?
Using moviedb.org API endpoints to create a website showing upcoming movies and popular movies. Additionally, getting familiar with BrowserRouter, Routes, & Link in React.

## View it live

Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
https://alex-malin-movies.netlify.app/
100 changes: 72 additions & 28 deletions code/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
"private": true,
"dependencies": {
"@babel/eslint-parser": "^7.18.9",
"babel-plugin-macros": "^3.1.0",
"eslint": "^8.21.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.9.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
2 changes: 1 addition & 1 deletion code/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
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>
<title>MalinAlexMovies</title>
</head>

<body>
Expand Down
46 changes: 42 additions & 4 deletions code/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
import React from 'react';
/* eslint-disable linebreak-style */
import React, { useState, useEffect } from 'react';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import Aboutus from 'components/Aboutus';
import Moviedetails from './components/Moviedetails'
import Movies from './components/Movies'
import Notfound from './components/Notfound'
import Loadingscreen from './components/Loadingscreen'
import Header from './components/Header'
import Popularmovies from './components/Popularmovies'

const Upcomingmovies = ('https://api.themoviedb.org/3/movie/upcoming?api_key=b6486ef7752f2120246f9cab35f64ece&language=en-US&page=1')

export const App = () => {
const [movieList, setMovielist] = useState([])
const [loading, setLoading] = useState(false)

useEffect(() => {
setLoading(true)
fetch(Upcomingmovies)
.then((response) => response.json())
.then((data) => setMovielist(data.results))
.catch((e) => { console.error(e) })
.finally(() => {
setTimeout(() => {
setLoading(false)
}, 3000);
})
}, [])
console.log(movieList)
if (loading) {
return <Loadingscreen />
}
return (
<div>
Find me in src/app.js!
</div>
<BrowserRouter>
<Header />
<Routes>
<Route path="/" element={<Movies movieList={movieList} />} />
<Route path="/moviedetails/:movieId" element={<Moviedetails />} />
<Route path="/popularmovies" element={<Popularmovies />} />
<Route path="/404" element={<Notfound />} />
<Route path="/*" element={<Navigate to="/404" replace />} />
<Route path="/aboutus" element={<Aboutus />} />
</Routes>
</BrowserRouter>
);
}
31 changes: 31 additions & 0 deletions code/src/components/Aboutus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable linebreak-style */
/* eslint-disable no-lone-blocks */
import React from 'react';
// import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
// import { faEnvelope } from '@fortawesome/free-solid-svg-icons'

import Githubicon from '../images/github.svg'
import Logoimage from '../images/moviesheader.PNG'

const Aboutus = () => {
return (
<section>
<div className="aboutus"> <h2>About us!</h2>
<button className="githubbutton" type="button" onClick={() => { window.open('https://github.com/Alexander-Gabor', '_blank') }}>
<img src={Githubicon} alt="github icon" /><p> Go to Alexander&apos;s GitHub!</p>
</button>
<button className="githubbutton" type="button" onClick={() => { window.open('https://github.com/MalinSkill', '_blank') }}>
<img src={Githubicon} alt="github icon" /><p>Go to Malin&apos;s GitHub!</p>
</button>
<img className="logo-image-aboutus" src={Logoimage} alt="site logo" />
</div>
</section>
)
}

export default Aboutus;

// Doing it this way did not open the link in a new window
{ /* <button className="githubbutton" type="button" onClick={() => { window.location.href = 'https://github.com/MalinSkill' }}>
<img src={Githubicon} alt="github icon" /><p>Go to Malin&apos;s GitHub!</p>
</button> */ }
Loading