Add opening images in a modal window
This commit is contained in:
@@ -5,6 +5,7 @@ import compose from './compose';
|
||||
import follow from './follow';
|
||||
import notifications from './notifications';
|
||||
import { loadingBarReducer } from 'react-redux-loading-bar';
|
||||
import modal from './modal';
|
||||
|
||||
export default combineReducers({
|
||||
timelines,
|
||||
@@ -13,4 +14,5 @@ export default combineReducers({
|
||||
follow,
|
||||
notifications,
|
||||
loadingBar: loadingBarReducer,
|
||||
modal,
|
||||
});
|
||||
|
21
app/assets/javascripts/components/reducers/modal.jsx
Normal file
21
app/assets/javascripts/components/reducers/modal.jsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import { MEDIA_OPEN, MODAL_CLOSE } from '../actions/modal';
|
||||
import Immutable from 'immutable';
|
||||
|
||||
const initialState = Immutable.Map({
|
||||
url: '',
|
||||
open: false
|
||||
});
|
||||
|
||||
export default function modal(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case MEDIA_OPEN:
|
||||
return state.withMutations(map => {
|
||||
map.set('url', action.url);
|
||||
map.set('open', true);
|
||||
});
|
||||
case MODAL_CLOSE:
|
||||
return state.set('open', false);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user