This application is a simple temperature converter built with React. It allows users to convert temperatures between Celsius, Fahrenheit, and Kelvin. It is a sample app to be used in the context of a CI/CD workshop organized by @dfratte.
The application consists of a single React component that manages the entire conversion process. We simulate the call to an independent service to do the actual conversion. That logic is contained in the TemperatureConverter.js file.
-
User Input: The user selects the input temperature scale (Celsius, Fahrenheit, or Kelvin) and enters the temperature value they want to convert.
-
Temperature Conversion: When the user enters a temperature value, the application automatically converts this value to the other two temperature scales. The conversion formulas are as follows:
- Celsius to Fahrenheit:
(celsius * 9/5) + 32 - Celsius to Kelvin:
celsius + 273.15 - Fahrenheit to Celsius:
(fahrenheit - 32) * 5/9 - Fahrenheit to Kelvin:
((fahrenheit - 32) * 5/9) + 273.15 - Kelvin to Celsius:
kelvin - 273.15 - Kelvin to Fahrenheit:
((kelvin - 273.15) * 9/5) + 32
- Celsius to Fahrenheit:
-
Display Results: The converted temperature values are then displayed to the user.
To use the temperature converter, follow these steps:
- Select the input temperature scale.
- Enter the temperature value you want to convert.
- The converted temperature values will automatically be displayed in the other two temperature scales.
-
Clone the repository:
git clone https://github.com/<username>/<repository>.git
Replace
<username>and<repository>with your GitHub username and repository name. -
Navigate to the project directory:
cd <repository>
-
Install the dependencies:
npm install
-
Start the application:
npm start
The application will start on http://localhost:3000.
To run the tests, use the following command:
npm test