Giter Club home page Giter Club logo

andrewjbateman / ionic-react-scratchpad Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 664 KB

:clipboard: App to calculate the users Body Mass Index (BMI) using inputs of height and weight. Created using the Ionic 5 framework with React]. Initially Academind: Youtube video: Ionic + React - Tutorial for Beginners 2020 code but with customisations to code and styling.

License: MIT License

JavaScript 4.19% HTML 12.33% TypeScript 52.55% CSS 30.94%
ionic5 react typescript3 tutorial-code academind ionic

ionic-react-scratchpad's Introduction

โšก Ionic React Scratchpad

๐Ÿ“„ Table of contents

๐Ÿ“š General info

  • App created using Ionic CLI v5

๐Ÿ“ท Screenshots

screen print

๐Ÿ“ถ Technologies

๐Ÿ’พ Setup

  • Load dependencies using npm i,
  • To start the server on localhost://8100 type: 'ionic serve'

๐Ÿ’ป Code Examples

  • function to calculate BMI from user inputs for height & weight
const calculateBMI = () => {
  const enteredWeight = weightInputRef.current!.value;
  const enteredHeight = heightInputRef.current!.value;

  if (
    !enteredHeight ||
    !enteredWeight ||
    +enteredHeight <= 0 ||
    +enteredWeight <= 0
  ) {
    setError("Please enter a valid number");
    return;
  }

  const weightConversionFactor = calcUnits === 'ftlbs' ? 2.20 : 1;
  const heightConversionFactor = calcUnits === 'ftlbs' ? 3.28 : 1;

  const weight = +enteredWeight / weightConversionFactor;
  const height = +enteredHeight / heightConversionFactor;

  setCalculatedBmi(weight / (height * height));
};

๐Ÿ†’ Features

  • ion cards are responsive so app looks good on PC or mobile screen

๐Ÿ“‹ Status & To-do list

  • Status: working. Updated april 2021. Minor error: result card does not disappear when reset button is pressed
  • To-do: Fix reset and add functionality

๐Ÿ‘ Inspiration

๐Ÿ“ License

  • This project is licensed under the terms of the MIT license.

โœ‰๏ธ Contact

ionic-react-scratchpad's People

Contributors

andrewjbateman avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.