The goal of this challenge is to build a single page web application for weather forecast. Application should be built with vanilla HTML, CSS and JS technologies and should work in all major browsers.
This application should display 7 day weather forecast for the desired city in Croatia.
- Page consists of header and body.
- Body consists of form for city selection and 7 day weather forecast for selected city.
- If there is no city selected, usage text should be displayed instead of weather forecast, e.g. "Enter a city name and press the button to retrieve 7 day weather forecast."
- If there is no data for the requested city or any other API error, appropriate message should be displayed instead of weather forecast.
- Form for the city selection consists of text input field and submit button.
- It should be possible to submit form by pressing the enter key.
- Form submission should be prevented if the input field is empty.
- Weather forecast consists of city name and 7 boxes where each box contains weather information for the specific day.
- First box shows information about current day.
- Each box consists of title, minimum, maximum and average temperature (in Celsius).
- The title should contain week day and date, e.g.
Monday, 17.06.19
.
Design and graphical assets are located in the assets
folder.
Fonts used are Roboto and Roboto Condensed, where base font size is 16pt and line height is 24pt.
Elements of the application which are not provided in the design can be implemented in any desired way.
- The application should have a favicon and title, where favicon should be created from the provided logo image.
- The application should be responsive, i.e. the user should be able to use application on a mobile phone without zoom actions. It's up to the developer how the design is going to be transformed on smaller screens.
- Weather forecast data should be retrieved with HTTP GET request (HTTP REST API). See Appendix A.
- The application should work in modern browsers, i.e. Chrome 70+, Edge 18+, Firefox 70+ and Safari 12.1+.
- Image files should be optimized (minified).
- Minified CSS and JS files should be placed alongside source files. For example, alongside
style.css
should bestyle.min.css
which contains the minified source of the original file. - All files should have Unix line endings and should be encoded in UTF-8.
- Clean and consistent coding style.
- Semantic HTML without CSS and JS.
- Each selector should appear only once in the CSS source file.
- JS code should be organized into functions.
One should register on Weatherbit to get a free API key.
Weather forecast for 7 days should be extracted from the endpoint which provides a 16 day forecast for the requested city. The official documentation for the endpoint can be found at the Weatherbit website.
# Get 16 day weather forecast for Zagreb in JSON format
GET http://api.weatherbit.io/v2.0/forecast/daily?city=Zagreb,HR&key=API_KEY
Relevant properties:
- city_name
- data[i].valid_date
- data[i].temp
- data[i].max_temp
- data[i].min_temp
This project is licensed under the terms of the MIT license.