Skip to content

takyifidelis/BMI-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

- Body Mass Index Calculator solution

This is a solution to the Body Mass Index Calculator. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

Design preview for the Body Mass Index Calculator coding challenge

The challenge

Users should be able to:

  • Select whether they want to use metric or imperial units
  • Enter their height and weight
  • See their BMI result, with their weight classification and healthy weight range
  • View the optimal layout for the interface depending on their device's screen size
  • See hover and focus states for all interactive elements on the page

Screenshot

Desktop View Metric

Desktop View Metric

Desktop View Imperial.

Desktop View Imperial

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • jQuery - JS library
  • TypeScript - JS Compiler

What I learned

Use this section to recap over some of your major learnings while working through this project. Writing these out and providing code samples of areas you want to highlight is a great way to reinforce your own knowledge.

To see how you can add code snippets, see below:

<h1>Some HTML code I'm proud of</h1>
<input type="number" class="height-input-value ft-value" placeholder="0" min="0" required/>
/* Ways to remove the arrows in an input field*/
/* For WebKit-based browsers */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* For Mozilla Firefox */
input[type="number"]::-moz-number-spin-box {
  -moz-appearance: textfield;
}
const updateBMI = () => {
  console.log('...🎉')
}
 const updateBMI = () => {
    //Calculate THE BMI in kg and cm

    const heightInCm: number = parseFloat(inputHeight.val() as string);
    const weightInKg: number = parseFloat(inputWeight.val() as string);

    if (isNaN(heightInCm) || isNaN(weightInKg)) {
      welcomeBlock.show();
      resultBlock.hide();

      return;
    }

Useful resources

  • jQuery - This helped me with the transition. I really liked how I was switching betweeen Metric and Imperial easily.
  • The TypeScript Handbook - This is an amazing article which helped me finally understand TypeScript. I'd recommend it to anyone still learning this concept. A reader who completes the walkthrough should be able to:
    • Read and understand commonly-used TypeScript syntax and patterns
    • Explain the effects of important compiler options
    • Correctly predict type system behavior in most cases

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors