activation form only appears when a plant is added
This commit is contained in:
parent
3c9b5973e8
commit
627ffd68dc
@ -54,24 +54,28 @@ class ActivatePlant extends React.Component{
|
||||
render (){
|
||||
return (
|
||||
<>
|
||||
<Form onSubmit={this.handleActivation}>
|
||||
<Form.Group>
|
||||
<Form.Label>Active plant:</Form.Label>
|
||||
<Form.Control
|
||||
as="select"
|
||||
type="text"
|
||||
id="name"
|
||||
value={this.state.name}
|
||||
onChange={this.handleChange}
|
||||
>
|
||||
<option></option>
|
||||
{this.props.plants.map((plant, index) =>{
|
||||
return <option key={index} value={plant.name}>{plant.name}</option>
|
||||
})}
|
||||
</Form.Control>
|
||||
</Form.Group>
|
||||
<Button type={"submit"} disabled={this.state.isActivationButtonDisabled}>Activate</Button>
|
||||
</Form>
|
||||
{
|
||||
this.props.plants.length !== 0 ?
|
||||
<Form onSubmit={this.handleActivation}>
|
||||
<Form.Group>
|
||||
<Form.Label>Active plant:</Form.Label>
|
||||
<Form.Control
|
||||
as="select"
|
||||
type="text"
|
||||
id="name"
|
||||
value={this.state.name}
|
||||
onChange={this.handleChange}
|
||||
>
|
||||
<option></option>
|
||||
{this.props.plants.map((plant, index) =>{
|
||||
return <option key={index} value={plant.name}>{plant.name}</option>
|
||||
})}
|
||||
</Form.Control>
|
||||
</Form.Group>
|
||||
<Button type={"submit"} disabled={this.state.isActivationButtonDisabled}>Activate</Button>
|
||||
</Form>
|
||||
:null
|
||||
}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user