Permalink
Browse files

Connect UnitInfo color button to show the ColorPickerDialog

  • Loading branch information...
markerikson committed Jul 16, 2017
1 parent ede7d5c commit 8ad59aabc2121718c49b4e040d34fa9a243e23b0
@@ -0,0 +1,7 @@
import {
openModal
} from "features/modals/modalActions";
export function showColorPicker(initialColor) {
return openModal("ColorPickerDialog", {color : initialColor});
}
@@ -8,6 +8,7 @@ import {
import {selectUnitInfo} from "../unitInfoSelectors";
import {updateUnitInfo} from "../unitInfoActions";
import {showColorPicker} from "common/components/ColorPicker/colorPickerActions";
import {getValueFromEvent} from "common/utils/clientUtils";
import FormEditWrapper from "common/components/FormEditWrapper";
@@ -30,6 +31,7 @@ const mapState = (state) => ({
const actions = {
updateUnitInfo,
showColorPicker,
};
class UnitInfo extends Component {
@@ -46,6 +48,10 @@ class UnitInfo extends Component {
this.props.updateUnitInfo(newValues);
}
onColorClicked = () => {
this.props.showColorPicker(this.props.unitInfo.color);
}
render() {
const {unitInfo, updateUnitInfo} = this.props;
@@ -80,7 +86,10 @@ class UnitInfo extends Component {
</Form.Field>
<Form.Field name="color">
<label>Color</label>
<ColorPickerButton value={color} />
<ColorPickerButton
value={color}
onClick={this.onColorClicked}
/>
</Form.Field>
</Form>
</Segment>

0 comments on commit 8ad59aa

Please sign in to comment.