Skip to content

Commit

Permalink
disable button when flyout is open
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Apr 16, 2020
1 parent 6b11fee commit 2d3682f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function mapStateToProps(state = {}) {
isReadOnly: getIsReadOnly(state),
isLayerTOCOpen: getIsLayerTOCOpen(state),
layerList: getLayerList(state),
isAddButtonActive: getFlyoutDisplay(state) === FLYOUT_STATE.NONE,
isFlyoutOpen: getFlyoutDisplay(state) !== FLYOUT_STATE.NONE,
};
}

Expand All @@ -38,7 +38,7 @@ function mapDispatchToProps(dispatch) {
openLayerTOC: () => {
dispatch(setIsLayerTOCOpen(true));
},
openMapSettings: async flyoutDisplay => {
openMapSettings: async () => {
await dispatch(setSelectedLayer(null));
dispatch(trackMapSettings());
dispatch(updateFlyout(FLYOUT_STATE.MAP_SETTINGS_PANEL));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function LayerControl({
closeLayerTOC,
openLayerTOC,
layerList,
isAddButtonActive,
isFlyoutOpen,
openMapSettings,
}) {
if (!isLayerTOCOpen) {
Expand Down Expand Up @@ -92,7 +92,7 @@ export function LayerControl({
<Fragment>
<EuiSpacer size="s" />
<EuiButton
isDisabled={!isAddButtonActive}
isDisabled={isFlyoutOpen}
className="mapLayerControl__addLayerButton"
fill
fullWidth
Expand All @@ -110,6 +110,7 @@ export function LayerControl({
<EuiFlexItem grow={false}>
<EuiToolTip delay="long" content={openMapSettingsLabel}>
<EuiButtonIcon
isDisabled={isFlyoutOpen}
className="mapLayerControl__openMapSettingsButton"
onClick={openMapSettings}
iconType="gear"
Expand Down

0 comments on commit 2d3682f

Please sign in to comment.