import * as React from "react";
import { ComponentsMapContext } from "./";

type ProviderArgs = {
  setComponentHeightById: (id: string | number, height: number) => void;
  getComponentHeightById: (id: string | number) => number;
  children: React.ReactNode;
};

export const ComponentsMapProvider = ({
  setComponentHeightById,
  getComponentHeightById,
  children,
}: ProviderArgs) => (
  <ComponentsMapContext.Provider
    value={{ setComponentHeightById, getComponentHeightById }}
  >
    {children}
  </ComponentsMapContext.Provider>
);
