Skip to content

dfratte/temperature-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Temperature Converter build

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.

How It Works

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.

Basic architecture diagram

  1. User Input: The user selects the input temperature scale (Celsius, Fahrenheit, or Kelvin) and enters the temperature value they want to convert.

  2. 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
  3. Display Results: The converted temperature values are then displayed to the user.

How to Use

To use the temperature converter, follow these steps:

  1. Select the input temperature scale.
  2. Enter the temperature value you want to convert.
  3. The converted temperature values will automatically be displayed in the other two temperature scales.

Installation

  1. Clone the repository:

    git clone https://github.com/<username>/<repository>.git

    Replace <username> and <repository> with your GitHub username and repository name.

  2. Navigate to the project directory:

    cd <repository>
  3. Install the dependencies:

    npm install
  4. Start the application:

    npm start

The application will start on http://localhost:3000.

Testing

To run the tests, use the following command:

npm test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors