"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ApixSection = exports.REM_TO_PX = void 0;

var _react = _interopRequireWildcard(require("react"));

var _components = require("@looker/components");

var _utils = require("../../utils");

var _Header = require("../Header");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

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); }

var REM_TO_PX = 16;
exports.REM_TO_PX = REM_TO_PX;

var ApixSection = props => {
  var size = (0, _utils.useWindowSize)();
  var sectionH = size.height - REM_TO_PX * _Header.HEADER_REM;
  (0, _react.useEffect)(() => {
    var _document$getElementB;

    (_document$getElementB = document.getElementById('top')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.scrollTo(REM_TO_PX * _Header.HEADER_REM, 0);
  }, [props]);
  return _react.default.createElement(_components.Section, _extends({}, props, {
    id: "top",
    p: "xxlarge",
    style: {
      height: "".concat(sectionH, "px"),
      overflow: 'auto',
      borderTop: '0px'
    }
  }));
};

exports.ApixSection = ApixSection;
//# sourceMappingURL=common.js.map