├── public ├── robots.txt ├── manifest.json └── index.html ├── src ├── axios.js ├── constants │ └── constants.js ├── App.css ├── index.js ├── Components │ ├── NavBar │ │ ├── NavBar.css │ │ └── NavBar.js │ ├── RowPost │ │ ├── RowPost.css │ │ └── RowPost.js │ └── Banner │ │ ├── Banner.css │ │ └── Banner.js ├── urls.js └── App.js ├── .gitignore ├── package.json └── README.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/axios.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import {baseUrl} from './constants/constants' 3 | const instance = axios.create({ 4 | baseURL: baseUrl, 5 | }); 6 | 7 | export default instance -------------------------------------------------------------------------------- /src/constants/constants.js: -------------------------------------------------------------------------------- 1 | export const baseUrl = 'https://api.themoviedb.org/3'; 2 | export const API_KEY = 'ff5c52c35a2f9eed958387f8b3e6e22d'; 3 | export const imageUrl = 'https://image.tmdb.org/t/p/original'; 4 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | *{ 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | body{ 7 | font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; 8 | background-color: #111; 9 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './App'; 4 | 5 | const root = ReactDOM.createRoot(document.getElementById('root')); 6 | root.render( 7 | 8 | 9 | 10 | ); 11 | 12 | -------------------------------------------------------------------------------- /src/Components/NavBar/NavBar.css: -------------------------------------------------------------------------------- 1 | 2 | .navbar{ 3 | position: fixed; 4 | top: 0; 5 | width: 100%; 6 | height: 30px; 7 | padding: 20px; 8 | display: flex; 9 | justify-content: space-between; 10 | background-color: #111; 11 | } 12 | .logo{ 13 | position: fixed; 14 | left: 20px; 15 | width: 80px; 16 | } 17 | .avatar{ 18 | position: fixed; 19 | right: 20px; 20 | width: 30px; 21 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/urls.js: -------------------------------------------------------------------------------- 1 | import {API_KEY} from './constants/constants' 2 | export const originals = `/discover/tv?api_key=${API_KEY}&with_networks=213` 3 | export const action = `/discover/movie?api_key=${API_KEY}&with_genres=28` 4 | export const comedy = `/discover/movie?api_key=${API_KEY}&with_genres=35` 5 | export const horror = `/discover/movie?api_key=${API_KEY}&with_genres=27` 6 | export const romance = `/discover/movie?api_key=${API_KEY}&with_genres=10749` 7 | export const documentaries = `/discover/movie?api_key=${API_KEY}&with_genres=99` -------------------------------------------------------------------------------- /src/Components/NavBar/NavBar.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './NavBar.css'; 3 | 4 | function NavBar() { 5 | return ( 6 |
7 | Netflix Logo 8 | Avatar 9 |
10 | ) 11 | } 12 | 13 | export default NavBar -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/Components/RowPost/RowPost.css: -------------------------------------------------------------------------------- 1 | .row{ 2 | margin-left: 20px; 3 | color: #fff; 4 | } 5 | .posters{ 6 | display: flex; 7 | padding: 20px; 8 | overflow-x: scroll; 9 | overflow-y: hidden; 10 | } 11 | .posters::-webkit-scrollbar{ 12 | display: none; 13 | } 14 | .poster{ 15 | cursor: pointer; 16 | max-height: 250px; 17 | margin-right: 10px; 18 | } 19 | .smallPoster{ 20 | cursor: pointer; 21 | max-height: 150px; 22 | margin-right: 10px; 23 | 24 | } 25 | 26 | .poster:hover{ 27 | transform: scale(1.08); 28 | } 29 | .smallPoster:hover{ 30 | transform: scale(1.08); 31 | } -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | React App 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import NavBar from "./Components/NavBar/NavBar"; 3 | import {originals,action,comedy,horror,romance,documentaries} from './urls' 4 | import './App.css' 5 | import Banner from "./Components/Banner/Banner"; 6 | import RowPost from "./Components/RowPost/RowPost"; 7 | 8 | function App() { 9 | return ( 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | ); 21 | } 22 | 23 | export default App; 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "netflix", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.16.5", 7 | "@testing-library/react": "^13.4.0", 8 | "@testing-library/user-event": "^13.5.0", 9 | "axios": "^1.1.3", 10 | "react": "^18.2.0", 11 | "react-dom": "^18.2.0", 12 | "react-scripts": "5.0.1", 13 | "react-youtube": "^10.0.0", 14 | "web-vitals": "^2.1.4" 15 | }, 16 | "scripts": { 17 | "start": "react-scripts start", 18 | "build": "react-scripts build", 19 | "test": "react-scripts test", 20 | "eject": "react-scripts eject" 21 | }, 22 | "eslintConfig": { 23 | "extends": [ 24 | "react-app", 25 | "react-app/jest" 26 | ] 27 | }, 28 | "browserslist": { 29 | "production": [ 30 | ">0.2%", 31 | "not dead", 32 | "not op_mini all" 33 | ], 34 | "development": [ 35 | "last 1 chrome version", 36 | "last 1 firefox version", 37 | "last 1 safari version" 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Components/Banner/Banner.css: -------------------------------------------------------------------------------- 1 | .banner{ 2 | background-size: cover; 3 | height: 500px; 4 | color: white; 5 | 6 | } 7 | .content{ 8 | padding-top: 140px; 9 | height: 19 0px; 10 | padding-left: 15px; 11 | } 12 | .title{ 13 | font-size: 3rem; 14 | font-weight: 800; 15 | padding-bottom: 0.3rem; 16 | } 17 | .button{ 18 | color: white; 19 | outline: none; 20 | border: none; 21 | font-weight: 700; 22 | border-radius: 5px; 23 | padding-left: 2rem; 24 | padding-right: 2rem; 25 | padding-top: 0.5rem; 26 | padding-bottom: 0.5rem; 27 | background-color: rgba(51, 51, 51, 0.5); 28 | cursor: pointer; 29 | margin-right: 1rem; 30 | } 31 | 32 | .button:hover{ 33 | color: black; 34 | background-color: #e6e6e6; 35 | 36 | } 37 | .discription{ 38 | width: 45rem; 39 | line-height: 1.3; 40 | padding-top: 1rem; 41 | font-size: 1rem; 42 | height: 80px; 43 | max-width: 360px; 44 | } 45 | .fade_bottom{ 46 | height: 15.4rem; 47 | background-image: linear-gradient(180deg,transparent,rgba(37,37,37,.61),#111); 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/Components/Banner/Banner.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react' 2 | import {API_KEY,imageUrl} from '../../constants/constants' 3 | import axios from '../../axios' 4 | import './Banner.css' 5 | function Banner() { 6 | const [movie,setMovie] = useState() 7 | useEffect(()=>{ 8 | axios.get(`https://api.themoviedb.org/3/trending/all/week?api_key=${API_KEY}&language=en-US`).then((response)=>{ 9 | console.log(response.data.results[0]) 10 | setMovie(response.data.results[Math.floor(Math.random() * response.data.results.length + 1)]) 11 | }) 12 | },[]) 13 | return ( 14 |
17 |
18 |

{movie? movie.name : ""}

19 |
20 | 21 | 22 |
23 |

{movie ? movie.overview : ""}

24 |
25 |
26 |
27 | ) 28 | } 29 | 30 | export default Banner -------------------------------------------------------------------------------- /src/Components/RowPost/RowPost.js: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react' 2 | import { API_KEY, imageUrl } from '../../constants/constants' 3 | import Youtube from 'react-youtube' 4 | import './RowPost.css' 5 | import axios from '../../axios' 6 | function RowPost(props) { 7 | const [movies, setMovies] = useState([]) 8 | const [urlId,setUrlId] = useState('') 9 | useEffect(() => { 10 | axios.get(props.url).then((response) => { 11 | console.log(response.data) 12 | setMovies(response.data.results) 13 | }).catch((error) => { 14 | console.log(error); 15 | }) 16 | },[]) 17 | const opts = { 18 | height: '390', 19 | width: '100%', 20 | playerVars: { 21 | // https://developers.google.com/youtube/player_parameters 22 | autoplay: 0, 23 | }, 24 | }; 25 | const handleMovie = (id) => { 26 | console.log(id); 27 | axios.get(`/movie/${id}/videos?api_key=${API_KEY}&language=en-US`).then((response)=>{ 28 | console.log(response); 29 | if (response.data.results.length!==0) { 30 | setUrlId(response.data.results[0]) 31 | }else{ 32 | console.log('Trailler Not Availeble'); 33 | } 34 | }) 35 | } 36 | return ( 37 |
38 |

{props.title}

39 |
40 | {movies.map((obj) => 41 | 42 | handleMovie(obj.id)} className={props.isSmall ? 'smallPoster' : 'poster'} src={`${imageUrl + obj.backdrop_path}`} alt="poster" /> 43 | )} 44 | 45 | 46 |
47 | { urlId && } 48 |
49 | ) 50 | } 51 | 52 | export default RowPost -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | --------------------------------------------------------------------------------