Webatrice: update deps (#4700)

* save work

* fix reset styling

* fix toast reducer

* update non-react deps

* update react libraries

* remove jquery, use sanitize-html instead

* add missing change

* fix deps and dev deps

* update workflow to target Node 16

* run @mui/codemod to remove @mui/styles

* add default body font size

* update react 17 to 18

* declare enum before use

* add rel attr to links

* fix font sizing issue

* trailing commas

* refactor deep destructuring

Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
Jeremy Letto 2022-11-01 12:41:42 -05:00 committed by GitHub
parent 5854a635ca
commit 26d7fe2ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 26225 additions and 3552 deletions

View file

@ -1,4 +1,4 @@
import { createContext, FC, ReactChild, ReactNode, useContext, useEffect, useReducer, ContextType, Context } from 'react'
import { createContext, FC, PropsWithChildren, ReactChild, ReactNode, useContext, useEffect, useReducer, ContextType, Context } from 'react'
import { ACTIONS, initialState, reducer } from './reducer';
import Toast from './Toast'
@ -24,15 +24,15 @@ const ToastContext: Context<any> = createContext<ToastState>({
removeToast: (key) => {},
});
export const ToastProvider: FC<ReactNode> = (props) => {
export const ToastProvider: FC<PropsWithChildren> = (props) => {
const { children } = props
const [state, dispatch] = useReducer(reducer, initialState)
const providerState = {
toasts: state.toasts,
addToast: (key, children) => dispatch({ type: ACTIONS.ADD_TOAST, payload: { key, children } }),
openToast: key => dispatch({ type: ACTIONS.OPEN_TOAST, payload: key }),
closeToast: key => dispatch({ type: ACTIONS.CLOSE_TOAST, payload: key }),
removeToast: key => dispatch({ type: ACTIONS.REMOVE_TOAST, payload: key }),
openToast: key => dispatch({ type: ACTIONS.OPEN_TOAST, payload: { key } }),
closeToast: key => dispatch({ type: ACTIONS.CLOSE_TOAST, payload: { key } }),
removeToast: key => dispatch({ type: ACTIONS.REMOVE_TOAST, payload: { key } }),
}
return (
<ToastContext.Provider value={providerState}>
@ -41,7 +41,7 @@ export const ToastProvider: FC<ReactNode> = (props) => {
{Array.from(state.toasts).map(([key, value]) => {
const { isOpen, children } = value;
return (
<Toast key={key} open={isOpen} onClose={() => dispatch({ type: ACTIONS.CLOSE_TOAST, payload: key })}>
<Toast key={key} open={isOpen} onClose={() => dispatch({ type: ACTIONS.CLOSE_TOAST, payload: { key } })}>
{children}
</Toast>
)