@ndla/ui 2.1.4 → 2.1.5

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.
@@ -129,7 +129,7 @@ export var Article = function Article(_ref4) {
129
129
  var _useIntersectionObser = useIntersectionObserver({
130
130
  root: null,
131
131
  rootMargin: '400px',
132
- threshold: 0.25
132
+ threshold: 0.1
133
133
  }),
134
134
  _useIntersectionObser2 = _slicedToArray(_useIntersectionObser, 2),
135
135
  articleRef = _useIntersectionObser2[0],
@@ -9,7 +9,6 @@ import React from 'react';
9
9
  import ReactDOM from 'react-dom';
10
10
  import Controls from './Controls';
11
11
  import SpeechControl from './SpeechControl';
12
- import LocaleProvider from '../locale/LocaleProvider';
13
12
  import { truncateDescription } from './AudioPlayer';
14
13
  import { jsx as ___EmotionJSX } from "@emotion/core";
15
14
 
@@ -29,17 +28,15 @@ var initAudioPlayers = function initAudioPlayers(locale) {
29
28
 
30
29
  if (src && title) {
31
30
  if (speech) {
32
- ReactDOM.render(___EmotionJSX(SpeechControl, {
31
+ ReactDOM.hydrate(___EmotionJSX(SpeechControl, {
33
32
  src: src,
34
33
  title: title
35
34
  }), el);
36
35
  } else {
37
- ReactDOM.render(___EmotionJSX(LocaleProvider, {
38
- locale: locale
39
- }, ___EmotionJSX(Controls, {
36
+ ReactDOM.hydrate(___EmotionJSX(Controls, {
40
37
  src: src,
41
38
  title: title
42
- })), el);
39
+ }), el);
43
40
  }
44
41
  }
45
42
  });
@@ -302,11 +302,11 @@ export var TopicMenu = function TopicMenu(_ref) {
302
302
  TopicMenu.propTypes = {
303
303
  topics: PropTypes.arrayOf(TopicShape).isRequired,
304
304
  toFrontpage: PropTypes.func.isRequired,
305
- toTopic: PropTypes.func.isRequired,
306
- toSubject: PropTypes.func.isRequired,
305
+ toTopic: PropTypes.func,
306
+ toSubject: PropTypes.func,
307
307
  close: PropTypes.func,
308
308
  defaultCount: PropTypes.number,
309
- subjectTitle: PropTypes.string.isRequired,
309
+ subjectTitle: PropTypes.string,
310
310
  resourceToLinkProps: PropTypes.func.isRequired,
311
311
  onNavigate: PropTypes.func.isRequired,
312
312
  expandedTopicId: PropTypes.string,
@@ -159,7 +159,7 @@ var Article = function Article(_ref4) {
159
159
  var _useIntersectionObser = (0, _hooks.useIntersectionObserver)({
160
160
  root: null,
161
161
  rootMargin: '400px',
162
- threshold: 0.25
162
+ threshold: 0.1
163
163
  }),
164
164
  _useIntersectionObser2 = _slicedToArray(_useIntersectionObser, 2),
165
165
  articleRef = _useIntersectionObser2[0],
@@ -13,8 +13,6 @@ var _Controls = _interopRequireDefault(require("./Controls"));
13
13
 
14
14
  var _SpeechControl = _interopRequireDefault(require("./SpeechControl"));
15
15
 
16
- var _LocaleProvider = _interopRequireDefault(require("../locale/LocaleProvider"));
17
-
18
16
  var _AudioPlayer = require("./AudioPlayer");
19
17
 
20
18
  var _core = require("@emotion/core");
@@ -44,17 +42,15 @@ var initAudioPlayers = function initAudioPlayers(locale) {
44
42
 
45
43
  if (src && title) {
46
44
  if (speech) {
47
- _reactDom["default"].render((0, _core.jsx)(_SpeechControl["default"], {
45
+ _reactDom["default"].hydrate((0, _core.jsx)(_SpeechControl["default"], {
48
46
  src: src,
49
47
  title: title
50
48
  }), el);
51
49
  } else {
52
- _reactDom["default"].render((0, _core.jsx)(_LocaleProvider["default"], {
53
- locale: locale
54
- }, (0, _core.jsx)(_Controls["default"], {
50
+ _reactDom["default"].hydrate((0, _core.jsx)(_Controls["default"], {
55
51
  src: src,
56
52
  title: title
57
- })), el);
53
+ }), el);
58
54
  }
59
55
  }
60
56
  });
@@ -331,11 +331,11 @@ exports.TopicMenu = TopicMenu;
331
331
  TopicMenu.propTypes = {
332
332
  topics: _propTypes["default"].arrayOf(_shapes.TopicShape).isRequired,
333
333
  toFrontpage: _propTypes["default"].func.isRequired,
334
- toTopic: _propTypes["default"].func.isRequired,
335
- toSubject: _propTypes["default"].func.isRequired,
334
+ toTopic: _propTypes["default"].func,
335
+ toSubject: _propTypes["default"].func,
336
336
  close: _propTypes["default"].func,
337
337
  defaultCount: _propTypes["default"].number,
338
- subjectTitle: _propTypes["default"].string.isRequired,
338
+ subjectTitle: _propTypes["default"].string,
339
339
  resourceToLinkProps: _propTypes["default"].func.isRequired,
340
340
  onNavigate: _propTypes["default"].func.isRequired,
341
341
  expandedTopicId: _propTypes["default"].string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -34,15 +34,15 @@
34
34
  "@ndla/button": "^1.0.2",
35
35
  "@ndla/carousel": "^1.0.2",
36
36
  "@ndla/core": "^0.7.2",
37
- "@ndla/hooks": "^1.0.2",
37
+ "@ndla/hooks": "^1.0.3",
38
38
  "@ndla/icons": "^1.0.1",
39
39
  "@ndla/licenses": "^1.0.2",
40
- "@ndla/modal": "^1.1.4",
40
+ "@ndla/modal": "^1.1.5",
41
41
  "@ndla/safelink": "^1.0.1",
42
42
  "@ndla/switch": "^0.0.32",
43
- "@ndla/tabs": "^1.0.4",
43
+ "@ndla/tabs": "^1.0.5",
44
44
  "@ndla/tooltip": "^0.2.44",
45
- "@ndla/util": "^1.0.2",
45
+ "@ndla/util": "^1.0.3",
46
46
  "@reach/menu-button": "^0.12.1",
47
47
  "@reach/slider": "^0.12.1",
48
48
  "@types/hoist-non-react-statics": "^3.3.1",
@@ -92,5 +92,5 @@
92
92
  "publishConfig": {
93
93
  "access": "public"
94
94
  },
95
- "gitHead": "8f7c7acfa0ef1ab0b66b8a1cdfc111f1e4d83720"
95
+ "gitHead": "e10a8348999df08fd71cc4959e873252395bfea9"
96
96
  }
@@ -143,7 +143,7 @@ export const Article = ({
143
143
  const [articleRef, { entry }] = useIntersectionObserver({
144
144
  root: null,
145
145
  rootMargin: '400px',
146
- threshold: 0.25,
146
+ threshold: 0.1,
147
147
  });
148
148
  const [articlePositionRight, setArticlePositionRight] = useState(0);
149
149
  const wrapperRef = useRef<HTMLDivElement>(null);
@@ -10,7 +10,6 @@ import ReactDOM from 'react-dom';
10
10
 
11
11
  import Controls from './Controls';
12
12
  import SpeechControl from './SpeechControl';
13
- import LocaleProvider from '../locale/LocaleProvider';
14
13
  import { Locale } from '../types';
15
14
  import { truncateDescription } from './AudioPlayer';
16
15
 
@@ -28,14 +27,9 @@ const initAudioPlayers = (locale: Locale) => {
28
27
  const speech = el.getAttribute('data-speech');
29
28
  if (src && title) {
30
29
  if (speech) {
31
- ReactDOM.render(<SpeechControl src={src} title={title} />, el);
30
+ ReactDOM.hydrate(<SpeechControl src={src} title={title} />, el);
32
31
  } else {
33
- ReactDOM.render(
34
- <LocaleProvider locale={locale}>
35
- <Controls src={src} title={title} />
36
- </LocaleProvider>,
37
- el,
38
- );
32
+ ReactDOM.hydrate(<Controls src={src} title={title} />, el);
39
33
  }
40
34
  }
41
35
  });
@@ -349,11 +349,11 @@ export const TopicMenu = ({
349
349
  TopicMenu.propTypes = {
350
350
  topics: PropTypes.arrayOf(TopicShape).isRequired,
351
351
  toFrontpage: PropTypes.func.isRequired,
352
- toTopic: PropTypes.func.isRequired,
353
- toSubject: PropTypes.func.isRequired,
352
+ toTopic: PropTypes.func,
353
+ toSubject: PropTypes.func,
354
354
  close: PropTypes.func,
355
355
  defaultCount: PropTypes.number,
356
- subjectTitle: PropTypes.string.isRequired,
356
+ subjectTitle: PropTypes.string,
357
357
  resourceToLinkProps: PropTypes.func.isRequired,
358
358
  onNavigate: PropTypes.func.isRequired,
359
359
  expandedTopicId: PropTypes.string,