This is a React-based web application that displays a table of cities with infinite scroll and search functionality. Users can view detailed weather information for any city by clicking on its name. The application includes favorite cities management, and dynamic styling based on weather conditions.
- City Table: Display a list of cities with infinite scroll and search functionality.
- Favorites: Add or remove cities from favorites using heart icons.
- Weather Details: View detailed weather information for a selected city.
- Dynamic Styling: Backgrounds and icons change based on weather conditions.
- React: Frontend library for building user interfaces.
- TypeScript: Optional, for type safety (if used).
- Context API: For state management.
- Axios: For making HTTP requests.
- React Router: For routing between pages.
- CSS: For styling the application.
- OpenWeatherMap API: For fetching weather data.
- Node.js and npm installed on your machine.
- A free API key from OpenWeatherMap (https://openweathermap.org) for weather data.
-
Clone the Repository
git clone https://github.com/Phanindrababu5868/weather-app cd weather-app
-
Install Dependencies
npm install
-
Create a
.env
File Create a.env
file in the root directory of the project and add your OpenWeatherMap API key:
VITE_OPENWEATHER_API_KEY=your_api_key_here
- Run the Development Server
npm start
The application will be accessible at http://localhost:5173.
- Type the name of a city in the search box to get autocomplete suggestions.
- Click on a city name to view its weather details.
- Click the heart icon next to a city to add or remove it from your favorites.
- Navigate to the weather page by clicking on a city name to see current weather and forecasts.
├── weatherapp/
│ ├── public/
│ │ ├── icons/
│ ├── src/
│ │ ├── components/
│ │ ├── context.tsx
│ │ ├── App.jsx
│ │ ├── index.css
│ │ ├── main.jsx
│ └── index.html
│ └── package.json
│
└── README.md
Feel free to open issues or submit pull requests if you have any suggestions or improvements. Contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.
- React
- OpenWeatherMap API
- Font Awesome for icons