Skip to content

Commit

Permalink
alguns ajustes na organização das pastas e api funcionando e pegando …
Browse files Browse the repository at this point in the history
…os melhores filmes
  • Loading branch information
RavikFerreira committed Jun 4, 2023
1 parent df635a9 commit 89f0ff7
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 43 deletions.
29 changes: 29 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.4.0",
"dotenv": "^16.1.3",
"inspector": "^0.5.0",
"react": "^18.2.0",
Expand Down
12 changes: 6 additions & 6 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Route, Routes } from 'react-router-dom';

import './App.css';

import Login from "./components/Login/login";
import Cadastro from "./components/cadastro/cadastro"
import Home from "./components/home/home";
import Pesquisa from './components/Pesquisa/pesquisa';
import Filme from './components/filme/filme';
import NavBar from './components/home/NavBar';
import Login from './Login/login'
import NavBar from './components/NavBar/NavBar';
import Cadastro from './cadastro/cadastro';
import Home from './home/home';
import Pesquisa from './Pesquisa/pesquisa';
import Filme from './filme/filme';

function App() {
return (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions src/components/FilmeCard/FilmeCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react";

export default function FilmesCard(){

}
File renamed without changes.
File renamed without changes.
35 changes: 0 additions & 35 deletions src/components/home/home.js

This file was deleted.

File renamed without changes.
File renamed without changes.
46 changes: 46 additions & 0 deletions src/home/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React, { useEffect, useState } from "react";
import "./home.css";
import NavBar from "../components/NavBar/NavBar";
import axios from "axios";

export default function Home(){

const [melhoresFilmes, setMelhoresFilmes] = useState([]);


useEffect(() => {

const fetchFilmes = async () => {
try{
const response = await axios.get('https://api.themoviedb.org/3/movie/top_rated?',
{
params: {
api_key: "05f8482d5927ec34379002150b1c52c7",
},
});
setMelhoresFilmes(response.data.results);
}
catch (error){
console.error(error)
}
};
fetchFilmes();

},[]);

return(

<div className="backhome">
<NavBar />
<div className="filmes_container">
<h2>Melhores Filmes:</h2>
<ul>
{melhoresFilmes.length > 0 && melhoresFilmes.map((filme) => (
<li key={filme.id}>{filme.title}</li>
))}

</ul>
</div>
</div>
);
};
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import NavBar from './components/home/NavBar';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter } from 'react-router-dom';
import Home from './components/home/home';
import Home from './home/home';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
Expand Down

0 comments on commit 89f0ff7

Please sign in to comment.