function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }

function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _templateObject() {
  var data = _taggedTemplateLiteral(["\n  height: 72px;\n  width: 100vw;\n  position: fixed;\n  background: #fdfdfd;\n  box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);\n  margin: 0;\n  top: 0;\n  z-index: 999;\n"]);

  _templateObject = function _templateObject() {
    return data;
  };

  return data;
}

function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

import { css, jsx } from "@emotion/core";
import { useEffect, useState } from "react";
import PropTypes from "prop-types";
import FullNav from "./FullNav";
import SmallNav from "./SmallNav";
var headerWrapper = css(_templateObject());

var Header = function Header(props) {
  var collapseWidth = props.collapseWidth;

  var _useState = useState(window.innerWidth),
      _useState2 = _slicedToArray(_useState, 2),
      width = _useState2[0],
      setWidth = _useState2[1];

  var handleResize = function handleResize() {
    setWidth(window.innerWidth);
  };

  useEffect(function () {
    window.addEventListener("resize", handleResize);
    return function () {
      window.removeEventListener("resize", handleResize);
    };
  });
  return jsx("header", _extends({
    css: headerWrapper
  }, props), width > collapseWidth ? jsx(FullNav, props) : jsx(SmallNav, props));
};

Header.propTypes = {
  greatestWidth: PropTypes.number,
  collapseWidth: PropTypes.number,
  condensedWidth: PropTypes.number
};
Header.defaultProps = {
  greatestWidth: 1200,
  collapseWidth: 845,
  condensedWidth: 715
};
Header.displayName = "Header";
export default Header;