package react.product; import react.ReactComponent; import react.ReactMacro.jsx; import Common; /** * A Product * @author fbarbut */ class Product extends react.ReactComponentOfProps<{productInfo:ProductInfo}> { public function new(props) { super(props); } override public function render(){ var p :ProductInfo = props.productInfo; //convert int to enum //p.unitType = Type.createEnumIndex(Common.Unit,cast p.unit); //var unit = ; var imgStyle = {width:'64px',height:'64px','backgroundImage':'url("${p.image}")'}; var divStyle = p.active ? {} : {opacity: 0.4}; return jsx('
${p.name} ${p.qt} ${Formatting.unit(p.unitType)}
${p.price} €
'); } }