From da2401cf98162db534c5133458b2b20bbb73d818 Mon Sep 17 00:00:00 2001 From: Cory House Date: Wed, 2 Mar 2016 05:58:13 -0600 Subject: [PATCH] Adding FuelSavingsForm.js which was accidentally removed. --- src/components/FuelSavingsForm.js | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/components/FuelSavingsForm.js diff --git a/src/components/FuelSavingsForm.js b/src/components/FuelSavingsForm.js new file mode 100644 index 000000000..f3a121c9b --- /dev/null +++ b/src/components/FuelSavingsForm.js @@ -0,0 +1,69 @@ +import React, {PropTypes} from 'react'; +import FuelSavingsResults from './FuelSavingsResults'; +import FuelSavingsTextInput from './FuelSavingsTextInput'; + +// Destrucuring props for brevity below. +const FuelSavingsForm = ({saveFuelSavings, calculateFuelSavings, appState}) => { + const onTimeframeChange = function (e) { + calculateFuelSavings(appState, 'milesDrivenTimeframe', e.target.value); + }; + + const fuelSavingsKeypress = function (name, value) { + calculateFuelSavings(appState, name, value); + }; + + return ( +
+

Fuel Savings Analysis

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ miles + per + +
{appState.dateModified}
+ +
+ + {appState.necessaryDataIsProvidedToCalculateSavings && } + saveFuelSavings(appState)}/> +
+ ); +}; + +FuelSavingsForm.propTypes = { + saveFuelSavings: PropTypes.func.isRequired, + calculateFuelSavings: PropTypes.func.isRequired, + appState: PropTypes.object.isRequired +}; + +export default FuelSavingsForm;