import { ScrollTop } from './components';
import { ThemeCustomizationProvider } from './themes';
import { CoreAdminContext, CoreAdminContextProps } from 'react-admin';

type AdminContextProps = CoreAdminContextProps & {
  theme?: any;
};
function AdminContext({ children, theme, ...props }: AdminContextProps): JSX.Element {
  return (
    <CoreAdminContext {...props}>
      <ThemeCustomizationProvider themeOverrides={theme}>
        <ScrollTop>
          {/** @ts-ignore */}
          {children}
        </ScrollTop>
      </ThemeCustomizationProvider>
    </CoreAdminContext>
  );
}
export { AdminContext };
export type { AdminContextProps };
