stephencweiss / matilda

See your time in a whole new way. Small, lightweight, magical.
MIT License
1 stars 0 forks source link

Refactor - to pull out and be DRY re: budgetCategoryForm #19

Open stephencweiss opened 5 years ago

stephencweiss commented 5 years ago

The create/edit forms are identical basically and can be a reusable resource.

  theBudgetCategoryForm() {
    return (
      <div>
        <form className="budget-category">
          <label htmlFor="category">Category</label>
          <input
            id="category" 
            name="category" 
            value={this.state.category} 
            onChange={this.handleChange} 
            placeholder={this.props.budgetLine ? props.budgetLine.category : 'New budget category name...'}
            >
          </input>

          <label htmlFor="hoursAllocated">Hours</label>
          <input
            id="hoursAllocated"
            name="hours"
            value={this.state.hoursAllocated}
            onChange={this.handleChange}
            placeholder={this.props.budgetLine ? props.budgetLine.hours_allocated : 'Hours to allocate...'}
            >
          </input>
        </form>
      </div>
    )
  }