export function withWindConfig()

in packages/misc/internal-helpers/src/withWindConfig.tsx [22:34]


export function withWindConfig<PropType extends { windConfig: IWindConfig }>(
  Wrapped: React.ComponentType<PropType>
) {
  const ConfifgConsumer: any = (ConfigProvider as any).Consumer
  const HOC: React.FC<Omit<PropType, keyof IWindConfigProps>> = props => (
    <ConfifgConsumer>
      {(context: IWindConfig) => (
        <Wrapped {...(props as PropType)} windConfig={context} />
      )}
    </ConfifgConsumer>
  )
  return HOC
}