From 48bcf4d6e89658abac5405683e823c68f27248f0 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Fri, 30 Mar 2018 12:45:23 +0200 Subject: [Glitch] Remove pointer events on the entire UI when a dropdown menu is open Port 913a38111ff5b0cb7f412bec93e8314859c88855 to glitch-soc --- .../flavours/glitch/reducers/dropdown_menu.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/javascript/flavours/glitch/reducers/dropdown_menu.js (limited to 'app/javascript/flavours/glitch/reducers/dropdown_menu.js') diff --git a/app/javascript/flavours/glitch/reducers/dropdown_menu.js b/app/javascript/flavours/glitch/reducers/dropdown_menu.js new file mode 100644 index 000000000..5449884cc --- /dev/null +++ b/app/javascript/flavours/glitch/reducers/dropdown_menu.js @@ -0,0 +1,18 @@ +import Immutable from 'immutable'; +import { + DROPDOWN_MENU_OPEN, + DROPDOWN_MENU_CLOSE, +} from '../actions/dropdown_menu'; + +const initialState = Immutable.Map({ openId: null, placement: null }); + +export default function dropdownMenu(state = initialState, action) { + switch (action.type) { + case DROPDOWN_MENU_OPEN: + return state.merge({ openId: action.id, placement: action.placement }); + case DROPDOWN_MENU_CLOSE: + return state.get('openId') === action.id ? state.set('openId', null) : state; + default: + return state; + } +} -- cgit