Skip to content

Commit

Permalink
epic complete
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ-1009 committed Jan 19, 2023
1 parent 53d153f commit ed4de6c
Show file tree
Hide file tree
Showing 5 changed files with 348 additions and 34 deletions.
6 changes: 2 additions & 4 deletions components/ImageOfDay.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Head from "next/head";

import Link from "next/link";
import { useEffect, useState } from "react";
import styles from "./image-of-day.module.css";
Expand Down Expand Up @@ -40,9 +40,7 @@ export default function ImageOfDay({ title, link, desc, author, date }) {
}, []);
return (
<>
<Head>
<title>NASA&#039;s Astronomy Picture of the Day</title>
</Head>

<div className={styles["heading"]}>
NASA&#039;s Astronomy Picture of the Day
</div>
Expand Down
25 changes: 25 additions & 0 deletions components/epic.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@
font-size: 20px;
text-decoration: none;
}
.photos-wrapper{
display: flex;
gap: 20px;
overflow-x: scroll;
overflow-y: hidden;
margin-top: 50px;
}
.photos-wrapper div{
cursor: pointer;
border-radius: 7px;
width: 200px;
height: 200px;
flex-shrink: 0;
}

.photos-wrapper div img{
width: 100%;
height: 100%;
object-fit: contain;
}

@media (max-width: 972px) {
.main-wrapper {
flex-direction: column;
Expand All @@ -75,4 +96,8 @@
width: 200px;
height: 200px;
}
.photos-wrapper div{
width: 100px;
height: 100px;
}
}
252 changes: 252 additions & 0 deletions package-lock.json

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

24 changes: 17 additions & 7 deletions pages/apod.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
import { useState,useEffect } from "react";
import { useState, useEffect } from "react";
import ImageOfDay from "../components/ImageOfDay";

import Head from "next/head";
export default function Apod() {
const [details,setdetails] = useState()
const [details, setdetails] = useState();
useEffect(() => {
fetch(
`https://api.nasa.gov/planetary/apod?api_key=${process.env.NEXT_PUBLIC_API_KEY
}`
`https://api.nasa.gov/planetary/apod?api_key=${process.env.NEXT_PUBLIC_API_KEY}`
)
.then((res) => res.json())
.then((res) => {
setdetails(res)
setdetails(res);
});
}, []);
return (
<div>
<Head>
<title>NASA&#039;s Astronomy Picture of the Day</title>
</Head>
<div>
{details && <ImageOfDay author={details.copyright} link={details.url} title={details.title} desc={details.explanation} date={details.date} />}
{details && (
<ImageOfDay
author={details.copyright}
link={details.url}
title={details.title}
desc={details.explanation}
date={details.date}
/>
)}
</div>
</div>
);
Expand Down
Loading

1 comment on commit ed4de6c

@vercel
Copy link

@vercel vercel bot commented on ed4de6c Jan 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nasa-web – ./

nasa-web-phi.vercel.app
nasa-web-git-main-aj-1009.vercel.app
nasa-web-aj-1009.vercel.app

Please sign in to comment.