Skip to content

Commit

Permalink
Add color field to unit info sample data and reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Nov 11, 2017
1 parent 9e9c02f commit 80349bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/data/sampleData.js
Expand Up @@ -2,6 +2,7 @@ const sampleData = {
unit : {
name : "Black Widow Company",
affiliation : "wd",
color : "black",
},
pilots : [
{
Expand Down
7 changes: 6 additions & 1 deletion src/features/unitInfo/UnitInfo.jsx
Expand Up @@ -3,6 +3,7 @@ import {connect} from "react-redux";
import {Form, Dropdown, Segment} from "semantic-ui-react";

import FormEditWrapper from "common/components/FormEditWrapper";
import ColorPickerButton from "common/components/ColorPickerButton";

import {getValueFromEvent} from "common/utils/clientUtils";

Expand Down Expand Up @@ -43,7 +44,7 @@ class UnitInfo extends Component {

render() {
const {unitInfo = {}, updateUnitInfo} = this.props;
const {name, affiliation} = unitInfo;
const {name, affiliation, color} = unitInfo;

return (
<Segment attached="bottom">
Expand Down Expand Up @@ -72,6 +73,10 @@ class UnitInfo extends Component {
onChange={this.onAffiliationChanged}
/>
</Form.Field>
<Form.Field name="color">
<label>Color</label>
<ColorPickerButton value={color} />
</Form.Field>
</Form>
</Segment>
);
Expand Down
1 change: 1 addition & 0 deletions src/features/unitInfo/unitInfoReducer.js
Expand Up @@ -7,6 +7,7 @@ import {UNIT_INFO_UPDATE} from "./unitInfoConstants";
const initialState = {
name : "N/A",
affiliation : "",
color : "blue",
};

function dataLoaded(state, payload) {
Expand Down

0 comments on commit 80349bc

Please sign in to comment.