UNPKG

@playkit-js/playkit-js-ui

Version:

[![Build Status](https://github.com/kaltura/playkit-js-ui/actions/workflows/run_canary_full_flow.yaml/badge.svg)](https://github.com/kaltura/playkit-js-ui/actions/workflows/run_canary_full_flow.yaml) [![code style: prettier](https://img.shields.io/badge/c

38 lines (29 loc) 1.08 kB
/* eslint-disable @typescript-eslint/explicit-function-return-type */ import {types as configReducerTypes} from './config'; import {getComponentStateFromConfig, getComponentStateFromComponentConfig} from '../utils/component-config'; import {LoadingState} from '../types/reducers/loading'; const component = 'loading'; export const types = { UPDATE_LOADING_SPINNER_STATE: `${component}/UPDATE_LOADING_SPINNER_STATE` }; export const initialState = { show: false }; export default (state: LoadingState = initialState, action: any) => { switch (action.type) { case configReducerTypes.UPDATE: return getComponentStateFromConfig(component, state, action); case configReducerTypes.UPDATE_COMPONENT: return getComponentStateFromComponentConfig(component, state, action); case types.UPDATE_LOADING_SPINNER_STATE: return { ...state, show: action.show }; default: return state; } }; export const actions = { updateLoadingSpinnerState: (show: boolean) => ({type: types.UPDATE_LOADING_SPINNER_STATE, show}) };