Skip to content

Commit

Permalink
Merge pull request #13 from master-diet/MASTERDIET-FIX
Browse files Browse the repository at this point in the history
MASTERDIET-FIX - Start form fixes
  • Loading branch information
RafisSomeone authored Aug 2, 2020
2 parents c4a0fb5 + b03f702 commit 88a5e74
Show file tree
Hide file tree
Showing 7 changed files with 450 additions and 380 deletions.
2 changes: 1 addition & 1 deletion src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Alert from 'react-s-alert'
import 'react-s-alert/dist/s-alert-default.css'
import 'react-s-alert/dist/s-alert-css-effects/slide.css'
import './App.css'
import Start from '../form/Start'
import Start from '../start/Start'
import BMICalculator from '../calculator/bmi/BMICalculator'
import ProductBrowser from '../productBrowser/ProductBrowser'
import ActivityBrowser from '../productBrowser/ActivityBrowser'
Expand Down
18 changes: 16 additions & 2 deletions src/diary/AddDiaryEntryComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ class AddDiaryEntryComponent extends React.Component {
}

handleMealTimeChange = mealTime => {
console.log(mealTime)
this.setState({ mealTime: mealTime })
}

handleMealTypeChange = mealType => {
console.log(mealType)
this.setState({ mealType: mealType })
}

handleAmountChange = amount => {
this.setState({ amount: amount })
}

handlePortionChange = portion => {
this.setState({ portion: portion })
}

handlePortionUnitChange = (event, portionUnit) => {
this.setState({ portionUnit: portionUnit })
}
Expand Down Expand Up @@ -137,6 +143,10 @@ class AddDiaryEntryComponent extends React.Component {
<label htmlFor="portion">Portion size</label>
<Field type="text"
name="portion"
value={this.state.portion}
onChange={e => {
this.handlePortionChange(e.target.value)
}}
placeholder="Enter the portion size"
className={`form-control ${touched.portion && errors.portion ? 'is-invalid' : ''}`}
/>
Expand All @@ -150,6 +160,10 @@ class AddDiaryEntryComponent extends React.Component {
<label htmlFor="amount">Amount of portions</label>
<Field type="text"
name="amount"
value={this.state.amount}
onChange={e => {
this.handleAmountChange(e.target.value)
}}
placeholder="Enter the amount of portions"
className={`form-control ${touched.amount && errors.amount ? 'is-invalid' : ''}`}
/>
Expand Down
Loading

0 comments on commit 88a5e74

Please sign in to comment.