import React from 'react'; import type { IToast } from 'interfaces/toast'; interface IUIContext { toastData: IToast; setToast: React.Dispatch>; showFeedback: boolean; setShowFeedback: React.Dispatch>; setThemeMode: React.Dispatch>; themeMode: themeMode; } export type themeMode = 'light' | 'dark'; export const createEmptyToast = (): IToast => { return { type: 'success', title: '', text: '', components: [], show: false, persist: false, }; }; const setToastPlaceholder = () => { throw new Error('setToast called outside UIContext'); }; const setShowFeedbackPlaceholder = () => { throw new Error('setShowFeedback called outside UIContext'); }; const setThemeModePlaceholder = () => { throw new Error('setMode called outside UIContext'); }; const UIContext = React.createContext({ toastData: createEmptyToast(), setToast: setToastPlaceholder, showFeedback: false, setShowFeedback: setShowFeedbackPlaceholder, themeMode: 'light', setThemeMode: setThemeModePlaceholder, }); export default UIContext;