├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
└── src
├── App.js
├── components
├── carregar.css
├── carregar.js
├── header.css
└── header.js
├── index.css
├── index.js
├── pages
├── error
│ ├── erro.css
│ └── erro.js
├── favoritos
│ ├── favoritos.css
│ └── favoritos.js
├── home
│ ├── home.css
│ └── home.js
└── sobre
│ ├── sobre.css
│ └── sobre.js
├── routes.js
└── services
└── api.js
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "filmes-movies",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.4",
7 | "@testing-library/react": "^13.3.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "axios": "^0.27.2",
10 | "react": "^18.2.0",
11 | "react-dom": "^18.2.0",
12 | "react-router-dom": "^6.3.0",
13 | "react-scripts": "5.0.1",
14 | "react-toastify": "^9.0.8",
15 | "web-vitals": "^2.1.4"
16 | },
17 | "scripts": {
18 | "start": "react-scripts start",
19 | "build": "react-scripts build",
20 | "test": "react-scripts test",
21 | "eject": "react-scripts eject"
22 | },
23 | "eslintConfig": {
24 | "extends": [
25 | "react-app",
26 | "react-app/jest"
27 | ]
28 | },
29 | "browserslist": {
30 | "production": [
31 | ">0.2%",
32 | "not dead",
33 | "not op_mini all"
34 | ],
35 | "development": [
36 | "last 1 chrome version",
37 | "last 1 firefox version",
38 | "last 1 safari version"
39 | ]
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wwpedro/ReactJs/dedda3236deb84f0756accefeeb54f5152234436/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 | You need to enable JavaScript to run this app.
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wwpedro/ReactJs/dedda3236deb84f0756accefeeb54f5152234436/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wwpedro/ReactJs/dedda3236deb84f0756accefeeb54f5152234436/public/logo512.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import RouteApp from "./routes";
2 | import {ToastContainer} from 'react-toastify';
3 |
4 | import 'react-toastify/dist/ReactToastify.css'
5 |
6 | function App() {
7 | return (
8 |
9 |
10 |
11 |
12 | );
13 | }
14 |
15 | export default App;
16 |
--------------------------------------------------------------------------------
/src/components/carregar.css:
--------------------------------------------------------------------------------
1 | .carregando{
2 | margin-top: 20%;
3 | margin-left: 50%;
4 | animation: is-roating 1s infinite;
5 | border: 6px solid white;
6 | border-top-color: black;
7 | border-radius: 50%;
8 | height: 50px;
9 | width: 50px;
10 | }
11 |
12 | @keyframes is-roating{
13 | to{
14 | transform: rotate(1turn);
15 | }
16 | }
--------------------------------------------------------------------------------
/src/components/carregar.js:
--------------------------------------------------------------------------------
1 | import './carregar.css';
2 |
3 | function Carregando() {
4 | return (
5 |
6 | );
7 | }
8 |
9 | export default Carregando;
--------------------------------------------------------------------------------
/src/components/header.css:
--------------------------------------------------------------------------------
1 | header{
2 | display: flex;
3 | align-items: center;
4 | justify-content: space-around;
5 | width: 100%;
6 | height: 60px;
7 | background-color: black;
8 | }
9 |
10 | .logo{
11 | text-decoration: none;
12 | font-size: 30px;
13 | cursor: pointer;
14 | color: #fff;
15 | font-weight: bold;
16 | }
17 |
18 | .sobre{
19 | text-decoration: none;
20 | cursor: pointer;
21 | background-color: #fff;
22 | padding: 5px 14px;
23 | color: black;
24 | border-radius: 4px;
25 | }
--------------------------------------------------------------------------------
/src/components/header.js:
--------------------------------------------------------------------------------
1 | import {Link} from 'react-router-dom';
2 | import './header.css';
3 |
4 | function Header() {
5 | return (
6 |
7 | PipocaFlix
8 | Meus Filmes
9 |
10 | );
11 | }
12 |
13 | export default Header;
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | *{
2 | padding: 0;
3 | margin: 0;
4 | box-sizing: border-box;
5 | }
6 |
7 | body{
8 | font-family: sans-serif;
9 | background-color: rgb(17, 17, 17);
10 | }
11 |
12 | .app{
13 | display: flex;
14 | width: 100%;
15 | justify-content: center;
16 | align-items: center;
17 | flex-direction: column;
18 | display: flex;
19 | }
20 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 |
6 | const root = ReactDOM.createRoot(document.getElementById('root'));
7 | root.render(
8 |
9 |
10 |
11 | );
--------------------------------------------------------------------------------
/src/pages/error/erro.css:
--------------------------------------------------------------------------------
1 | .erro{
2 | width: 100%;
3 | height: calc(100vh - 60px);
4 | display: flex;
5 | flex-direction: column;
6 | justify-content: center;
7 | align-items: center;
8 | color: #fff;
9 | }
10 |
11 | .erro h1{
12 | font-size: 120px;
13 | }
14 |
15 | .erro a {
16 | display: flex;
17 | align-items: center;
18 | justify-content: center;
19 | padding: 10px;
20 | margin-top: 10px;
21 | background-color: #ffffff;
22 | text-decoration: none;
23 | color: rgb(0, 0, 0);
24 | border-radius: 10px;
25 | transition: 1s;
26 | }
27 |
28 | .erro a:hover {
29 | display: flex;
30 | align-items: center;
31 | justify-content: center;
32 | padding: 10px;
33 | margin-top: 10px;
34 | background-color: #000000;
35 | text-decoration: none;
36 | color: rgb(255, 255, 255);
37 | border-radius: 10px;
38 | transition: 1s;
39 | }
--------------------------------------------------------------------------------
/src/pages/error/erro.js:
--------------------------------------------------------------------------------
1 | import { Link } from "react-router-dom";
2 | import "./erro.css"
3 |
4 | function Erro() {
5 | return (
6 |
7 |
Erro
8 | Página Não Encontrada
9 | Veja todos os Filmes
10 |
11 | );
12 | }
13 |
14 | export default Erro;
--------------------------------------------------------------------------------
/src/pages/favoritos/favoritos.css:
--------------------------------------------------------------------------------
1 | .titulo{
2 | justify-content: center;
3 | align-items: center;
4 | display: flex;
5 | margin-top: 5%;
6 | color: #fff;
7 | }
8 |
9 |
10 | .secao{
11 | justify-content: center;
12 | align-items: center;
13 | display: flex;
14 | margin-top: 5%;
15 | flex-direction: column;
16 | }
17 |
18 | .secao span{
19 | justify-content: center;
20 | align-items: center;
21 | display: flex;
22 | margin-top: 5%;
23 | flex-direction: column;
24 | color: #fff;
25 | }
26 |
27 | .celula{
28 | background-color: #fff;
29 | width: 50%;
30 | height: 200px;
31 | display: flex;
32 | flex-direction: row;
33 | margin-bottom: 5%;
34 | border-radius: 40px;
35 | }
36 |
37 | .imagem{
38 | background-color: black;
39 | width: 60%;
40 | height: 200px;
41 | border-bottom-left-radius: 40px;
42 | border-top-left-radius: 40px;
43 | }
44 |
45 | .imagem img{
46 | width: 100%;
47 | height: 200px;
48 | border-bottom-left-radius: 40px;
49 | border-top-left-radius: 40px;
50 | object-fit: cover;
51 | }
52 |
53 | .conteudo{
54 | justify-content: center;
55 | align-items: center;
56 | display: flex;
57 | flex-direction: column;
58 | margin-left: 10%;
59 | }
60 |
61 | .conteudo h1{
62 | margin-left: -10px;
63 | }
64 |
65 | .botoes{
66 | justify-content: center;
67 | align-items: center;
68 | display: flex;
69 | flex-direction: row;
70 | padding: 10px;
71 | }
72 |
73 | .botoes button{
74 | text-decoration: none;
75 | font-size: 15px;
76 | cursor: pointer;
77 | margin-left: 15px;
78 | background-color: rgb(97, 0, 0);
79 | color: #fff;
80 | border:none;
81 | padding: 10px;
82 | border-radius: 5px;
83 |
84 | }
85 |
86 | .botoes a button{
87 | text-decoration: none;
88 | font-size: 15px;
89 | cursor: pointer;
90 | margin-left: -15px;
91 | padding-left: -15px;
92 | padding: 10px;
93 | background-color: rgb(0, 0, 0);
94 | color: #fff;
95 | border: none;
96 | border-radius: 5px;
97 | }
98 |
99 | .botoes button:hover{
100 | text-decoration: none;
101 | font-size: 15px;
102 | cursor: pointer;
103 | margin-left: 15px;
104 | background-color: rgb(218, 0, 0);
105 | color: #fff;
106 | border:none;
107 | padding: 10px;
108 | border-radius: 5px;
109 |
110 | }
111 |
112 | .botoes a button:hover{
113 | text-decoration: none;
114 | font-size: 15px;
115 | cursor: pointer;
116 | margin-left: -15px;
117 | padding-left: -15px;
118 | padding: 10px;
119 | background-color: rgb(102, 102, 102);
120 | color: #fff;
121 | border: none;
122 | border-radius: 5px;
123 | }
124 |
--------------------------------------------------------------------------------
/src/pages/favoritos/favoritos.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import { Link } from "react-router-dom";
3 | import {toast} from "react-toastify"
4 |
5 | import "./favoritos.css";
6 |
7 |
8 | function Favoritos(){
9 | const [filmes, setFilmes] = useState([])
10 |
11 | useEffect(()=>{
12 | const minhaLista = localStorage.getItem("@meusFilmes")
13 | setFilmes(JSON.parse(minhaLista)||[])
14 | },[])
15 |
16 | function deletar(id){
17 | let filtroFilmes = filmes.filter((film)=>{
18 | return (film.id!==id)
19 | })
20 | setFilmes(filtroFilmes)
21 | localStorage.setItem("@meusFilmes", JSON.stringify(filtroFilmes))
22 | toast.success("filme delatado com sucesso!")
23 | }
24 |
25 | return(
26 |
27 |
28 |
Favoritos
29 |
30 |
31 | {filmes.length===0 &&
não tem filmes aqui }
32 | {filmes.map((movie)=>{
33 | return(
34 |
35 |
36 |
37 |
38 |
39 |
{movie.title}
40 |
41 | Detalhes
42 | deletar(movie.id)}>deletar
43 |
44 |
45 |
46 | )
47 | })}
48 |
49 |
50 |
51 | );
52 | }
53 |
54 | export default Favoritos;
--------------------------------------------------------------------------------
/src/pages/home/home.css:
--------------------------------------------------------------------------------
1 | .banner{
2 | align-items: center;
3 | justify-content: center;
4 | display: flex;
5 | height: 500px;
6 | width: 100%;
7 | background-image: url("https://www.venturashopping.com.br/wp-content/uploads/2021/10/Banner_Cinema.png");
8 | }
9 |
10 | .banner h1{
11 | margin-top: 0;
12 | background-color: #383838;
13 | padding: 50px;
14 | padding-right: 200px;
15 | padding-left: 200px;
16 | border-top-left-radius: 50px;
17 | border-bottom-right-radius: 50px;
18 | transition: 2s;
19 | border-bottom-left-radius: 0;
20 | border-top-right-radius: 0;
21 | }
22 |
23 | body:hover .banner h1{
24 | background-color: #ffffff;
25 | border-bottom-left-radius: 50px;
26 | border-top-right-radius: 50px;
27 | border-top-left-radius: 0;
28 | border-bottom-right-radius: 0;
29 | transition: 2s;
30 | }
31 |
32 | .filmes{
33 | padding: 30px;
34 | padding-right: 0PX;
35 | }
36 |
37 | .tituloHome{
38 | margin-top: 10;
39 | padding-bottom: 30;
40 | font-size: 25px;
41 | color: #fff;
42 | }
43 |
44 | .filme{
45 | flex-direction: row;
46 | display: flex;
47 | align-items: center;
48 | justify-content: flex-start;
49 | width: 100%;
50 | overflow: auto;
51 | }
52 |
53 | .filme1{
54 | width: 300px;
55 | margin-right: 30px;
56 | }
57 |
58 | .filme1 img{
59 | width: 300px;
60 | margin-right: 30px;
61 |
62 | }
63 |
64 | .filme1 h3{
65 | display: flex;
66 | align-items: center;
67 | justify-content: center;
68 | margin: 5;
69 | padding: 10px 0;
70 | font-size: 24px;
71 | background-color: #ffffff;
72 | color: rgb(0, 0, 0);
73 | border-bottom-left-radius: 8px;
74 | border-bottom-right-radius: 8px;
75 | width: 100%;
76 | transition: 0.2s;
77 | }
78 |
79 | .filme1 h3 a{
80 | text-decoration: none;
81 | text-decoration-style: none;
82 | color: rgb(0, 0, 0);
83 | transition: 0.2s;
84 | }
85 |
86 | .filme1 h3:hover{
87 | transition: 0.2s;
88 | color: rgb(255, 255, 255);
89 | background-color: #000000;
90 | cursor: pointer;
91 | text-decoration: none;
92 | }
93 |
94 | .filme1 h3:hover a{
95 | transition: 0.2s;
96 | color: rgb(255, 255, 255);
97 | }
98 |
99 | .sobreCine{
100 | flex-direction: row;
101 | align-items: center;
102 | justify-content: center;
103 | display: flex;
104 | height: 450px;
105 | width: 100%;
106 | background-color: rgb(17, 17, 17);
107 | }
108 |
109 | .sobreCine:hover .logoCine{
110 | margin-top: 50px;
111 | transition: 1s;
112 | }
113 |
114 | .sobreCine:hover .sobretexto{
115 | margin-top: 50px;
116 | transition: 1s;
117 | background-color: #fff;
118 | }
119 |
120 | .logoCine{
121 | margin-top: -100px;
122 | margin-right: 20px;
123 | transition: 1s;
124 | }
125 |
126 | .logoCine img{
127 | border-radius: 50%;
128 | width: 300px;
129 | }
130 |
131 | .sobretexto{
132 | margin-top: -100px;
133 | background-color: gray;
134 | width: 60%;
135 | height: 200px;
136 | border-radius: 10px;
137 | padding-inline: 5%;
138 | align-items: center;
139 | justify-content: center;
140 | display: flex;
141 | transition: 1s;
142 | }
143 |
144 | .rodape{
145 | margin-top: 100px;
146 | width: 100%;
147 | height: 100px;
148 | background-color: #000000;
149 | }
150 |
151 |
152 | /* ===== Scrollbar CSS ===== */
153 | /* Firefox */
154 | * {
155 | scrollbar-width: auto;
156 | scrollbar-color: #383838 #0f0f0f;
157 | }
158 |
159 | /* Chrome, Edge, and Safari */
160 | *::-webkit-scrollbar {
161 | width: 10px;
162 | }
163 |
164 | *::-webkit-scrollbar-track {
165 | background: #0f0f0f;
166 | }
167 |
168 | *::-webkit-scrollbar-thumb {
169 | background-color: #383838;
170 | border-radius: 8px;
171 | border: 1px none #292929;
172 | }
--------------------------------------------------------------------------------
/src/pages/home/home.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import api from "../../services/api";
3 | import {Link} from 'react-router-dom';
4 | import "./home.css";
5 | import Carregando from "../../components/carregar";
6 |
7 | function Home() {
8 | const [filmes , setFilmes] = useState([]);
9 | const [load , setLoad] = useState(true);
10 |
11 | useEffect(()=>{
12 |
13 | async function loadFilmes(){
14 | const response = await api.get('trending/all/day',{
15 | params:{
16 | api_key:"1139ecfdc8d0b1c0dffb856bf723406c",
17 | language: "pt-Br",
18 | page: 1,
19 | }
20 | })
21 | setFilmes(response.data.results) //setFilmes(response.data.results.slice(0, 10))
22 | setLoad(false)
23 | }
24 | loadFilmes()
25 |
26 | },[])
27 |
28 | //useEffect(()=>{
29 | // fetch(`https://api.themoviedb.org/3/trending/all/day?api_key=1139ecfdc8d0b1c0dffb856bf723406c&language=pt-BR`).then(response=>response.json()).then(data=>setFilmes(data.results))
30 | //},[])
31 |
32 | if(load){
33 | return(
34 |
35 | )
36 | }
37 |
38 | return (
39 |
40 |
41 |
Filmes
42 |
43 |
44 |
45 |
Em Cartaz
46 |
47 | {filmes.map((filme)=>{
48 | return(
49 |
50 |
51 |
52 |
53 |
54 |
Ver Mais
55 |
56 |
57 | )
58 | })}
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | PipocaFlix é um site feito para você que quer saber mais sobre filmes em lançamento,
69 | por isso é importante saber todas as novidades
70 | vendo os detalhes e trailler.
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | );
80 | }
81 |
82 | export default Home;
--------------------------------------------------------------------------------
/src/pages/sobre/sobre.css:
--------------------------------------------------------------------------------
1 | .quadro{
2 | align-items: center;
3 | display: flex;
4 | flex-direction: row;
5 | justify-content: center;
6 | width: 100%;
7 | height: 100%;
8 | }
9 |
10 | .esquerdo{
11 | width: 50%;
12 | height: 597px;
13 | display: flex;
14 | flex-direction: row;
15 | justify-content: center;
16 | }
17 | .baner{
18 | background-color: rgb(0, 0, 0);
19 | width: 50%;
20 | height: 0%;
21 | margin-left: 30%;
22 | margin-top: 0%;
23 | transition: 1s;
24 | }
25 |
26 | body:hover .baner{
27 | background-color: rgb(0, 0, 0);
28 | width: 50%;
29 | height: 100%;
30 | margin-left: 30%;
31 | margin-top: 0%;
32 | transition: 1s;
33 | }
34 |
35 |
36 |
37 | .esquerdo img{
38 | width: 50%;
39 | height: 500px;
40 | margin-top: 5%;
41 | margin-left: -30%;
42 | }
43 |
44 | .direito{
45 | width: 50%;
46 | height: 100%;
47 | }
48 |
49 | .tiuloDetalhe{
50 | margin-top: 5%;
51 | margin-left: 5%;
52 | color: #fff;
53 | align-items: center;
54 | justify-content: center;
55 | display: flex;
56 | }
57 |
58 | .sinopse{
59 | margin: 5%;
60 | color: #fff;
61 | align-items: center;
62 | justify-content: center;
63 | display: flex;
64 | }
65 |
66 | .avaliacao{
67 | margin-left: 5%;
68 | color: #fff;
69 | }
70 |
71 | .botoesDetalhe{
72 | margin: 5%;
73 | align-items: center;
74 | justify-content: center;
75 | display: flex;
76 | }
77 |
78 | .botoesDetalhe button{
79 | margin-inline: 5%;
80 | padding: 10px;
81 | font-size: 20px;
82 | cursor: pointer;
83 | }
84 |
85 |
86 |
87 |
88 |
89 |
90 | * {
91 | scrollbar-width: auto;
92 | scrollbar-color: #383838 #0f0f0f;
93 | }
94 |
95 | /* Chrome, Edge, and Safari */
96 | *::-webkit-scrollbar {
97 | width: 10px;
98 | }
99 |
100 | *::-webkit-scrollbar-track {
101 | background: #0f0f0f;
102 | }
103 |
104 | *::-webkit-scrollbar-thumb {
105 | background-color: #383838;
106 | border-radius: 8px;
107 | border: 1px none #292929;
108 | }
--------------------------------------------------------------------------------
/src/pages/sobre/sobre.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react"
2 | import {useParams , useNavigate} from 'react-router-dom'
3 | import Carregando from "../../components/carregar";
4 | import {toast} from "react-toastify"
5 |
6 | import "./sobre.css";
7 |
8 | import api from "../../services/api";
9 |
10 |
11 | function Sobre() {
12 | const {id} = useParams();
13 | const navgate = useNavigate();
14 | const [filme, setFilme] = useState({});
15 | const [loading , setLoading] = useState(true);
16 |
17 | useEffect(()=>{
18 | async function loadFilme(){
19 | await api.get(`movie/${id}`,{params:{
20 | api_key:"1139ecfdc8d0b1c0dffb856bf723406c",
21 | language: "pt-Br"
22 | }}).then((response)=>{
23 | setFilme(response.data)
24 | setLoading(false)
25 | }).catch(()=>{
26 | navgate("/", {replace: true})
27 | })
28 | }
29 | loadFilme();
30 |
31 | },[id,navgate])
32 |
33 | function salvar(){
34 | const minhaLista = localStorage.getItem('@meusFilmes');
35 | let filmesSalvos = JSON.parse(minhaLista) || [];
36 |
37 | const hasFilme = filmesSalvos.some((listaFilmes)=>listaFilmes.id === filme.id)
38 |
39 | if(hasFilme){
40 | toast.warn("essse filme já está na lista")
41 | return
42 | }else{
43 | filmesSalvos.push(filme);
44 | localStorage.setItem("@meusFilmes", JSON.stringify(filmesSalvos))
45 | toast.success("filme salvo com sucesso")
46 | }
47 |
48 |
49 | }
50 |
51 | if(loading){
52 | return(
53 |
54 | )
55 | }
56 | return (
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
{filme.title}
67 |
68 |
69 |
{filme.overview}
70 |
71 |
72 | Avaliação: {filme.vote_average}
73 |
74 |
80 |
81 |
82 |
83 | );
84 | }
85 |
86 | export default Sobre;
--------------------------------------------------------------------------------
/src/routes.js:
--------------------------------------------------------------------------------
1 | import {Route, BrowserRouter, Routes} from 'react-router-dom';
2 |
3 | import Home from './pages/home/home';
4 | import Sobre from './pages/sobre/sobre';
5 | import Erro from './pages/error/erro';
6 | import Fav from './pages/favoritos/favoritos';
7 |
8 | import Header from './components/header';
9 |
10 | function RouteApp(){
11 | return(
12 |
13 |
14 |
15 | } />
16 | } />
17 | } />
18 | } />
19 |
20 |
21 | );
22 | }
23 |
24 | export default RouteApp;
--------------------------------------------------------------------------------
/src/services/api.js:
--------------------------------------------------------------------------------
1 | //base da url = https://api.themoviedb.org/3/
2 | //utiliza axios
3 |
4 | //confif
5 |
6 | import axios from 'axios'
7 |
8 | const api = axios.create({
9 | baseURL: 'https://api.themoviedb.org/3/'
10 | });
11 |
12 | export default api;
--------------------------------------------------------------------------------