Click the following link to view the application demo:
https://weather-app-matejvykoukal.vercel.app/
Please note that "Weather at my location" feature may not work correctly in all browers. If you want to try it please try using different browsers.
- Current weather data
- 5 Days weather forecast
- User's location weather data
- Search with autocomplete
- Deep linking - application state is stored in URL, so user is able to share the data by sending URL.
Prerequesties
Clone the repository
- Clone the repository using following script in root directory:
git clone https://github.com/MatejVykoukal/weather-app.git
Weather API credentials
-
Create your account at Open Weather Map to gain your personal API key.
-
Go to API keys section, copy your key and assing it to
REACT_APP_WEATHER_API_KEYvariable insample.env.
Address completion API credentials
-
Create your account at RapidAPI to gain your personal API key.
-
Go to API page choose free subscription plan.
-
Copy X-RapidAPI-Key and assign it to
REACT_APP_ADDRESS_API_KEYvariable insample.env. -
Copy X-RapidAPI-Host and assign it to
REACT_APP_ADDRESS_API_HOSTvariable insample.env.
.env file
- Rename
sample.envfile to.env.
Dependencies
- Install dependencies using following script in root directory:
npm install
Run the application
- Run the application using following script in root directory:
npm start
- Application is developed using React + Typescript in core.
- Weather data comes from public API - Open Weather Map.
- The is also used second public API - Address Completion to cover wider range of searchable places.
- Application states are managed using React hooks and contextAPI.
- UI is styled using TaiwindCSS.
- You can use
<Icon>component to render icons all over the app. - To see complete list of available icons check
src/components/Icon/Icon.tsxfile.
Add new icon
-
Paste svg icon into
src/svg/iconsfolder. -
Run
npm run svgcommand in the root directory.
Note: Don't forget to extend
IconTypeinsrc/components/Icon/Icon.tsxcoresponding to icon filename to prevent Typescript aletrs.
- Each component is placed in particular folder name and file named same as component.
- Component names are capitalized.
- Component is exported from idex.ts file located in the component folder.
Sample structure:
components
>Button
>index.ts
>Button.tsx
- Everything related to contextAPI is located here.
- Folder for svg icons.
- Most of types located here. Types are structured in particular files.
- Utility functions used across app are located here.
- File for storing global constants.
- Licensed uder MIT
