├── src ├── sky.png ├── searchIcon.png ├── index.js ├── APIKeys.js ├── components │ ├── WeatherTitle.js │ ├── Cloudiness.js │ ├── SearchBar.js │ ├── WeatherIcon.js │ ├── TempUnitButton.js │ ├── Temperature.js │ ├── icon.js │ ├── WeatherData.js │ ├── Clock.js │ ├── OtherWeatherData.js │ └── LocationSearchBar.js ├── App.js └── index.css ├── public ├── arrow.png ├── favicon.ico ├── manifest.json └── index.html ├── package.json └── README.md /src/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrathamSingh/Weather-App/HEAD/src/sky.png -------------------------------------------------------------------------------- /public/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrathamSingh/Weather-App/HEAD/public/arrow.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrathamSingh/Weather-App/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/searchIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PrathamSingh/Weather-App/HEAD/src/searchIcon.png -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import WeatherApp from './App.js'; 4 | 5 | 6 | ReactDOM.render( 7 | , 8 | document.getElementById("root") 9 | ); -------------------------------------------------------------------------------- /src/APIKeys.js: -------------------------------------------------------------------------------- 1 | export const WeatherAPI = 'a2e51d57ee30812be414b4cc4364932b'; 2 | export const LocationSearchAPI = 3 | 'pk.eyJ1IjoicHJhdGhhbXNpbmdoMDEiLCJhIjoiY2s4anp3bThiMGlsMDNmbnd1a2ZqNXJkdiJ9.-RYR1P8euCTwUWPf0jzcxw'; 4 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /src/components/WeatherTitle.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class WeatherTitle extends React.Component { 4 | render() { 5 | return ( 6 |
7 | {this.props.city && this.props.data.main && 8 |

{this.props.city}, {this.props.data.sys.country}

9 | } 10 | {!this.props.city && this.props.data.main && 11 |

{this.props.data.name}, {this.props.data.sys.country}

12 | } 13 |
14 | ); 15 | } 16 | } 17 | 18 | export default WeatherTitle; -------------------------------------------------------------------------------- /src/components/Cloudiness.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class Cloudiness extends React.Component { 4 | render() { 5 | if(this.props.data.main) { 6 | let data = ""; 7 | let arr = this.props.data.weather[0].description.split(" "); 8 | for (let i = 0; i < arr.length; i++) { 9 | data+=arr[i][0].toUpperCase() + arr[i].slice(1) + " "; 10 | } 11 | return( 12 |
13 |

{data}

14 |
15 | ); 16 | } else return null; 17 | } 18 | } 19 | 20 | export default Cloudiness; -------------------------------------------------------------------------------- /src/components/SearchBar.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class SearchBar extends React.Component { 4 | handleSubmit = (e) => { 5 | this.props.onSubmit(e.target[0].value,e.target[1].value); 6 | e.preventDefault(); 7 | }; 8 | 9 | render() { 10 | return( 11 |
12 |
13 | 14 | 15 | 16 |
17 |
18 | ); 19 | } 20 | } 21 | 22 | export default SearchBar; -------------------------------------------------------------------------------- /src/components/WeatherIcon.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import IconId from './icon.js'; 3 | 4 | class WeatherIcon extends React.Component { 5 | render() { 6 | if(this.props.data.main && this.props.dayNight) { 7 | const id = IconId[this.props.data.weather[0].id]; 8 | const dayNight = this.props.dayNight; 9 | const url = "http://openweathermap.org/img/wn/" + id + dayNight + "@2x.png"; 10 | return( 11 |
12 | {this.props.data.weather[0].id}/ 13 |
14 | ); 15 | } else return null; 16 | } 17 | } 18 | 19 | export default WeatherIcon; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "weather", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "^16.8.6", 7 | "react-dom": "^16.8.6", 8 | "react-scripts": "3.0.1" 9 | }, 10 | "scripts": { 11 | "start": "react-scripts start", 12 | "build": "react-scripts build", 13 | "test": "react-scripts test", 14 | "eject": "react-scripts eject" 15 | }, 16 | "eslintConfig": { 17 | "extends": "react-app" 18 | }, 19 | "browserslist": { 20 | "production": [ 21 | ">0.2%", 22 | "not dead", 23 | "not op_mini all" 24 | ], 25 | "development": [ 26 | "last 1 chrome version", 27 | "last 1 firefox version", 28 | "last 1 safari version" 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/components/TempUnitButton.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class TempUnitButton extends React.Component { 4 | handleChange = () => { 5 | this.props.setUnit(); 6 | } 7 | 8 | render() { 9 | return ( 10 |
11 |

12 |
13 | 19 |
20 |

21 |
22 | ); 23 | } 24 | } 25 | 26 | export default TempUnitButton; -------------------------------------------------------------------------------- /src/components/Temperature.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class Temperature extends React.Component { 4 | render() { 5 | let temp, temp_min, temp_max; 6 | if(this.props.data.main) { 7 | let baseTemp = 1; 8 | let baseProd = 1; 9 | let unitChar = '\xB0F'; 10 | 11 | if(this.props.isCelcius) { 12 | baseTemp = 273.15 13 | unitChar = '\xB0C'; 14 | } else { 15 | baseTemp = 459.67 16 | baseProd = 1.8; 17 | } 18 | temp = String(((this.props.data.main.temp * baseProd) - baseTemp).toFixed(0)) + unitChar; 19 | temp_min = String(((this.props.data.main.temp_min * baseProd) - baseTemp).toFixed(0)) + unitChar; 20 | temp_max = String(((this.props.data.main.temp_max * baseProd) - baseTemp).toFixed(0)) + unitChar; 21 | 22 | return( 23 |
24 |

{temp}

25 | {this.props.data.main.temp_max-this.props.data.main.temp_min>3 && 26 |

{temp_min} / {temp_max}

27 | } 28 |
29 | ); 30 | } else return null; 31 | } 32 | } 33 | 34 | export default Temperature; -------------------------------------------------------------------------------- /src/components/icon.js: -------------------------------------------------------------------------------- 1 | let thunderStorm = [ 2 | 200, 3 | 201, 4 | 202, 5 | 210, 6 | 211, 7 | 212, 8 | 221, 9 | 230, 10 | 231, 11 | 232 12 | ]; 13 | 14 | let drizzle = [ 15 | 300, 16 | 301, 17 | 302, 18 | 310, 19 | 311, 20 | 312, 21 | 313, 22 | 314, 23 | 321 24 | ]; 25 | 26 | let rain = [ 27 | 500, 28 | 501, 29 | 502, 30 | 503, 31 | 504, 32 | 511, 33 | 520, 34 | 521, 35 | 522, 36 | 531 37 | ]; 38 | 39 | let snow = [ 40 | 600, 41 | 601, 42 | 602, 43 | 611, 44 | 612, 45 | 613, 46 | 615, 47 | 616, 48 | 620, 49 | 621, 50 | 622 51 | ]; 52 | 53 | let atmosphere = [ 54 | 701, 55 | 711, 56 | 721, 57 | 731, 58 | 741, 59 | 751, 60 | 761, 61 | 762, 62 | 771, 63 | 781 64 | ]; 65 | 66 | let Icon={}; 67 | for (const key of thunderStorm) { 68 | Icon[key]='11'; 69 | } 70 | 71 | for (const key of drizzle) { 72 | Icon[key]='09'; 73 | } 74 | 75 | for (const key of rain) { 76 | if(key<511) { 77 | Icon[key]='10'; 78 | } else if(key===511) { 79 | Icon[key]='13'; 80 | } else { 81 | Icon[key]='09'; 82 | } 83 | } 84 | 85 | for (const key of snow) { 86 | Icon[key]='13'; 87 | } 88 | 89 | for (const key of atmosphere) { 90 | Icon[key]='50'; 91 | } 92 | 93 | Icon[800]='01'; 94 | Icon[801]='02'; 95 | Icon[802]='03'; 96 | Icon[803]='04'; 97 | Icon[804]='04'; 98 | 99 | export default Icon; -------------------------------------------------------------------------------- /src/components/WeatherData.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { WeatherAPI } from '../APIKeys.js'; 3 | 4 | class WeatherData extends React.Component { 5 | 6 | getMyLocation = () => { 7 | let location = null; 8 | let latitude = null; 9 | let longitude = null; 10 | if (window.navigator && window.navigator.geolocation) { 11 | location = window.navigator.geolocation 12 | } 13 | if (location){ 14 | location.getCurrentPosition( (position) => { 15 | latitude = (position.coords.latitude); 16 | longitude = (position.coords.longitude); 17 | this.props.setLatLong(latitude, longitude); 18 | this.props.setCity(this.props.data.feature); 19 | // localStorage.setItem('cityName', this.props.data.name); 20 | }); 21 | } 22 | } 23 | 24 | newData = (data) => { 25 | this.props.newData(data); 26 | } 27 | 28 | fetchDataByGeo = (latitude,longitude) => { 29 | const url = 'https://api.openweathermap.org/data/2.5/weather?lat=' + latitude + '&lon=' + longitude + '&appid=' + WeatherAPI; 30 | fetch(url) 31 | .then(results => results.json()) 32 | .then((wdata) => { 33 | this.newData(wdata); 34 | }); 35 | } 36 | 37 | componentDidMount() { 38 | if(!this.props.latitude) { 39 | this.getMyLocation(); 40 | 41 | } 42 | 43 | } 44 | 45 | 46 | componentDidUpdate(prevProps) { 47 | if (this.props.latitude !== prevProps.latitude || this.props.longitude !== prevProps.longitude) { 48 | this.fetchDataByGeo(this.props.latitude,this.props.longitude); 49 | } 50 | } 51 | 52 | render() { 53 | return null; 54 | } 55 | } 56 | 57 | export default WeatherData; -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 23 | Weather App 24 | 25 | 26 | 27 |
28 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/components/Clock.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | class Clock extends React.Component { 4 | constructor(props) { 5 | super(props); 6 | this.state = { 7 | date: new Date(), 8 | }; 9 | } 10 | tick = (timezone) => { 11 | this.setState({ 12 | date: this.getTime(timezone), 13 | }); 14 | } 15 | getTime = (offset) => { 16 | let d = new Date(); 17 | let localTime = d.getTime(); 18 | let localOffset = d.getTimezoneOffset() * 60000; 19 | 20 | // obtain UTC time in msec 21 | let utc = localTime + localOffset; 22 | // create new Date object for different city 23 | // using supplied offset 24 | let nd = new Date(utc + (1000*offset)); 25 | if(nd.getHours()>18 || (nd.getHours()>=0 && nd.getHours()<=4)) { 26 | this.props.day_Night('n'); 27 | } else { 28 | this.props.day_Night('d'); 29 | } 30 | return nd; 31 | }; 32 | 33 | componentDidMount() { 34 | this.timerID = setInterval( 35 | () => this.tick(this.props.data.timezone), 36 | 1000 37 | ); 38 | } 39 | 40 | render() { 41 | let hours = this.state.date.getHours(); 42 | let minutes = this.state.date.getMinutes(); 43 | let seconds = this.state.date.getSeconds(); 44 | if (minutes < 10) { 45 | minutes = '0' + minutes; 46 | } 47 | if (seconds < 10) { 48 | seconds = '0' + seconds; 49 | } 50 | let ampm = 'am'; 51 | if (hours > 12) { 52 | hours = hours - 12; 53 | ampm = 'pm'; 54 | } else if (hours === 0) { 55 | hours = 12; 56 | ampm = 'am' 57 | } else if (hours === 12) { 58 | ampm = 'pm' 59 | } 60 | if(this.props.data.main) { 61 | return ( 62 |
63 |

{hours}:{minutes}:{seconds} {ampm}

64 |
65 | ); 66 | } else return null; 67 | } 68 | } 69 | 70 | export default Clock; -------------------------------------------------------------------------------- /src/components/OtherWeatherData.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { transform } from '@babel/core'; 3 | 4 | class OtherWeatherData extends React.Component { 5 | getSunsetSunRise = (timestamp) => { 6 | let date = new Date(timestamp*1000); 7 | let time = date.getTime(); 8 | let localOffset = date.getTimezoneOffset() * 60000; 9 | let utc = time + localOffset; 10 | let nd = new Date(utc + (1000*this.props.data.timezone)); 11 | return nd; 12 | } 13 | 14 | formatTime = (date) => { 15 | let hours = date.getHours(); 16 | let minutes = date.getMinutes(); 17 | //let seconds = date.getSeconds(); 18 | if (minutes < 10) { 19 | minutes = '0' + minutes; 20 | } 21 | let ampm = 'am'; 22 | if (hours > 12) { 23 | hours = hours - 12; 24 | ampm = 'pm'; 25 | } else if (hours === 0) { 26 | hours = 12; 27 | ampm = 'am' 28 | } else if (hours === 12) { 29 | ampm = 'pm' 30 | } 31 | return hours + ":" + minutes + " " + ampm; 32 | } 33 | 34 | render() { 35 | if(this.props.data.main) { 36 | let sunrise = this.props.data.sys.sunrise; 37 | let sunset = this.props.data.sys.sunset; 38 | let transform = { 39 | transform: 'rotate(' + (this.props.data.wind.deg + 90) + 'deg)', 40 | }; 41 | return( 42 |
43 |
44 |

{this.props.data.wind.speed} m/s

45 | direction 46 |

Wind

47 |
48 |
49 |
50 |

{(this.props.data.visibility/1609.344).toFixed(2)} MI

51 |

Visibility

52 | 53 |

{this.props.data.main.pressure/1000} Pa

54 |

Pressure

55 |
56 |
57 |

{this.props.data.main.humidity} %

58 |

Humidity

59 |
60 |
61 |

{this.formatTime(this.getSunsetSunRise(sunrise))}

62 |

Sunrise

63 |
64 |
65 |

{this.formatTime(this.getSunsetSunRise(sunset))}

66 |

Sunset

67 |
68 |
69 |
70 |
71 |
72 | ); 73 | } else return null; 74 | } 75 | } 76 | 77 | export default OtherWeatherData; -------------------------------------------------------------------------------- /src/components/LocationSearchBar.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { LocationSearchAPI } from '../APIKeys.js'; 3 | 4 | class LocationSearchBar extends React.Component { 5 | constructor(props) { 6 | super(props); 7 | this.state = { 8 | data : null, 9 | queryText: "", 10 | showList: false, 11 | }; 12 | } 13 | 14 | handleChange = (e) => { 15 | if(e.target.value.length>0) { 16 | this.setState({ 17 | queryText: e.target.value, 18 | showList: true, 19 | }); 20 | this.fetchDataByText(e.target.value); 21 | } else { 22 | this.setState({ 23 | data: null, 24 | queryText: "", 25 | }); 26 | } 27 | }; 28 | 29 | toggleDropdown = (showList) => { 30 | this.setState({showList}); 31 | } 32 | 33 | handleClick = (featureIndex) => { 34 | let features = this.state.data.features[featureIndex]; 35 | let longitude = features.geometry.coordinates[0]; 36 | let latitude = features.geometry.coordinates[1]; 37 | this.props.setLatLong(latitude,longitude); 38 | this.setState({queryText: features.text}); 39 | this.toggleDropdown(false); 40 | this.props.setCity(features.text); 41 | } 42 | 43 | handleBlur = () => { 44 | setTimeout(() => { 45 | this.toggleDropdown(false); 46 | },100) 47 | } 48 | 49 | fetchDataByText = (queryText) => { 50 | const url = 'https://api.mapbox.com/geocoding/v5/mapbox.places/'+queryText+'.json?access_token=' + LocationSearchAPI; 51 | fetch(url) 52 | .then(results => results.json()) 53 | .then((sdata) => { 54 | this.setState({ 55 | data : sdata, 56 | }); 57 | }); 58 | } 59 | 60 | render() { 61 | return ( 62 |
63 |
64 | 67 | {this.state.showList && 68 |
    69 | {/* {options} */} 70 | {this.state.data && this.state.data.features && this.state.data.features.length > 0 && 71 | this.state.data.features.map((data, index) => { 72 | return ( 73 |
  • { 76 | this.handleClick(index) 77 | }} 78 | > 79 | {data["place_name"]} 80 |
  • 81 | ) 82 | }) 83 | } 84 |
85 | } 86 |
87 |
88 | ); 89 | } 90 | } 91 | 92 | 93 | 94 | export default LocationSearchBar; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './index.css'; 3 | 4 | //Components 5 | import LocationSearchBar from './components/LocationSearchBar.js'; 6 | import TempUnitButton from './components/TempUnitButton.js'; 7 | import WeatherTitle from './components/WeatherTitle.js'; 8 | import Clock from './components/Clock.js'; 9 | import Cloudiness from './components/Cloudiness.js'; 10 | import WeatherIcon from './components/WeatherIcon.js'; 11 | import Temperature from './components/Temperature.js'; 12 | import OtherWeatherData from './components/OtherWeatherData.js'; 13 | import WeatherData from './components/WeatherData.js'; 14 | //Components 15 | 16 | class WeatherApp extends React.Component { 17 | constructor(props) { 18 | super(props); 19 | 20 | this.state = { 21 | latitude: null, 22 | longitude: null, 23 | data: "", 24 | dayNight: "", 25 | city: "", 26 | isCelcius: Boolean(localStorage.getItem('tempUnit')) || false, 27 | }; 28 | } 29 | 30 | setUnit = () => { 31 | if(this.state.isCelcius) { 32 | this.setState({ 33 | isCelcius: false, 34 | }); 35 | localStorage.setItem('tempUnit', ''); 36 | } else { 37 | this.setState({ 38 | isCelcius: true, 39 | }); 40 | localStorage.setItem('tempUnit', '1'); 41 | } 42 | 43 | } 44 | 45 | setCity = (city) => { 46 | this.setState({ 47 | city: city, 48 | }) 49 | } 50 | 51 | setLatLong = (latitude,longitude) => { 52 | this.setState({ 53 | latitude: latitude, 54 | longitude: longitude, 55 | }); 56 | }; 57 | 58 | newData = (data) => { 59 | this.setState({ 60 | data: data, 61 | }) 62 | } 63 | 64 | day_Night = (time) => { 65 | this.setState({ 66 | dayNight: time, 67 | }) 68 | } 69 | 70 | render() { 71 | return( 72 |
73 | 81 | 82 | 83 | {(this.state.data.main)!==undefined || 84 |
85 | } 86 | {this.state.data.main && 87 |
88 | 89 |
90 |
91 | 92 | 96 | 97 | 100 |
101 |
102 | 103 |
104 |
105 |
106 | } 107 |
108 | ); 109 | } 110 | } 111 | 112 | export default WeatherApp; -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0px; 3 | height: 100vh; 4 | background-image: url('./sky.png'); 5 | background-repeat: no-repeat; 6 | background-size: cover; 7 | } 8 | 9 | #root { 10 | padding-top: 20px; 11 | } 12 | 13 | .locationSearchBar{ 14 | text-align: center; 15 | cursor: pointer; 16 | } 17 | 18 | .location-search-container{ 19 | display: inline-block; 20 | position: relative; 21 | text-align: left; 22 | width: 50%; 23 | } 24 | 25 | .locationSearchBar input[type=text] { 26 | cursor: pointer; 27 | border: 0px; 28 | font-size: 16px; 29 | background-color: transparent; 30 | padding: 9px 10px; 31 | border-bottom: 1px solid #ccc; 32 | outline: none; 33 | color: #fff; 34 | width: 100%; 35 | cursor: text; 36 | } 37 | .locationSearchBar input[type=text]::-webkit-input-placeholder { /* Edge */ 38 | color: #fff; 39 | } 40 | 41 | .searchList { 42 | margin-top: 2px; 43 | position: absolute; 44 | padding: 0px; 45 | list-style: none; 46 | background-color: #fff; 47 | z-index: 22; 48 | border-radius: 5px; 49 | width: 100%; 50 | 51 | } 52 | 53 | .options { 54 | border-bottom: 1px solid black; 55 | border-radius: 5px; 56 | padding: 10px 30px; 57 | max-width: 100%; 58 | overflow: auto; 59 | } 60 | .options:hover{ 61 | background-color: #00b7ff; 62 | color: #fff; 63 | } 64 | 65 | .switchContainer input{ 66 | display: none; 67 | } 68 | 69 | .slider { 70 | width: 70px; 71 | height: 36px; 72 | border-radius: 34px; 73 | background-color: black; 74 | transition: background-color 0.4s; 75 | cursor: pointer; 76 | } 77 | 78 | .circle { 79 | width: 30px; 80 | height: 30px; 81 | border-radius: 34px; 82 | position: relative; 83 | top: 8%; 84 | left: 4%; 85 | background-color: #57BB00; 86 | } 87 | 88 | input[type="checkbox"].switch:checked + .slider > .circle { 89 | -webkit-transform: translate3d(35px, 0, 0); 90 | transform: translate3d(35px, 0, 0); 91 | } 92 | 93 | .unitConverter { 94 | position: relative; 95 | display: flex; 96 | flex-direction: row; 97 | justify-content: space-between; 98 | align-items: center; 99 | float: right; 100 | padding-right: 115px; 101 | padding-top: 10px; 102 | } 103 | 104 | .tempUnit{ 105 | font-size: 1.5em; 106 | margin: 0px; 107 | padding: 0 10px; 108 | } 109 | 110 | .Container { 111 | padding: 80px 100px; 112 | color: whitesmoke; 113 | } 114 | 115 | .weatherTitle { 116 | font-size: 1.3em; 117 | color: #2c2e2f; 118 | } 119 | 120 | .icon { 121 | display: inline-block; 122 | } 123 | 124 | .icon img { 125 | width: 200px; 126 | margin: -10px -10px -70px -40px; 127 | } 128 | 129 | .temp { 130 | 131 | text-align: center; 132 | display: inline-block; 133 | vertical-align: baseline; 134 | width: 200px; 135 | color: #fff; 136 | } 137 | 138 | .temp h1 { 139 | font-size: 3em; 140 | margin: 0px; 141 | padding: 0px; 142 | } 143 | 144 | .cloudiness { 145 | font-size: 1.5em; 146 | } 147 | 148 | .info-section{ 149 | display: flex; 150 | align-items: flex-start; 151 | flex-direction: row; 152 | justify-content: space-between; 153 | } 154 | 155 | .leftBlock{ 156 | width: 60%; 157 | font-family: 'Fira Sans', sans-serif; 158 | color: rgb(77, 69, 69); 159 | } 160 | 161 | .right-section { 162 | width: 40%; 163 | font-family: 'Fira Sans', sans-serif; 164 | color: rgb(77, 69, 69); 165 | font-size: 0.9em; 166 | } 167 | 168 | .otherWeatherData h1{ 169 | margin-bottom: 3px; 170 | padding: 0px; 171 | } 172 | 173 | .otherWeatherData h2{ 174 | margin-bottom: 1px; 175 | padding: 0px; 176 | margin-top: 0px ; 177 | } 178 | 179 | .windSpeed{ 180 | padding-left: 10px; 181 | border-bottom: 2px solid #c4c0c0; 182 | padding-right: 10px; 183 | margin-bottom: 10px; 184 | padding-bottom: 5px; 185 | } 186 | 187 | .windSpeed h1{ 188 | display: inline-block; 189 | } 190 | 191 | .windSpeed img{ 192 | padding-left: 20px; 193 | vertical-align: bottom; 194 | } 195 | 196 | .weatherInfoContainer{ 197 | display: flex; 198 | align-items: flex-start; 199 | flex-direction: row; 200 | justify-content: space-between; 201 | } 202 | 203 | .right_block{ 204 | width: 50%; 205 | padding-right: 10px; 206 | } 207 | 208 | .left_block { 209 | padding-left: 10px; 210 | } 211 | 212 | .setRise{ 213 | display: flex; 214 | justify-content: space-between; 215 | } 216 | 217 | .lds-hourglass { 218 | display: block; 219 | width: 64px; 220 | height: 64px; 221 | padding: 200px 0px; 222 | margin: auto; 223 | } 224 | .lds-hourglass:after { 225 | content: " "; 226 | display: block; 227 | border-radius: 50%; 228 | width: 0; 229 | height: 0; 230 | margin: 6px; 231 | box-sizing: border-box; 232 | border: 26px solid #fff; 233 | border-color: #fff transparent #fff transparent; 234 | animation: lds-hourglass 1.2s infinite; 235 | } 236 | @keyframes lds-hourglass { 237 | 0% { 238 | transform: rotate(0); 239 | animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); 240 | } 241 | 50% { 242 | transform: rotate(900deg); 243 | animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); 244 | } 245 | 100% { 246 | transform: rotate(1800deg); 247 | } 248 | } 249 | --------------------------------------------------------------------------------