Add state for navigation
Currently selected navigation item is available under the navigation variable so that the whole application has access to it.
This commit is contained in:
parent
c9b324c68b
commit
d14eed9965
10 changed files with 154 additions and 45 deletions
|
|
@ -1,13 +1,12 @@
|
|||
import { UPDATE_CONTEXT_MENU, OPEN_CONTEXT_MENU, CLOSE_CONTEXT_MENU } from '../constants/contextMenu'
|
||||
|
||||
|
||||
const initialState =
|
||||
{
|
||||
const initialState = {
|
||||
opened: false,
|
||||
x: 0,
|
||||
y: 0,
|
||||
items: []
|
||||
}
|
||||
}
|
||||
|
||||
export default function contextMenu(state = initialState, action){
|
||||
switch (action.type) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { combineReducers } from 'redux'
|
||||
import contextMenu from './contextMenu'
|
||||
import navigation from './navigation'
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
contextMenu
|
||||
contextMenu,
|
||||
navigation
|
||||
})
|
||||
|
||||
export default rootReducer
|
||||
|
|
|
|||
18
app/reducers/navigation.jsx
Normal file
18
app/reducers/navigation.jsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { UPDATE_SELECTION } from '../constants/navigation'
|
||||
|
||||
const initialState =
|
||||
{
|
||||
selection: {
|
||||
}
|
||||
}
|
||||
|
||||
export default function navigation(state = initialState, action){
|
||||
switch (action.type) {
|
||||
case UPDATE_SELECTION:
|
||||
return Object.assign({}, state, {
|
||||
selection: action.selection
|
||||
})
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue