import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import * as React from 'react';
import * as PropTypes from 'prop-types';
import IntersectionObserver from '@researchgate/react-intersection-observer';
import * as S from './styles';

var MenuContainer = function MenuContainer(_ref) {
  var adjustHeight = _ref.adjustHeight,
      children = _ref.children;

  var _React$useState = React.useState(true),
      _React$useState2 = _slicedToArray(_React$useState, 2),
      isIntersecting = _React$useState2[0],
      setIsIntersecting = _React$useState2[1];

  var onIntersectionChange = React.useCallback(function (arg) {
    setIsIntersecting(arg.isIntersecting);
  }, []);
  return React.createElement(React.Fragment, null, React.createElement(IntersectionObserver, {
    onChange: onIntersectionChange
  }, React.createElement(S.MenuIntersectionGuard, null)), React.createElement(S.MenuIntersectionContainer, {
    isIntersecting: isIntersecting,
    adjustHeight: adjustHeight
  }, children));
};

MenuContainer.propTypes = {
  adjustHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
  children: PropTypes.node
};
export default MenuContainer;