scrollsequence
/
includes
/
carbonfields
/
htmlburger
/
carbon-fields
/
packages
/
blocks
/
store
/
reducer.js
reducer.js in Scrollsequence – Cinematic Scroll Image Animation Plugin 1.5.5, at includes/carbonfields/htmlburger/carbon-fields/packages/blocks/store/reducer.js
| 1 | /** |
| 2 | * External dependencies. |
| 3 | */ |
| 4 | import { combineReducers } from '@wordpress/data'; |
| 5 | |
| 6 | /** |
| 7 | * The reducer that keeps track of container definitions keyed by block's name. |
| 8 | * |
| 9 | * @param {Object} state |
| 10 | * @param {Object} action |
| 11 | * @return {Object} |
| 12 | */ |
| 13 | export function containerDefinitionsByBlockName( state = {}, action ) { |
| 14 | switch ( action.type ) { |
| 15 | case 'SETUP_CONTAINER_DEFINITIONS': |
| 16 | return action.payload.definitions; |
| 17 | |
| 18 | default: |
| 19 | return state; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * The reducer that keeps track of field definitions keyed by block's name. |
| 25 | * |
| 26 | * @param {Object} state |
| 27 | * @param {Object} action |
| 28 | * @return {Object} |
| 29 | */ |
| 30 | export function fieldDefinitionsByBlockName( state = {}, action ) { |
| 31 | switch ( action.type ) { |
| 32 | case 'SETUP_FIELD_DEFINITIONS': |
| 33 | return action.payload.definitions; |
| 34 | |
| 35 | default: |
| 36 | return state; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | export default combineReducers( { |
| 41 | containerDefinitionsByBlockName, |
| 42 | fieldDefinitionsByBlockName |
| 43 | } ); |
| 44 |