Giter Site home page Giter Site logo

readyplayer2 / food-traffic-light-calculator Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 177 KB

A tool to find out the traffic light labelling for food products in the UK.

License: MIT License

HTML 11.96% CSS 10.98% JavaScript 77.06%
css javascript nutrition-calculator nutrition-information reactjs

food-traffic-light-calculator's People

Contributors

jdunnin avatar readyplayer2 avatar

Watchers

 avatar  avatar

food-traffic-light-calculator's Issues

Backend API for design

routes for calculating each of the parts and returning green, orange, red (maybe with data) and encompossing routes for all in one.

Labels and text fields UI should be neater

It would be better if both labels (like Total Fat) and the corresponding text fields were aligned centrally or in some other configuaration.

The current layout looks quite messy.

MIME type text/html error

Cross-Origin Read Blocking (CORB) blocked cross-origin response https://apod.nasa.gov/apod/image/1803/AstroSoM/hudf.html with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.

Simplify logic into generic function for crunching data

  crunchSugars() {
    if (this.state.lastResult.normalsugars <= 5.0) {
      return <li className='green'>{this.state.lastResult.normalsugars}</li>
    } else if (this.state.lastResult.normalsugars <= 22.5) {
      return <li className='orange'>{this.state.lastResult.normalsugars}</li>
    } else {
      return <li className='red'>{this.state.lastResult.normalsugars}</li>
    }
  }

This type of code is duplicated and very common, it should be a generic function and pass in value to tests, range 1, range 2.

Unit tests for input / output

Add simple unit tests for sample values and expected output values + percentages.

Decide on unit testing framework.

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.