diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-22 21:20:54 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:06:18 +0200 |
| commit | bf7708f658cc6299a3b775afe24459b5a808c54d (patch) | |
| tree | 227520267968759e2a2f1e29e6f3edfeb4e3cf8a /src/components/app/sidebars/topology/machine/UnitAddComponent.js | |
| parent | e722cf117d0e3ebac20237f96764fb08cab49a62 (diff) | |
Restructure component and container directories
Diffstat (limited to 'src/components/app/sidebars/topology/machine/UnitAddComponent.js')
| -rw-r--r-- | src/components/app/sidebars/topology/machine/UnitAddComponent.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/components/app/sidebars/topology/machine/UnitAddComponent.js b/src/components/app/sidebars/topology/machine/UnitAddComponent.js new file mode 100644 index 00000000..f16700df --- /dev/null +++ b/src/components/app/sidebars/topology/machine/UnitAddComponent.js @@ -0,0 +1,38 @@ +import PropTypes from "prop-types"; +import React from "react"; + +class UnitAddComponent extends React.Component { + static propTypes = { + units: PropTypes.array.isRequired, + onAdd: PropTypes.func.isRequired, + }; + + render() { + return ( + <div className="form-inline"> + <div className="form-group w-100"> + <select + className="form-control w-75 mr-1" + ref={unitSelect => this.unitSelect = unitSelect} + > + {this.props.units.map(unit => ( + <option value={unit.id} key={unit.id}> + {unit.manufacturer + " " + unit.family + " " + unit.model + " " + unit.generation} + </option> + ))} + </select> + <button + type="submit" + className="btn btn-primary" + onClick={() => this.props.onAdd(parseInt(this.unitSelect.value, 10))} + > + <span className="fa fa-plus mr-2"/> + Add + </button> + </div> + </div> + ); + } +} + +export default UnitAddComponent; |
