GithubHelp home page GithubHelp logo

dgendill / bread-recipe-calculator Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 237 KB

The HTML <bread-recipe-calculator> element

License: BSD 3-Clause "New" or "Revised" License

HTML 21.71% JavaScript 78.29%

bread-recipe-calculator's Introduction

<bread-recipe-calculator>

An Bread Recipe Calculator built with lit. See the demo here: https://www.dgendill.com/content/playbox/bread-hydration-calculators/

Usage

Copy dist/bread-recipe-calculator.bundled.js into your HTML project, then add a script to the head of your page.

<head>
    <script type="module" src="path/to/bread-recipe-calculator.bundled.js"></script>
</head>

You can display the calculator with markup like this...

<bread-recipe-calculator
  precision="0"
  hydration=".9"
  totalWeight="1000"
  starterWeight="230"
></bread-recipe-calculator>

<bread-recipe-calculator
  mode="getFlour"
  precision="0"
  hydration=".9"
  totalWeight="1000"
  starterWeight="230"
></bread-recipe-calculator>

<bread-recipe-calculator
  mode="getWater"
  precision="0"
  hydration=".9"
  totalWeight="1000"
  starterWeight="230"
></bread-recipe-calculator>

And style it with CSS, for example...

bread-recipe-calculator {
  max-width:99%;
  display:block;
  font-size:inherit;
  border:1px solid black;
  padding:20px ;
  margin-bottom:20px;
  text-align:right;

  --label-width:40%;
  --label-text-align:right;
  --input-width:55%;
  --button-background:none;
  --button-border:1px solid black;
  --button-padding:5px 20px;
  --button-font-size:inherit;
  --row-margin:0 0 .5em 0;
  --controls-margin: 1em 0 0 0;
  
}

Building/Development

This web component can be built by first running npm install followed by npm run dev. This will generate the distribution file bread-recipe-calculator.bundled.js in the dist folder.

If you'd like to edit the web component, you can run npm run server and navigate to http://localhost:8000/dev. After that you can edit the files in the bread-recipe-calculator.js file and it will rebuild the distribution bundle on save.

bread-recipe-calculator's People

Contributors

dgendill avatar

Watchers

James Cloos 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.