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

Julian cole #713

Open
wants to merge 4 commits into
base: main
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: 8 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@
transform: rotate(360deg);
}
}
body {
background-color: #282c34;
}
.card-container{
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 20px;
}
17 changes: 13 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import React from "react";
import "./App.css";
import NasaApi from './data';
import { Header, Cards } from './containers';



function App() {
return (
<div className="App">
<p>
Read through the instructions in the README.md file to build your NASA
app! Have fun 🚀!
</p>
<Header />
<NasaApi />

{/* <Cards /> */}
</div>




);
}

export default App;

15 changes: 15 additions & 0 deletions src/containers/Body/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { Container } from './styles';



const Body = () => {
return (
<Container>
{/* <body>Body</body> */}

</Container>
)

}
export default Body;
9 changes: 9 additions & 0 deletions src/containers/Body/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import styled from 'styled-components';


const Container = styled.body`
background-color: #282c34;


`;
export { Container };
70 changes: 70 additions & 0 deletions src/containers/Cards/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React from 'react';
//import CardStyles from './styles';

import {
Card, CardImg, CardText, CardBody,
CardTitle, CardSubtitle
} from 'reactstrap';

const CardContainer = ({data}) => {
const { date, title, explanation, url } = data;
console.log("DATA", data)

return (
<div className="card-container">
<Card>
<CardBody>
<CardTitle>{title}</CardTitle>
<CardSubtitle>{date}</CardSubtitle>
<CardImg width = "50%" src = {url} alt = "nasa photo of the day"/>
<CardText>{explanation}</CardText>

</CardBody>


</Card>

<Card>
<CardBody>
<CardTitle>{title}</CardTitle>
<CardSubtitle>{date}</CardSubtitle>
<CardImg width = "50%" src = {url} alt = "nasa photo of the day"/>
<CardText>{explanation}</CardText>

</CardBody>


</Card>

<Card>
<CardBody>
<CardTitle>{title}</CardTitle>
<CardSubtitle>{date}</CardSubtitle>
<CardImg width = "50%" src = {url} alt = "nasa photo of the day"/>
<CardText>{explanation}</CardText>

</CardBody>


</Card>

<Card>
<CardBody>
<CardTitle>{title}</CardTitle>
<CardSubtitle>{date}</CardSubtitle>
<CardImg width = "50%" src = {url} alt = "nasa photo of the day"/>
<CardText>{explanation}</CardText>

</CardBody>


</Card>




</div>
)
}

export default CardContainer;
13 changes: 13 additions & 0 deletions src/containers/Cards/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import styled from "styled-components";



const CardStyles = styled.div`
height: 35vh;
width: 45%;
`;


export default CardStyles;


17 changes: 17 additions & 0 deletions src/containers/Header/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import HeaderStyles from './styles';
import React from 'react';

const HeaderContainer = () => {

return (


<HeaderStyles>Header</HeaderStyles>

)



}

export default HeaderContainer;
15 changes: 15 additions & 0 deletions src/containers/Header/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styled from "styled-components";



const HeaderStyles = styled.div`
background-color: lightblue;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem;

`;


export default HeaderStyles;
3 changes: 3 additions & 0 deletions src/containers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as Cards} from './Cards';
export { default as Body } from './Body';
export { default as Header } from './Header';
61 changes: 61 additions & 0 deletions src/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useState, useEffect } from "react";
import axios from 'axios';
import StyledContent from './styles';
import CardContainer from "./containers/Cards";





function NasaApi() {
const [photos, setPhotos] = useState([])

const urls= ["url1", "url2", "url3"];
// change


useEffect(() => {
// axios.all([

axios.get(
"https://api.nasa.gov/planetary/apod?api_key=faHZawcTjQQrLRXilzcZEYJDOU87wLPSehtNpb2W&date=2020-03-05 "
)
// // ])


// .then(axios((...firstresponse) =>{
// console.log(firstresponse.data);
// setPhotos(firstresponse.data);

// }))
.then(firstresponse =>{
console.log(firstresponse.data);
setPhotos(firstresponse.data);

})
.catch(err => {
console.log(err);
});
}, [])


return (
<>
<StyledContent>
<CardContainer data={photos} />





</StyledContent>


</>
)



}

export default NasaApi;
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";

ReactDOM.render(<App />, document.getElementById("root"));
ReactDOM.render(
<App />,




document.getElementById("root"));
10 changes: 10 additions & 0 deletions src/notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from cards styles {


background-color: lightblue;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem;

}
11 changes: 11 additions & 0 deletions src/styles.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import styled from "styled-components";

const StyledContent = styled.div`
display: flex;
justify-content: space-around;
align-content: center;
margin: 5% 10%;
height: 110vh;
`;

export default StyledContent;