@ndla/ui 30.7.0 → 30.8.0

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.
@@ -12,13 +12,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
12
12
  *
13
13
  */
14
14
 
15
- // N.B These component is used to render static markup serverside
15
+ // N.B These components is used to render static markup serverside
16
16
  // Any interactivty is added by scripts located in the ndla-article-scripts package
17
17
 
18
18
  import React from 'react';
19
19
  import BEMHelper from 'react-bem-helper';
20
20
  import { isFunction as isFunctionHelper, parseMarkdown } from '@ndla/util';
21
- import { useTranslation } from 'react-i18next';
22
21
  import { Link as LinkIcon } from '@ndla/icons/common';
23
22
  import { LicenseByline } from '@ndla/licenses';
24
23
  import SafeLink from '@ndla/safelink';
@@ -42,9 +41,8 @@ export var FigureCaption = function FigureCaption(_ref) {
42
41
  link = _ref.link,
43
42
  hideFigcaption = _ref.hideFigcaption,
44
43
  hasLinkedVideo = _ref.hasLinkedVideo,
45
- hideIconsAndAuthors = _ref.hideIconsAndAuthors;
46
- var _useTranslation = useTranslation(),
47
- t = _useTranslation.t;
44
+ hideIconsAndAuthors = _ref.hideIconsAndAuthors,
45
+ linkedVideoMessages = _ref.linkedVideoMessages;
48
46
  return _jsxs("figcaption", _objectSpread(_objectSpread({}, classes('caption', hideFigcaption && !isMobile ? 'hidden-caption' : undefined)), {}, {
49
47
  children: [caption ? _jsx("div", _objectSpread(_objectSpread({}, classes('info')), {}, {
50
48
  children: parseMarkdown(caption)
@@ -76,10 +74,10 @@ export var FigureCaption = function FigureCaption(_ref) {
76
74
  }, classes('toggleAlternativeVideo')), {}, {
77
75
  children: [_jsx("span", {
78
76
  className: "original",
79
- children: t('figure.button.alternative')
77
+ children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.alternative
80
78
  }), _jsx("span", {
81
79
  className: "alternative hidden",
82
- children: t('figure.button.original')
80
+ children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.original
83
81
  })]
84
82
  }))]
85
83
  }), children]
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  import { ReactNode } from 'react';
9
- export declare const FigureCaption: ({ figureId, id, children, caption, authors, reuseLabel, licenseRights, locale, link, hideFigcaption, hasLinkedVideo, hideIconsAndAuthors, }: FigureCaptionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
9
+ export declare const FigureCaption: ({ figureId, id, children, caption, authors, reuseLabel, licenseRights, locale, link, hideFigcaption, hasLinkedVideo, hideIconsAndAuthors, linkedVideoMessages, }: FigureCaptionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
10
10
  export interface FigureLicense {
11
11
  short: string;
12
12
  title: string;
@@ -36,6 +36,10 @@ interface FigureCaptionProps {
36
36
  hideFigcaption?: boolean;
37
37
  hasLinkedVideo?: boolean;
38
38
  hideIconsAndAuthors?: boolean;
39
+ linkedVideoMessages?: {
40
+ original: string;
41
+ alternative: string;
42
+ };
39
43
  }
40
44
  declare const Figure: ({ children, type, resizeIframe, ...rest }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
41
45
  export declare type FigureType = 'full' | 'full-column' | 'left' | 'small-left' | 'right' | 'small-right' | 'xsmall-right' | 'xsmall-left';
@@ -7,7 +7,6 @@ exports["default"] = exports.FigureCaption = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
9
9
  var _util = require("@ndla/util");
10
- var _reactI18next = require("react-i18next");
11
10
  var _common = require("@ndla/icons/common");
12
11
  var _licenses = require("@ndla/licenses");
13
12
  var _safelink = _interopRequireDefault(require("@ndla/safelink"));
@@ -37,9 +36,8 @@ var FigureCaption = function FigureCaption(_ref) {
37
36
  link = _ref.link,
38
37
  hideFigcaption = _ref.hideFigcaption,
39
38
  hasLinkedVideo = _ref.hasLinkedVideo,
40
- hideIconsAndAuthors = _ref.hideIconsAndAuthors;
41
- var _useTranslation = (0, _reactI18next.useTranslation)(),
42
- t = _useTranslation.t;
39
+ hideIconsAndAuthors = _ref.hideIconsAndAuthors,
40
+ linkedVideoMessages = _ref.linkedVideoMessages;
43
41
  return (0, _jsxRuntime.jsxs)("figcaption", _objectSpread(_objectSpread({}, classes('caption', hideFigcaption && !_reactDeviceDetect.isMobile ? 'hidden-caption' : undefined)), {}, {
44
42
  children: [caption ? (0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, classes('info')), {}, {
45
43
  children: (0, _util.parseMarkdown)(caption)
@@ -71,10 +69,10 @@ var FigureCaption = function FigureCaption(_ref) {
71
69
  }, classes('toggleAlternativeVideo')), {}, {
72
70
  children: [(0, _jsxRuntime.jsx)("span", {
73
71
  className: "original",
74
- children: t('figure.button.alternative')
72
+ children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.alternative
75
73
  }), (0, _jsxRuntime.jsx)("span", {
76
74
  className: "alternative hidden",
77
- children: t('figure.button.original')
75
+ children: linkedVideoMessages === null || linkedVideoMessages === void 0 ? void 0 : linkedVideoMessages.original
78
76
  })]
79
77
  }))]
80
78
  }), children]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "30.7.0",
3
+ "version": "30.8.0",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -38,13 +38,13 @@
38
38
  "@ndla/forms": "^4.0.12",
39
39
  "@ndla/hooks": "^1.1.13",
40
40
  "@ndla/icons": "^2.0.6",
41
- "@ndla/licenses": "^6.0.6",
41
+ "@ndla/licenses": "^6.0.7",
42
42
  "@ndla/modal": "^2.1.1",
43
- "@ndla/notion": "^4.0.13",
43
+ "@ndla/notion": "^4.0.14",
44
44
  "@ndla/safelink": "^3.0.12",
45
45
  "@ndla/switch": "^1.0.1",
46
46
  "@ndla/tabs": "^2.0.8",
47
- "@ndla/tooltip": "^3.0.2",
47
+ "@ndla/tooltip": "^3.0.3",
48
48
  "@ndla/types-learningpath-api": "^0.0.13",
49
49
  "@ndla/util": "^3.1.7",
50
50
  "@reach/menu-button": "^0.16.2",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "ca95292ccece036a5da6c3d4b5c494b35171a71f"
89
+ "gitHead": "d915f0ffc2983d60515a14ee674f88d74e401a8b"
90
90
  }
@@ -6,13 +6,12 @@
6
6
  *
7
7
  */
8
8
 
9
- // N.B These component is used to render static markup serverside
9
+ // N.B These components is used to render static markup serverside
10
10
  // Any interactivty is added by scripts located in the ndla-article-scripts package
11
11
 
12
12
  import React, { ReactNode } from 'react';
13
13
  import BEMHelper from 'react-bem-helper';
14
14
  import { isFunction as isFunctionHelper, parseMarkdown } from '@ndla/util';
15
- import { useTranslation } from 'react-i18next';
16
15
  import { Link as LinkIcon } from '@ndla/icons/common';
17
16
  import { LicenseByline } from '@ndla/licenses';
18
17
  import SafeLink from '@ndla/safelink';
@@ -36,9 +35,8 @@ export const FigureCaption = ({
36
35
  hideFigcaption,
37
36
  hasLinkedVideo,
38
37
  hideIconsAndAuthors,
38
+ linkedVideoMessages,
39
39
  }: FigureCaptionProps) => {
40
- const { t } = useTranslation();
41
-
42
40
  return (
43
41
  <figcaption {...classes('caption', hideFigcaption && !isMobile ? 'hidden-caption' : undefined)}>
44
42
  {caption ? <div {...classes('info')}>{parseMarkdown(caption)}</div> : null}
@@ -66,8 +64,8 @@ export const FigureCaption = ({
66
64
  size="small"
67
65
  type="button"
68
66
  {...classes('toggleAlternativeVideo')}>
69
- <span className="original">{t('figure.button.alternative')}</span>
70
- <span className="alternative hidden">{t('figure.button.original')}</span>
67
+ <span className="original">{linkedVideoMessages?.alternative}</span>
68
+ <span className="alternative hidden">{linkedVideoMessages?.original}</span>
71
69
  </Button>
72
70
  )}
73
71
  </div>
@@ -122,6 +120,10 @@ interface FigureCaptionProps {
122
120
  hideFigcaption?: boolean;
123
121
  hasLinkedVideo?: boolean;
124
122
  hideIconsAndAuthors?: boolean;
123
+ linkedVideoMessages?: {
124
+ original: string;
125
+ alternative: string;
126
+ };
125
127
  }
126
128
 
127
129
  const Figure = ({ children, type = 'full', resizeIframe, ...rest }: Props) => {