@ndla/ui 6.1.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
  import { useState } from 'react';
21
21
  import { resizeObserver } from '@ndla/util';
22
22
  export var getMastheadHeight = function getMastheadHeight() {
23
- var masthead = document.getElementById('masthead');
23
+ var masthead = document && document.getElementById('masthead');
24
24
  return masthead === null || masthead === void 0 ? void 0 : masthead.getBoundingClientRect().height;
25
25
  };
26
26
  export var useMastheadHeight = function useMastheadHeight() {
@@ -29,7 +29,7 @@ export var useMastheadHeight = function useMastheadHeight() {
29
29
  height = _useState2[0],
30
30
  setHeight = _useState2[1];
31
31
 
32
- var masthead = document.getElementById('masthead');
32
+ var masthead = document && document.getElementById('masthead');
33
33
 
34
34
  var handleHeightChange = function handleHeightChange(el) {
35
35
  var newHeight = el.getBoundingClientRect().height;
@@ -22,7 +22,7 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
22
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
23
 
24
24
  var getMastheadHeight = function getMastheadHeight() {
25
- var masthead = document.getElementById('masthead');
25
+ var masthead = document && document.getElementById('masthead');
26
26
  return masthead === null || masthead === void 0 ? void 0 : masthead.getBoundingClientRect().height;
27
27
  };
28
28
 
@@ -34,7 +34,7 @@ var useMastheadHeight = function useMastheadHeight() {
34
34
  height = _useState2[0],
35
35
  setHeight = _useState2[1];
36
36
 
37
- var masthead = document.getElementById('masthead');
37
+ var masthead = document && document.getElementById('masthead');
38
38
 
39
39
  var handleHeightChange = function handleHeightChange(el) {
40
40
  var newHeight = el.getBoundingClientRect().height;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "6.1.0",
3
+ "version": "6.1.1",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "75732577f9b9d681d2153323a4316ecf08a0fe9f"
84
+ "gitHead": "fa8891f69438a94440d4fbb73c8ed7dfff867311"
85
85
  }
@@ -10,13 +10,13 @@ import { useState } from 'react';
10
10
  import { resizeObserver } from '@ndla/util';
11
11
 
12
12
  export const getMastheadHeight = (): number | undefined => {
13
- const masthead = document.getElementById('masthead');
13
+ const masthead = document && document.getElementById('masthead');
14
14
  return masthead?.getBoundingClientRect().height;
15
15
  };
16
16
 
17
17
  export const useMastheadHeight = () => {
18
18
  const [height, setHeight] = useState<number>();
19
- const masthead = document.getElementById('masthead');
19
+ const masthead = document && document.getElementById('masthead');
20
20
 
21
21
  const handleHeightChange = (el: HTMLElement) => {
22
22
  const newHeight = el.getBoundingClientRect().height;