Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes the style issues introduced in cf9a804 according to the output from prettier. Details: https://deepsource.io/gh/dapoadedire/astro-pic-of-the-day/transform/de67e148-41dd-4bcc-9b98-aa8f4667e829/
- Loading branch information
1 parent
cf9a804
commit b8c53e1
Showing
10 changed files
with
164 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,37 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:import/errors", | ||
"plugin:react/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:react-hooks/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"react/prop-types": 0, | ||
"react/react-in-jsx-scope": 0 | ||
}, | ||
"plugins": [ | ||
"react", | ||
"jsx-a11y", | ||
"import" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2022, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:import/errors", | ||
"plugin:react/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:react-hooks/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"react/prop-types": 0, | ||
"react/react-in-jsx-scope": 0 | ||
}, | ||
"plugins": ["react", "jsx-a11y", "import"], | ||
"parserOptions": { | ||
"ecmaVersion": 2022, | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "detect" | ||
}, | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js", ".jsx"] | ||
} | ||
} | ||
"import/resolver": { | ||
"node": { | ||
"extensions": [".js", ".jsx"] | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
const Footer = () => ( | ||
<footer> | ||
<a href="https://www.google.com/search?q=Dapo+adedire" target="_blank" rel="noreferrer">Dapo Adedire</a> | ||
<ul> | ||
<li> | ||
<a href="https://www.github.com/dapoadedire" target="_blank" rel="noreferrer">Github</a> | ||
</li> | ||
<li> | ||
<a href="https://www.twitter.com/dapo_adedire" target="_blank" rel="noreferrer">Twitter</a> | ||
</li> | ||
|
||
</ul> | ||
<footer> | ||
<a | ||
href="https://www.google.com/search?q=Dapo+adedire" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Dapo Adedire | ||
</a> | ||
<ul> | ||
<li> | ||
<a | ||
href="https://www.github.com/dapoadedire" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Github | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
href="https://www.twitter.com/dapo_adedire" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
</a> | ||
</li> | ||
</ul> | ||
</footer> | ||
); | ||
|
||
</footer> | ||
) | ||
|
||
export default Footer | ||
export default Footer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,56 @@ | ||
import { useState} from "react"; | ||
import { | ||
currentDate, | ||
generateRandomDate, | ||
|
||
} from "../helpers/utils"; | ||
import { useState } from "react"; | ||
import { currentDate, generateRandomDate } from "../helpers/utils"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
|
||
import searchAPOD from "../helpers/searchAPOD"; | ||
|
||
import Result from "./Result"; | ||
import Footer from "./Footer"; | ||
|
||
|
||
|
||
|
||
|
||
|
||
const Home = () => { | ||
const todaysDate = currentDate(); | ||
const [date, setDate] = useState(todaysDate); | ||
|
||
const results = useQuery(["apod", date], searchAPOD); | ||
|
||
return( | ||
<> | ||
<main> | ||
<div className="form-container"> | ||
|
||
|
||
<form | ||
onSubmit={(e) => { | ||
e.preventDefault(); | ||
const date = e.target.date.value; | ||
setDate(date); | ||
}} | ||
> | ||
<label htmlFor="date"> | ||
<input type="date" name="date" id="date" max={todaysDate} | ||
min="1995-06-16" | ||
defaultValue={todaysDate} | ||
/> | ||
</label> | ||
<button type="submit">Search</button> | ||
</form> | ||
<div className="button"> | ||
<button onClick={ | ||
() => { | ||
const randomDate = generateRandomDate(); | ||
setDate(randomDate); | ||
} | ||
}> | ||
Random | ||
</button> | ||
</div> | ||
</div> | ||
<Result results={results} /> | ||
|
||
</main> | ||
<Footer /> | ||
|
||
return ( | ||
<> | ||
<main> | ||
<div className="form-container"> | ||
<form | ||
onSubmit={(e) => { | ||
e.preventDefault(); | ||
const date = e.target.date.value; | ||
setDate(date); | ||
}} | ||
> | ||
<label htmlFor="date"> | ||
<input | ||
type="date" | ||
name="date" | ||
id="date" | ||
max={todaysDate} | ||
min="1995-06-16" | ||
defaultValue={todaysDate} | ||
/> | ||
</label> | ||
<button type="submit">Search</button> | ||
</form> | ||
<div className="button"> | ||
<button | ||
onClick={() => { | ||
const randomDate = generateRandomDate(); | ||
setDate(randomDate); | ||
}} | ||
> | ||
Random | ||
</button> | ||
</div> | ||
</div> | ||
<Result results={results} /> | ||
</main> | ||
<Footer /> | ||
</> | ||
) | ||
|
||
} | ||
); | ||
}; | ||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
|
||
const API_KEY = import.meta.env.VITE_API_KEY | ||
|
||
const searchAPOD = async ({queryKey}) => { | ||
const date = queryKey[1]; | ||
const response = await fetch( | ||
`https://api.nasa.gov/planetary/apod?api_key=${API_KEY}&date=${date}` | ||
); | ||
if (!response.ok) { | ||
throw new Error(`HTTP error! status: ${response.status})`); | ||
} | ||
return response.json(); | ||
|
||
const API_KEY = import.meta.env.VITE_API_KEY; | ||
|
||
const searchAPOD = async ({ queryKey }) => { | ||
const date = queryKey[1]; | ||
const response = await fetch( | ||
`https://api.nasa.gov/planetary/apod?api_key=${API_KEY}&date=${date}` | ||
); | ||
if (!response.ok) { | ||
throw new Error(`HTTP error! status: ${response.status})`); | ||
} | ||
return response.json(); | ||
}; | ||
|
||
export default searchAPOD; | ||
export default searchAPOD; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.