/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/interface/src/store/reducer.js
52 строки
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { combineReducers } from '@wordpress/data'; export function complementaryAreas( state = {}, action ) { switch ( action.type ) { case 'SET_DEFAULT_COMPLEMENTARY_AREA': { const { scope, area } = action; // If there's already an area, don't overwrite it. if ( state[ scope ] ) { return state; } return { ...state, [ scope ]: area, }; } case 'ENABLE_COMPLEMENTARY_AREA': { const { scope, area } = action; return { ...state, [ scope ]: area, }; } } return state; } /** * Reducer for storing the name of the open modal, or null if no modal is open. * * @param {Object} state Previous state. * @param {Object} action Action object containing the `name` of the modal * * @return {Object} Updated state */ export function activeModal( state = null, action ) { switch ( action.type ) { case 'OPEN_MODAL': return action.name; case 'CLOSE_MODAL': return null; } return state; } export default combineReducers( { complementaryAreas, activeModal, } );