pull/5370/head
filip mertens 3 years ago
parent 0dc00156ee
commit f30b8cf7a9
  1. 43
      libs/remix-ui/app/src/lib/remix-app/reducer/modals.ts
  2. 11
      libs/remix-ui/app/src/lib/remix-app/types/index.ts
  3. 438
      package-lock.json

@ -0,0 +1,43 @@
import { actionTypes } from '../state/modals'
import { Modal } from '../types'
interface Action {
type: string
payload: any
}
export interface ModalState {
modals: Modal[],
toasters: string[],
focusModal: Modal,
focusToaster: string
}
const ModalInitialState: ModalState = {
modals: [],
toasters: [],
focusModal: {
hide: true,
title: '',
message: '',
okLabel: '',
okFn: () => {},
cancelLabel: '',
cancelFn: () => {}
},
focusToaster: ''
}
export const modalReducer = (state: ModalState = ModalInitialState, action: Action) => {
switch (action.type) {
case actionTypes.setModal:
state.modals.push(action.payload)
return { ...state }
}
return {
modals: state.modals,
toasters: state.toasters,
focusModal: state.focusModal,
focusToaster: state.focusToaster
}
}

@ -0,0 +1,11 @@
export interface Modal {
hide?: boolean
title: string
// eslint-disable-next-line no-undef
message: string | JSX.Element
okLabel: string
okFn: () => void
cancelLabel: string
cancelFn: () => void
}

438
package-lock.json generated

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save