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 (){
|
render (){
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Form onSubmit={this.handleActivation}>
|
{
|
||||||
<Form.Group>
|
this.props.plants.length !== 0 ?
|
||||||
<Form.Label>Active plant:</Form.Label>
|
<Form onSubmit={this.handleActivation}>
|
||||||
<Form.Control
|
<Form.Group>
|
||||||
as="select"
|
<Form.Label>Active plant:</Form.Label>
|
||||||
type="text"
|
<Form.Control
|
||||||
id="name"
|
as="select"
|
||||||
value={this.state.name}
|
type="text"
|
||||||
onChange={this.handleChange}
|
id="name"
|
||||||
>
|
value={this.state.name}
|
||||||
<option></option>
|
onChange={this.handleChange}
|
||||||
{this.props.plants.map((plant, index) =>{
|
>
|
||||||
return <option key={index} value={plant.name}>{plant.name}</option>
|
<option></option>
|
||||||
})}
|
{this.props.plants.map((plant, index) =>{
|
||||||
</Form.Control>
|
return <option key={index} value={plant.name}>{plant.name}</option>
|
||||||
</Form.Group>
|
})}
|
||||||
<Button type={"submit"} disabled={this.state.isActivationButtonDisabled}>Activate</Button>
|
</Form.Control>
|
||||||
</Form>
|
</Form.Group>
|
||||||
|
<Button type={"submit"} disabled={this.state.isActivationButtonDisabled}>Activate</Button>
|
||||||
|
</Form>
|
||||||
|
:null
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user