import React, { createContext, ReactNode, useContext } from 'react'; export type CdnComponentsConfiguration = { hostname: string; originHostnames: string[]; }; export type ComponentsConfiguration = { cdn: CdnComponentsConfiguration }; export type ComponentsConfigurationProviderProps = { children: ReactNode; configuration: ComponentsConfiguration; }; export const defaultComponentsConfiguration: ComponentsConfiguration = { cdn: { hostname: 'cdn.t3n.de', originHostnames: ['storage.googleapis.com'], }, }; export const ComponentsConfigurationContext = createContext(defaultComponentsConfiguration); export const ComponentsConfigurationProvider: React.FC< ComponentsConfigurationProviderProps > = ({ children, configuration }) => { return ( {children} ); }; const useComponentsConfiguration = () => useContext(ComponentsConfigurationContext); export default useComponentsConfiguration;