echoes/frontend/hooks/servicesProvider.tsx

26 lines
810 B
TypeScript
Raw Normal View History

import { CapabilityService } from "services/capabilityService";
import { ThemeService } from "services/themeService";
import { createServiceContext } from "./createServiceContext";
import { ReactNode } from "react";
export const { ExtensionProvider, useExtension } = createServiceContext(
"Extension",
() => CapabilityService.getInstance(),
);
export const { ThemeProvider, useTheme } = createServiceContext("Theme", () =>
ThemeService.getInstance(),
);
// File path:hooks/servicesProvider.tsx
/**
* ServiceProvider
*
* @param children -
*/
export const ServiceProvider = ({ children }: { children: ReactNode }) => (
<ExtensionProvider>
<ThemeProvider>{children}</ThemeProvider>
</ExtensionProvider>
);