2019-10-03 12:58:20 +02:00
|
|
|
import React, { createContext, useContext } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
const EditPageContext = createContext({});
|
|
|
|
|
|
|
|
const EditPageContextProvider = ({ children, ...rest }) => {
|
2020-08-03 16:49:40 +02:00
|
|
|
return <EditPageContext.Provider value={rest}>{children}</EditPageContext.Provider>;
|
2019-10-03 12:58:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const useEditPageContext = () => useContext(EditPageContext);
|
|
|
|
|
|
|
|
EditPageContextProvider.defaultProps = {
|
|
|
|
emitEvent: () => {},
|
|
|
|
};
|
|
|
|
|
|
|
|
EditPageContextProvider.propTypes = {
|
|
|
|
children: PropTypes.node.isRequired,
|
|
|
|
emitEvent: PropTypes.func,
|
|
|
|
onChange: PropTypes.func.isRequired,
|
|
|
|
selectAllActions: PropTypes.func.isRequired,
|
|
|
|
setInputPoliciesPath: PropTypes.func.isRequired,
|
|
|
|
setShouldDisplayPolicieshint: PropTypes.func.isRequired,
|
|
|
|
resetShouldDisplayPoliciesHint: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
export { EditPageContext, EditPageContextProvider, useEditPageContext };
|