Skip to content
Permalink
Browse files

Basic functional app

  • Loading branch information...
StoneCypher committed Apr 6, 2015
1 parent f79ea4e commit 10eb7abe8bf5eefed7d58eb82829b24a98b9f664
Showing with 14 additions and 4 deletions.
  1. +14 −4 TipCalcPanel.jsx
@@ -1,10 +1,20 @@

var TipCalcPanel = flocks.createClass({

fmt: function(Tip) {
return ((this.fctx.bill || 0) * Tip).toFixed(2);
},

setTotal: function(Becomes) {
var fset = this.fset,
fmt = this.fmt;
return function() { fset('total', fmt(Becomes)); };
},

update: function() {
var NewBill = parseFloat(document.getElementById('billAmount').value);
this.fset('bill', NewBill);
this.fset('total', NewBill); // TEMPORARY AND WRONG
this.fset('total', '');
},

render: function() {
@@ -18,9 +28,9 @@ var TipCalcPanel = flocks.createClass({
</label>

<div id="howHappy">
<input type="button" value={"25%"}/>
<input type="button" value={"20%"}/>
<input type="button" value={"15%"}/>
<input type="button" value={"25%"} onClick={this.setTotal(1.25)}/>
<input type="button" value={"20%"} onClick={this.setTotal(1.20)}/>
<input type="button" value={"15%"} onClick={this.setTotal(1.15)}/>
</div>

<div id="result">

0 comments on commit 10eb7ab

Please sign in to comment.
You can’t perform that action at this time.