-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c237234
commit 5ea3bb9
Showing
8 changed files
with
98 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { | ||
OPEN_APP_DRAWER, | ||
CLOSE_APP_DRAWER, | ||
TOGGLE_APP_DRAWER | ||
} from './constants'; | ||
|
||
export function openDrawer() { | ||
return { | ||
type: OPEN_APP_DRAWER | ||
}; | ||
} | ||
|
||
export function closeDrawer() { | ||
return { | ||
type: CLOSE_APP_DRAWER | ||
}; | ||
} | ||
|
||
export function toggleDrawer() { | ||
return { | ||
type: TOGGLE_APP_DRAWER | ||
}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Layout | ||
*/ | ||
export const OPEN_APP_DRAWER = 'OPEN_APP_DRAWER'; | ||
export const CLOSE_APP_DRAWER = 'CLOSE_APP_DRAWER'; | ||
export const TOGGLE_APP_DRAWER = 'TOGGLE_APP_DRAWER'; |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
OPEN_APP_DRAWER, | ||
CLOSE_APP_DRAWER, | ||
TOGGLE_APP_DRAWER | ||
} from '../constants'; | ||
|
||
const initialState = { | ||
drawerOpen: false | ||
}; | ||
|
||
export default function update(state = initialState, action) { | ||
switch (action.type) { | ||
|
||
case OPEN_APP_DRAWER: | ||
return { ...state, drawerOpen: true }; | ||
|
||
case CLOSE_APP_DRAWER: | ||
return { ...state, drawerOpen: false }; | ||
|
||
case TOGGLE_APP_DRAWER: | ||
return { ...state, drawerOpen: !state.drawerOpen }; | ||
|
||
default: | ||
return state; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { combineReducers } from 'redux'; | ||
import app from './app'; | ||
|
||
const rootReducer = combineReducers({ | ||
app | ||
}); | ||
|
||
export default rootReducer; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createStore as _createStore } from 'redux'; | ||
import rootReducer from './reducers'; | ||
|
||
export function createStore(initialState) { | ||
const store = _createStore(rootReducer, initialState); | ||
|
||
if (module.hot) { | ||
module.hot.accept('./reducers', () => | ||
store.replaceReducer(require('./reducers/index')) | ||
); | ||
} | ||
|
||
return store; | ||
} |