-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(layer-tabs): add collapsible layer-selector, highlight selected … (
#123) * feat(layer-tabs): add collapsible layer-selector, highlight selected layers * feat(layer-tabs): remove list-style * refactor(layer-tabs): change classnames
- Loading branch information
1 parent
753e948
commit 2ed8363
Showing
9 changed files
with
90 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
.app | ||
height: 100% | ||
font-family: Arial, Helvetica, sans-serif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
.btn | ||
.tab | ||
width: 50% | ||
padding: 20px | ||
border-radius: 10px 10px 0 0 | ||
font-size: 1.3em | ||
outline: 0 | ||
|
||
.btnInactive | ||
background-color: #141414 | ||
color: #fff | ||
border: 1px solid #ccc | ||
|
||
.tabActive | ||
background-color: #fff | ||
color: #141414 | ||
border: 1px solid #ccc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
import {SET_SELECTED_LAYER_ID, LayerId} from '../actions/set-selected-layer'; | ||
import {Action, State} from './index'; | ||
|
||
export type SelectedLayersState = LayerId[]; | ||
export interface SelectedLayersState { | ||
main: LayerId | null; | ||
compare: LayerId | null; | ||
} | ||
|
||
const initialState = { | ||
main: null, | ||
compare: null | ||
}; | ||
|
||
function selectedLayerReducer( | ||
state: SelectedLayersState = [], | ||
state: SelectedLayersState = initialState, | ||
action: Action | ||
): SelectedLayersState { | ||
switch (action.type) { | ||
case SET_SELECTED_LAYER_ID: | ||
const newState = [...state]; | ||
newState[action.isPrimary ? 0 : 1] = action.layerId; | ||
const newState = {...state}; | ||
const key = action.isPrimary ? 'main' : 'compare'; | ||
newState[key] = action.layerId; | ||
return newState; | ||
default: | ||
return state; | ||
} | ||
} | ||
export function selectedLayerIdSelector(state: State) { | ||
export function selectedLayerIdSelector(state: State): SelectedLayersState { | ||
return state.selectedLayer; | ||
} | ||
export default selectedLayerReducer; |