mirror of
https://github.com/strapi/strapi.git
synced 2025-08-09 01:07:27 +00:00
27 lines
862 B
JavaScript
27 lines
862 B
JavaScript
import React, { createContext, useContext } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
const EditPageContext = createContext({});
|
|
|
|
const EditPageContextProvider = ({ children, ...rest }) => {
|
|
return <EditPageContext.Provider value={rest}>{children}</EditPageContext.Provider>;
|
|
};
|
|
|
|
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 };
|