diff --git a/.gitignore b/.gitignore
index 4d29575..d5c07ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,7 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+
+# IDE
+.vscode
+*.code-workspace
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 85454e7..8981cc7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,6 +13,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-icons": "^4.7.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}
@@ -14123,6 +14124,14 @@
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
},
+ "node_modules/react-icons": {
+ "version": "4.7.1",
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.7.1.tgz",
+ "integrity": "sha512-yHd3oKGMgm7zxo3EA7H2n7vxSoiGmHk5t6Ou4bXsfcgWyhfDKMpyKfhHR6Bjnn63c+YXBLBPUql9H4wPJM6sXw==",
+ "peerDependencies": {
+ "react": "*"
+ }
+ },
"node_modules/react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
@@ -26904,6 +26913,12 @@
"resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.11.tgz",
"integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg=="
},
+ "react-icons": {
+ "version": "4.7.1",
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.7.1.tgz",
+ "integrity": "sha512-yHd3oKGMgm7zxo3EA7H2n7vxSoiGmHk5t6Ou4bXsfcgWyhfDKMpyKfhHR6Bjnn63c+YXBLBPUql9H4wPJM6sXw==",
+ "requires": {}
+ },
"react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
diff --git a/package.json b/package.json
index 5afbe4b..9769677 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,7 @@
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-icons": "^4.7.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
diff --git a/src/App.js b/src/App.js
index 99bd8f3..3717b11 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,16 +1,17 @@
-import React, { useCallback } from 'react';
-import { useState, useEffect } from 'react';
+import React, { useCallback } from "react";
+import { useState, useEffect } from "react";
-import Weather from './components/Weather';
-import LoadingIndicator from './UI/LoadingIndicator';
+import Weather from "./components/Weather";
+import LoadingIndicator from "./UI/LoadingIndicator";
+import { BsFillGeoAltFill } from "react-icons/bs";
-import './app.css';
+import "./app.css";
function App() {
const [data, setData] = useState(null);
const [place, setPlace] = useState(null);
- const [search, setSearch] = useState('');
- const [location, setLocation] = useState('');
+ const [search, setSearch] = useState("");
+ const [location, setLocation] = useState("");
const [isLoading, setIsLoading] = useState(false);
function handleSearch(e) {
@@ -18,7 +19,7 @@ function App() {
}
async function geoHandler() {
- setSearch('');
+ setSearch("");
setIsLoading(true);
await navigator.geolocation.getCurrentPosition((position) => {
const crd = position.coords;
@@ -30,10 +31,10 @@ function App() {
const fetchData = useCallback(async (search, location) => {
const options = {
- method: 'GET',
+ method: "GET",
headers: {
- 'X-RapidAPI-Key': '0173291af0msh62b3ca25953f210p13d732jsn66b4d9f97708',
- 'X-RapidAPI-Host': 'weatherapi-com.p.rapidapi.com',
+ "X-RapidAPI-Key": "0173291af0msh62b3ca25953f210p13d732jsn66b4d9f97708",
+ "X-RapidAPI-Host": "weatherapi-com.p.rapidapi.com",
},
};
const url = `https://weatherapi-com.p.rapidapi.com/current.json?q=${
@@ -52,34 +53,30 @@ function App() {
});
}, [location, search, fetchData]);
- let display = data ? (
-
no data found 😬
- ); - return ( <>or
-{props.place.name}
+{props.place.region}
+