import { useCallback, useState } from "react";
export default (function (ref, target, itemsLength, collapsed) {
  var _useState = useState(false),
    arrowLeft = _useState[0],
    setArrowLeft = _useState[1];
  var _useState2 = useState(false),
    arrowRight = _useState2[0],
    setArrowRight = _useState2[1];
  var onScroll = useCallback(function () {
    if (!ref.current || !target.current) return;
    if (!collapsed) return;
    var scroll = ref.current.scrollLeft;
    var _ref$current$getBound = ref.current.getBoundingClientRect(),
      containerRight = _ref$current$getBound.right;
    var _target$current$getBo = target.current.getBoundingClientRect(),
      lastTabRight = _target$current$getBo.right;
    setArrowRight(lastTabRight > containerRight + 20);
    setArrowLeft(scroll > 20);
  }, [collapsed, itemsLength]);
  return [arrowLeft, arrowRight, onScroll];
});