UNPKG

@veracity/vui

Version:

Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.

16 lines (15 loc) 676 B
//#region src/core/vuiProvider/reducers.ts const toastsReducer = (state, action) => { switch (action.type) { case "add": if (state.list.some((t) => t.id === action.toast.id)) return { list: state.list.map((t) => t.id === action.toast.id ? action.toast : t) }; return { list: [action.toast, ...state.list].slice(0, 3) }; case "remove": return { list: state.list.filter((t) => t.id !== action.toast.id) }; default: throw new Error(`Unhandled action type: ${action.type}`); } }; const genericReducer = (state, action) => state = action; //#endregion export { genericReducer, toastsReducer }; globalThis.__vuiVersion__ = "5.3.1" //# sourceMappingURL=reducers.js.map