Skip to content

Commit

Permalink
Retornando o primeiro objeto
Browse files Browse the repository at this point in the history
  • Loading branch information
Benevanio committed Feb 26, 2023
1 parent 7cf7bea commit fe0bd4a
Show file tree
Hide file tree
Showing 15 changed files with 158 additions and 57 deletions.
22 changes: 22 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 @@ -10,6 +10,7 @@
"react-dom": "^18.2.0",
"react-router-dom": "^6.8.1",
"react-scripts": "5.0.1",
"sass": "^1.58.3",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
Binary file added public/Logo/Nasa.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/favicon.ico
Binary file not shown.
33 changes: 5 additions & 28 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="Logo/Nasa.gif" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
content="Bene Tesla dev"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
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>React App</title>

<title>✨Astro Api✨</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

11 changes: 10 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@

import './App.css';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import Navbar from './components/Navbar';
import Home from './components/Home';
import Nasa from './components/Nasa';

function App() {
return (
<div className="App">
<Navbar />
<BrowserRouter>
<Routes>
<Route path="/" exact element={<Home />} />
<Route path="/nasa" element={<Nasa />} />
<Route path="/navbar" element={<Navbar />} />
</Routes>
</BrowserRouter>
</div>
);
}
Expand Down
Binary file added src/Img/NasaApi.jfif
Binary file not shown.
15 changes: 15 additions & 0 deletions src/components/Home.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react'
import { Link } from 'react-router-dom'
import './Home.scss'
const Home = () => {
return (
<div>
<Link to="/nasa">
<i className="fas fa-rocket"> </i>
<h1> Nasa</h1>
</Link>
</div>
)
}

export default Home
67 changes: 67 additions & 0 deletions src/components/Home.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius:5px;
background: linear-gradient(145deg, #cacaca, #f0f0f0);
box-shadow: 20px 20px 60px #bebebe,
-20px -20px 60px #ffffff;
color: white;
font-size: calc(10px + 2vmin);
text-align: center;

.card {
width: 100%;
max-width: 500px;
margin: 20px;
padding: 20px;
border-radius: 50px;
background: linear-gradient(145deg, #f0f0f0, #cacaca);
box-shadow: 20px 20px 60px #bebebe,
-20px -20px 60px #ffffff;
color: #000;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);

img {
width: 100%;
margin-bottom: 20px;
}

.title {
font-size: 1.5rem;
margin-bottom: 20px;
}

.description {
font-size: 1rem;
margin-bottom: 20px;
}

.link {
text-decoration: none;
color: #000;
font-size: 1rem;
margin-bottom: 20px;
}
}
}

@media screen and (max-width: 768px) {
.container {
.card {
width: 100%;
max-width: 500px;
margin: 20px;
padding: 20px;
border-radius: 50px;
background: linear-gradient(145deg, #f0f0f0, #cacaca);
box-shadow: 20px 20px 60px #bebebe,
-20px -20px 60px #ffffff;
color: #000;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
}
}
37 changes: 37 additions & 0 deletions src/components/Nasa.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { useEffect, useState } from 'react'

const Nasa = () => {
const [nasa, setNasa] = useState(null)

useEffect(() => {
getNasa()
async function getNasa() {
const res = await fetch('https://api.nasa.gov/planetary/apod?api_key=a2Szsr8EIoCS091sCRc2ztF5DT2R14EDu9gbLPha')
const data = await res.json()
setNasa(data)
}
}, [])
if (!nasa) return <div>Loading...</div>
return (
<div className='container'>
<div className='card'>
<img
src={nasa.url}
alt={nasa.title}
className='img-fluid'
/>
<div className='card-body'>
<h2 className='card-title'>{nasa.title}</h2>
<p className='card-text'>{nasa.explanation}</p>
<p className='card-text'>{nasa.date}</p>
<p className='card-text'>{nasa.media_type}</p>
<p className='card-text'>{nasa.service_version}</p>
</div>

</div>

</div>
)
}

export default Nasa
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

0 comments on commit fe0bd4a

Please sign in to comment.