A web application for retrieving and displaying information about countries. Below is a brief report about the application:
Project Structure:
- The project consists of HTML, CSS, and JavaScript files.
- The HTML file (
index.html
) serves as the user interface. - The CSS file (
style.css
) defines the styling for the application. - The JavaScript file (
country.js
) contains the application logic and handles data retrieval and manipulation.
Application Flow:
-
When the web page loads (
onload="fetchData()"
), thefetchData()
function is called asynchronously to retrieve data about countries from the Restcountries API (https://restcountries.com/v3.1/all). -
The retrieved data is stored in the
countryData
array, and an array of country names (countryName
) is populated. -
The list of unique letters corresponding to the first letter of country names is generated using the
getCountryFirstletter()
function. These letters are displayed in an unordered list with class "letters" in the HTML. -
When a user clicks on one of these letters, the
showCountry()
function is triggered. It clears thecountryList
and populates it with countries whose names start with the clicked letter. -
When a user clicks on a specific country in the filtered list, the
showCountryDetails()
function is called. This function displays detailed information about the selected country, such as its official name, capital, continent, languages, population, and timezones. The information is presented in a table format. -
There is also a search feature where users can input a country name and click the "Search" button. The
getCountryInfo()
function retrieves and displays information about the searched country. -
The application provides a footer with the creator's name.
Styling:
- The application has CSS styling defined in the
style.css
file. It defines the layout, color scheme, and animations.
Responsiveness:
- The application's responsiveness is not optimal, especially for smaller screens. It does not adapt well to various screen sizes and orientations.
Usability:
- The application provides a basic and functional user interface for retrieving country information.
- It allows users to search for countries by name or browse by the first letter.
- The UI elements are straightforward, but the design could be improved for better user experience and responsiveness.
Potential Improvements:
- Enhance the responsive design using Bootstrap or other responsive frameworks to ensure compatibility with various devices and screen sizes.
- Refine the user interface to improve aesthetics and user experience.
- Add error handling for failed API requests and provide user-friendly error messages.
- Consider optimizing the code structure for maintainability and readability.
- Implement pagination or lazy loading for long lists of countries.
Conclusion: Application is a functional country information web app. It retrieves and displays data about countries and allows users to search and browse through the information. However, there is room for improvement in terms of responsiveness and user interface design. Additional features and error handling could also enhance the application's usability.