-
-
Save samuelayo/02eca2363192e4946677ea910d8bd779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./components/Total.jsx | |
import React from 'react' | |
import 'bootstrap/dist/css/bootstrap.css'; | |
export default class Total extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
let total = this.props.total.toFixed(2); | |
let tax = (this.props.total * 0.15).toFixed(2); | |
let totalIncTax = (+total + +tax).toFixed(2); | |
let mystyle = { | |
borderTop: "1px solid #ddd", | |
marginTop: "10px" | |
}; | |
return ( | |
<div style={{"marginTop": "30px", "backgroundColor":"#F6F6F6","padding": "10px"}}> | |
<h3 className="row" style={{ fontWeight: 400 }}> | |
<span className="col-6">total price:</span> | |
<span className="col-6 text-right">${total}</span> | |
</h3> | |
<h3 className="row" style={{ fontWeight: 400 }}> | |
<span className="col-6">tax (15%):</span> | |
<span className="col-6 text-right">${tax}</span> | |
</h3> | |
<h3 className="row" style={mystyle}> | |
<span className="col-6">tota inc tax:</span> | |
<span className="col-6 text-right">${totalIncTax}</span> | |
</h3> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment