Permalink
Browse files

Add an "Add New Pilot" button

  • Loading branch information...
markerikson committed Dec 29, 2017
1 parent 0af9785 commit 179cc525e699d2bab803c9a0d96d4c68786a29f1
Showing with 36 additions and 0 deletions.
  1. +32 −0 src/features/pilots/PilotDetails/PilotCommands.jsx
  2. +4 −0 src/features/pilots/Pilots/Pilots.jsx
@@ -0,0 +1,32 @@
import React from "react";
import {connect} from "react-redux";
import {Button} from "semantic-ui-react";
import {selectIsEditingPilot} from "../pilotsSelectors";
import {addNewPilot} from "../pilotsActions";
const mapState = (state) => {
const isEditingPilot = selectIsEditingPilot(state);
return {isEditingPilot};
}
const buttonWidth = 140;
const actions = {addNewPilot};
const PilotCommands = (props) => (
<Button
primary
disabled={props.isEditingPilot}
type="button"
onClick={props.addNewPilot}
style={{width : buttonWidth, marginRight : 10}}
>
Add New Pilot
</Button>
);
export default connect(mapState, actions)(PilotCommands);
@@ -8,6 +8,7 @@ import {
import PilotsList from "../PilotsList";
import PilotDetails from "../PilotDetails";
import PilotCommands from "../PilotDetails/PilotCommands";
export default class Pilots extends Component {
@@ -24,6 +25,9 @@ export default class Pilots extends Component {
<Segment >
<PilotDetails />
</Segment>
<Segment>
<PilotCommands />
</Segment>
</Grid.Column>
</Grid>
</Segment>

0 comments on commit 179cc52

Please sign in to comment.