diff --git a/package.json b/package.json index 56e7a81..656925d 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,19 @@ "@testing-library/jest-dom": "^5.12.0", "@testing-library/react": "^11.2.7", "@testing-library/user-event": "^12.8.3", + "city": "^1.0.4", + "country-state-city": "^2.1.0", + "google-maps-react": "^2.0.6", + "moment": "^2.29.1", + "openweather-apis": "^4.4.1", "react": "^17.0.2", + "react-country-region-selector": "^3.1.0", + "react-datetime": "^3.0.4", "react-dom": "^17.0.2", + "react-open-weather": "^1.1.5", "react-scripts": "4.0.3", + "react-select-cities": "^2.0.0", + "weather-icons-react": "^1.2.0", "web-vitals": "^1.1.2" }, "scripts": { diff --git a/src/App.css b/src/App.css index 74b5e05..07a5451 100644 --- a/src/App.css +++ b/src/App.css @@ -1,5 +1,12 @@ .App { text-align: center; + background-color: #282c34; + font-size: calc(10px + 2vmin); + color: white; + min-height: 100vh; + + + } .App-logo { diff --git a/src/App.js b/src/App.js index 3784575..1e72768 100644 --- a/src/App.js +++ b/src/App.js @@ -1,23 +1,15 @@ -import logo from './logo.svg'; import './App.css'; - +import Inputcity from './component/Inputcity'; +// import Weather from './component/Weather'; +//import Weatherrr from './component/Weatherrr'; +// import Wether from './component/Wether'; function App() { return (
); } diff --git a/src/component/Inputcity.js b/src/component/Inputcity.js new file mode 100644 index 0000000..dd27153 --- /dev/null +++ b/src/component/Inputcity.js @@ -0,0 +1,47 @@ +import React, { useState } from 'react' +import Time from './Time' +import Weatherrr from './Weatherrr' +const weather = require('openweather-apis'); + +function Inputcity() { + const [cooord, setcooord] = useState({ lati: '51.5085', long: '-0.1257', cityy: 'London' }) + const [city, setcity] = useState('London') + const submit = () => { + weather.setLang('en'); + weather.setCity(`${city}`); + weather.setUnits('metric'); + weather.setAPPID('f7d454f5834522dcb92bcf5d38a1db14'); + weather.getAllWeather(function (err, info) { + if (err) { + alert('Input a valid City') + } + else { + setcooord({ lati: info.coord.lat, long: info.coord.lon, cityy: info.name }) + } + + }); + } + + const loctate = () => { + navigator.geolocation.getCurrentPosition(function (position) { + setcooord({ lati: position.coords.latitude, long: position.coords.longitude, cityy: 'Mosul' }) + }); + + } + const cityhandler = (event) => { + setcity(event.target.value) + } + return ( +