@ndla/ui 3.3.13 → 3.3.14
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.
- package/es/Figure/Figure.js +3 -1
- package/es/NDLAFilm/AboutNdlaFilm.js +6 -17
- package/es/NDLAFilm/AllMoviesAlphabetically.js +11 -11
- package/es/NDLAFilm/CategorySelect.js +17 -18
- package/es/NDLAFilm/FilmContentCard.js +8 -22
- package/es/NDLAFilm/FilmContentCardTags.js +4 -8
- package/es/NDLAFilm/FilmMovieList.js +6 -21
- package/es/NDLAFilm/FilmMovieSearch.js +18 -26
- package/es/NDLAFilm/MovieGrid.js +10 -19
- package/es/NDLAFilm/VisualElement.js +22 -29
- package/es/TopicIntroductionList/TopicIntroduction.js +14 -33
- package/es/TopicIntroductionList/TopicIntroductionList.js +6 -23
- package/es/TopicIntroductionList/TopicIntroductionShortcuts.js +71 -110
- package/es/TopicIntroductionList/TopicShortcutItem.js +0 -9
- package/es/all.css +1 -4
- package/es/index-javascript.js +1 -5
- package/es/index.js +4 -0
- package/es/shapes.js +0 -6
- package/lib/Figure/Figure.js +3 -1
- package/lib/NDLAFilm/AboutNdlaFilm.d.ts +15 -0
- package/lib/NDLAFilm/AboutNdlaFilm.js +6 -18
- package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +2 -2
- package/lib/NDLAFilm/AllMoviesAlphabetically.js +11 -11
- package/lib/NDLAFilm/CategorySelect.d.ts +11 -0
- package/lib/NDLAFilm/CategorySelect.js +20 -19
- package/lib/NDLAFilm/FilmContentCard.d.ts +11 -0
- package/lib/NDLAFilm/FilmContentCard.js +8 -23
- package/lib/NDLAFilm/FilmContentCardTags.d.ts +7 -0
- package/lib/NDLAFilm/FilmContentCardTags.js +4 -9
- package/lib/NDLAFilm/FilmMovieList.d.ts +19 -0
- package/lib/NDLAFilm/FilmMovieList.js +5 -21
- package/lib/NDLAFilm/FilmMovieSearch.d.ts +21 -0
- package/lib/NDLAFilm/FilmMovieSearch.js +25 -30
- package/lib/NDLAFilm/FilmSlideshow.d.ts +5 -5
- package/lib/NDLAFilm/MovieGrid.d.ts +13 -0
- package/lib/NDLAFilm/MovieGrid.js +9 -21
- package/lib/NDLAFilm/SlideshowIndicator.d.ts +2 -2
- package/lib/NDLAFilm/VisualElement.d.ts +16 -0
- package/lib/NDLAFilm/VisualElement.js +22 -30
- package/lib/NDLAFilm/index.d.ts +14 -0
- package/lib/NDLAFilm/types.d.ts +6 -4
- package/lib/TopicIntroductionList/TopicIntroduction.d.ts +21 -0
- package/lib/TopicIntroductionList/TopicIntroduction.js +16 -36
- package/lib/TopicIntroductionList/TopicIntroductionList.d.ts +35 -0
- package/lib/TopicIntroductionList/TopicIntroductionList.js +6 -25
- package/lib/TopicIntroductionList/TopicIntroductionShortcuts.d.ts +8 -0
- package/lib/TopicIntroductionList/TopicIntroductionShortcuts.js +72 -110
- package/lib/TopicIntroductionList/TopicShortcutItem.d.ts +6 -0
- package/lib/TopicIntroductionList/TopicShortcutItem.js +0 -11
- package/lib/TopicIntroductionList/index.d.ts +9 -0
- package/lib/all.css +1 -4
- package/lib/index-javascript.js +3 -137
- package/lib/index.d.ts +4 -0
- package/lib/index.js +155 -0
- package/lib/shapes.js +1 -10
- package/package.json +10 -10
- package/src/Figure/Figure.tsx +2 -1
- package/src/Figure/component.figure.scss +37 -3
- package/src/NDLAFilm/{AboutNdlaFilm.jsx → AboutNdlaFilm.tsx} +19 -18
- package/src/NDLAFilm/AllMoviesAlphabetically.tsx +3 -3
- package/src/NDLAFilm/{CategorySelect.jsx → CategorySelect.tsx} +23 -20
- package/src/NDLAFilm/{FilmContentCard.jsx → FilmContentCard.tsx} +21 -21
- package/src/NDLAFilm/{FilmContentCardTags.jsx → FilmContentCardTags.tsx} +7 -7
- package/src/NDLAFilm/{FilmMovieList.jsx → FilmMovieList.tsx} +17 -27
- package/src/NDLAFilm/FilmMovieSearch.tsx +71 -0
- package/src/NDLAFilm/FilmSlideshow.tsx +6 -6
- package/src/NDLAFilm/MovieGrid.tsx +76 -0
- package/src/NDLAFilm/SlideshowIndicator.tsx +2 -2
- package/src/NDLAFilm/VisualElement.tsx +40 -0
- package/src/NDLAFilm/{index.js → index.ts} +0 -0
- package/src/NDLAFilm/types.ts +7 -4
- package/src/TopicIntroductionList/{TopicIntroduction.jsx → TopicIntroduction.tsx} +22 -35
- package/src/TopicIntroductionList/{TopicIntroductionList.jsx → TopicIntroductionList.tsx} +32 -26
- package/src/TopicIntroductionList/TopicIntroductionShortcuts.tsx +71 -0
- package/src/TopicIntroductionList/{TopicShortcutItem.jsx → TopicShortcutItem.tsx} +5 -13
- package/src/TopicIntroductionList/{index.js → index.ts} +0 -0
- package/src/index-javascript.js +0 -30
- package/src/index.ts +31 -0
- package/src/shapes.js +0 -7
- package/es/NDLAFilm/interfaces.js +0 -0
- package/es/NDLAFilm/shapes.js +0 -15
- package/lib/NDLAFilm/interfaces.d.ts +0 -10
- package/lib/NDLAFilm/interfaces.js +0 -1
- package/lib/NDLAFilm/shapes.d.ts +0 -15
- package/lib/NDLAFilm/shapes.js +0 -30
- package/src/NDLAFilm/FilmMovieSearch.jsx +0 -66
- package/src/NDLAFilm/MovieGrid.jsx +0 -75
- package/src/NDLAFilm/VisualElement.jsx +0 -48
- package/src/NDLAFilm/interfaces.ts +0 -10
- package/src/NDLAFilm/shapes.ts +0 -17
- package/src/TopicIntroductionList/TopicIntroductionShortcuts.jsx +0 -92
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { MovieType } from './types';
|
|
9
9
|
interface Props {
|
|
10
|
-
slideshow:
|
|
10
|
+
slideshow: MovieType[];
|
|
11
11
|
activeSlide: number;
|
|
12
12
|
gotoSlide: (indexTarget: number, useAnimation: boolean) => void;
|
|
13
13
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2019-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
interface Props {
|
|
9
|
+
visualElement: {
|
|
10
|
+
alt?: string;
|
|
11
|
+
url: string;
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const VisualElement: ({ visualElement }: Props) => JSX.Element | null;
|
|
16
|
+
export default VisualElement;
|
|
@@ -9,9 +9,7 @@ var _styledBase = _interopRequireDefault(require("@emotion/styled-base"));
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _ui = require("@ndla/ui");
|
|
12
|
+
var _Image = _interopRequireDefault(require("../Image"));
|
|
15
13
|
|
|
16
14
|
var _core = require("@emotion/core");
|
|
17
15
|
|
|
@@ -20,7 +18,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
20
18
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
21
19
|
|
|
22
20
|
var StylediFrame = (0, _styledBase["default"])("iframe", {
|
|
23
|
-
target: "
|
|
21
|
+
target: "evqj21c0",
|
|
24
22
|
label: "StylediFrame"
|
|
25
23
|
})(process.env.NODE_ENV === "production" ? {
|
|
26
24
|
name: "j04t3l",
|
|
@@ -28,39 +26,33 @@ var StylediFrame = (0, _styledBase["default"])("iframe", {
|
|
|
28
26
|
} : {
|
|
29
27
|
name: "j04t3l",
|
|
30
28
|
styles: "height:100%;width:100%;border:0;margin:0;padding:0;",
|
|
31
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
29
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlZpc3VhbEVsZW1lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVlrQyIsImZpbGUiOiJWaXN1YWxFbGVtZW50LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDE5LXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKi9cblxuaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCBJbWFnZSBmcm9tICcuLi9JbWFnZSc7XG5cbmNvbnN0IFN0eWxlZGlGcmFtZSA9IHN0eWxlZC5pZnJhbWVgXG4gIGhlaWdodDogMTAwJTtcbiAgd2lkdGg6IDEwMCU7XG4gIGJvcmRlcjogMDtcbiAgbWFyZ2luOiAwO1xuICBwYWRkaW5nOiAwO1xuYDtcblxuaW50ZXJmYWNlIFByb3BzIHtcbiAgdmlzdWFsRWxlbWVudDoge1xuICAgIGFsdD86IHN0cmluZztcbiAgICB1cmw6IHN0cmluZztcbiAgICB0eXBlOiBzdHJpbmc7XG4gIH07XG59XG5jb25zdCBWaXN1YWxFbGVtZW50ID0gKHsgdmlzdWFsRWxlbWVudCB9OiBQcm9wcykgPT4ge1xuICBjb25zdCB7IHR5cGUsIHVybCwgYWx0IH0gPSB2aXN1YWxFbGVtZW50O1xuICBpZiAodHlwZSA9PT0gJ2ltYWdlJykge1xuICAgIHJldHVybiA8SW1hZ2Ugc3JjPXt1cmx9IGFsdD17YWx0ID8/ICcnfSAvPjtcbiAgfSBlbHNlIGlmICh0eXBlID09PSAnYnJpZ2h0Y292ZScpIHtcbiAgICAvL0B0cy1pZ25vcmUgcmVhY3QgZG9lcyBub3QgcmVjb2duaXplIGZ1bGxzY3JlZW4gcHJvcGVydGllcy5cbiAgICByZXR1cm4gPFN0eWxlZGlGcmFtZSBhbGxvd2Z1bGxzY3JlZW49XCJ0cnVlXCIgd2Via2l0YWxsb3dmdWxsc2NyZWVuPVwidHJ1ZVwiIG1vemFsbG93ZnVsbHNjcmVlbj1cInRydWVcIiBzcmM9e3VybH0gLz47XG4gIH0gZWxzZSB7XG4gICAgcmV0dXJuIG51bGw7XG4gIH1cbn07XG5cbmV4cG9ydCBkZWZhdWx0IFZpc3VhbEVsZW1lbnQ7XG4iXX0= */",
|
|
32
30
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
33
31
|
});
|
|
34
32
|
|
|
35
33
|
var VisualElement = function VisualElement(_ref) {
|
|
36
34
|
var visualElement = _ref.visualElement;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
var type = visualElement.type,
|
|
36
|
+
url = visualElement.url,
|
|
37
|
+
alt = visualElement.alt;
|
|
38
|
+
|
|
39
|
+
if (type === 'image') {
|
|
40
|
+
return (0, _core.jsx)(_Image["default"], {
|
|
41
|
+
src: url,
|
|
42
|
+
alt: alt !== null && alt !== void 0 ? alt : ''
|
|
43
|
+
});
|
|
44
|
+
} else if (type === 'brightcove') {
|
|
45
|
+
//@ts-ignore react does not recognize fullscreen properties.
|
|
46
|
+
return (0, _core.jsx)(StylediFrame, {
|
|
47
|
+
allowfullscreen: "true",
|
|
48
|
+
webkitallowfullscreen: "true",
|
|
49
|
+
mozallowfullscreen: "true",
|
|
50
|
+
src: url
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
return null;
|
|
55
54
|
}
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
VisualElement.propTypes = {
|
|
59
|
-
visualElement: _propTypes["default"].shape({
|
|
60
|
-
url: _propTypes["default"].string,
|
|
61
|
-
alt: _propTypes["default"].string,
|
|
62
|
-
type: _propTypes["default"].string
|
|
63
|
-
}).isRequired
|
|
64
|
-
};
|
|
65
57
|
var _default = VisualElement;
|
|
66
58
|
exports["default"] = _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import FilmSlideshow from './FilmSlideshow';
|
|
9
|
+
import MovieGrid from './MovieGrid';
|
|
10
|
+
import AboutNdlaFilm from './AboutNdlaFilm';
|
|
11
|
+
import FilmMovieSearch from './FilmMovieSearch';
|
|
12
|
+
import FilmMovieList from './FilmMovieList';
|
|
13
|
+
import AllMoviesAlphabetically from './AllMoviesAlphabetically';
|
|
14
|
+
export { FilmSlideshow, MovieGrid, AboutNdlaFilm, FilmMovieSearch, FilmMovieList, AllMoviesAlphabetically };
|
package/lib/NDLAFilm/types.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface MovieType {
|
|
2
2
|
id: string;
|
|
3
3
|
metaDescription: string;
|
|
4
|
+
resourceTypes: MovieResourceType[];
|
|
4
5
|
metaImage: {
|
|
5
6
|
alt: string;
|
|
6
7
|
url: string;
|
|
7
8
|
};
|
|
8
|
-
movieTypes: {
|
|
9
|
-
[key: string]: boolean;
|
|
10
|
-
};
|
|
11
9
|
path: string;
|
|
12
10
|
title: string;
|
|
13
11
|
}
|
|
12
|
+
export interface MovieResourceType {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import { Shortcut, Topic } from './TopicIntroductionList';
|
|
9
|
+
interface Props {
|
|
10
|
+
additional?: boolean;
|
|
11
|
+
showAdditionalCores?: boolean;
|
|
12
|
+
topic: Topic;
|
|
13
|
+
toTopic: (id: string) => string;
|
|
14
|
+
subjectPage?: boolean;
|
|
15
|
+
shortcuts?: Shortcut[];
|
|
16
|
+
twoColumns?: boolean;
|
|
17
|
+
shortcutAlwaysExpanded?: boolean;
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const TopicIntroduction: ({ toTopic, topic, subjectPage, shortcuts, shortcutAlwaysExpanded, additional, showAdditionalCores, id, }: Props) => JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -7,18 +7,16 @@ exports.TopicIntroduction = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
13
11
|
|
|
12
|
+
var _reactI18next = require("react-i18next");
|
|
13
|
+
|
|
14
14
|
var _common = require("@ndla/icons/common");
|
|
15
15
|
|
|
16
16
|
var _tooltip = _interopRequireDefault(require("@ndla/tooltip"));
|
|
17
17
|
|
|
18
18
|
var _safelink = _interopRequireDefault(require("@ndla/safelink"));
|
|
19
19
|
|
|
20
|
-
var _shapes = require("../shapes");
|
|
21
|
-
|
|
22
20
|
var _TopicIntroductionShortcuts = _interopRequireDefault(require("./TopicIntroductionShortcuts"));
|
|
23
21
|
|
|
24
22
|
var _core = require("@emotion/core");
|
|
@@ -43,15 +41,20 @@ var TopicIntroduction = function TopicIntroduction(_ref) {
|
|
|
43
41
|
topic = _ref.topic,
|
|
44
42
|
subjectPage = _ref.subjectPage,
|
|
45
43
|
shortcuts = _ref.shortcuts,
|
|
46
|
-
messages = _ref.messages,
|
|
47
44
|
shortcutAlwaysExpanded = _ref.shortcutAlwaysExpanded,
|
|
48
|
-
additional = _ref.additional,
|
|
49
|
-
|
|
45
|
+
_ref$additional = _ref.additional,
|
|
46
|
+
additional = _ref$additional === void 0 ? false : _ref$additional,
|
|
47
|
+
_ref$showAdditionalCo = _ref.showAdditionalCores,
|
|
48
|
+
showAdditionalCores = _ref$showAdditionalCo === void 0 ? false : _ref$showAdditionalCo,
|
|
50
49
|
id = _ref.id;
|
|
51
|
-
|
|
50
|
+
|
|
51
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
52
|
+
t = _useTranslation.t;
|
|
53
|
+
|
|
54
|
+
var contentTypeDescription = t(additional ? 'resource.tooltipAdditionalTopic' : 'resource.tooltipCoreTopic');
|
|
52
55
|
return (0, _core.jsx)("li", {
|
|
53
56
|
className: topicClasses('item', {
|
|
54
|
-
subjectPage: subjectPage,
|
|
57
|
+
subjectPage: !!subjectPage,
|
|
55
58
|
additional: additional,
|
|
56
59
|
showAdditionalCores: showAdditionalCores
|
|
57
60
|
})
|
|
@@ -68,12 +71,12 @@ var TopicIntroduction = function TopicIntroduction(_ref) {
|
|
|
68
71
|
id: id,
|
|
69
72
|
hidden: true
|
|
70
73
|
}, contentTypeDescription), additional && (0, _core.jsx)(_tooltip["default"], {
|
|
71
|
-
tooltip:
|
|
74
|
+
tooltip: t('resource.tooltipAdditionalTopic'),
|
|
72
75
|
align: "left"
|
|
73
76
|
}, (0, _core.jsx)(_common.Additional, {
|
|
74
77
|
className: "c-icon--20 u-margin-left-tiny"
|
|
75
78
|
})), !additional && showAdditionalCores && (0, _core.jsx)(_tooltip["default"], {
|
|
76
|
-
tooltip:
|
|
79
|
+
tooltip: t('resource.tooltipCoreTopic'),
|
|
77
80
|
align: "left"
|
|
78
81
|
}, (0, _core.jsx)(_common.Core, {
|
|
79
82
|
className: "c-icon--20 u-margin-left-tiny"
|
|
@@ -86,34 +89,11 @@ var TopicIntroduction = function TopicIntroduction(_ref) {
|
|
|
86
89
|
}), shortcuts && (0, _core.jsx)(_TopicIntroductionShortcuts["default"], {
|
|
87
90
|
alwaysExpanded: shortcutAlwaysExpanded,
|
|
88
91
|
id: "".concat(topic.id, "_shortcuts"),
|
|
89
|
-
shortcuts: shortcuts
|
|
90
|
-
messages: {
|
|
91
|
-
toggleButtonText: messages.shortcutButtonText
|
|
92
|
-
}
|
|
92
|
+
shortcuts: shortcuts
|
|
93
93
|
})), topic.metaImage && (0, _core.jsx)("div", null, (0, _core.jsx)("img", {
|
|
94
94
|
src: topic.metaImage.url,
|
|
95
95
|
alt: topic.metaImage.alt
|
|
96
96
|
})))));
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
exports.TopicIntroduction = TopicIntroduction;
|
|
100
|
-
TopicIntroduction.propTypes = {
|
|
101
|
-
additional: _propTypes["default"].bool,
|
|
102
|
-
showAdditionalCores: _propTypes["default"].bool,
|
|
103
|
-
messages: _propTypes["default"].shape({
|
|
104
|
-
shortcutButtonText: _propTypes["default"].string.isRequired,
|
|
105
|
-
tooltipAdditionalTopic: _propTypes["default"].string,
|
|
106
|
-
tooltipCoreTopic: _propTypes["default"].string
|
|
107
|
-
}),
|
|
108
|
-
topic: _shapes.TopicShape.isRequired,
|
|
109
|
-
toTopic: _propTypes["default"].func.isRequired,
|
|
110
|
-
subjectPage: _propTypes["default"].bool,
|
|
111
|
-
shortcuts: _propTypes["default"].arrayOf(_shapes.ShortcutShape),
|
|
112
|
-
twoColumns: _propTypes["default"].bool,
|
|
113
|
-
shortcutAlwaysExpanded: _propTypes["default"].bool,
|
|
114
|
-
id: _propTypes["default"].string.isRequired
|
|
115
|
-
};
|
|
116
|
-
TopicIntroduction.defaultProps = {
|
|
117
|
-
showAdditionalCores: false,
|
|
118
|
-
additional: false
|
|
119
|
-
};
|
|
99
|
+
exports.TopicIntroduction = TopicIntroduction;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present, NDLA.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export interface Shortcut {
|
|
9
|
+
id: string | number;
|
|
10
|
+
tooltip: string;
|
|
11
|
+
contentType: string;
|
|
12
|
+
url: string;
|
|
13
|
+
count: number;
|
|
14
|
+
}
|
|
15
|
+
export interface Topic {
|
|
16
|
+
name: string;
|
|
17
|
+
id: string;
|
|
18
|
+
additional?: boolean;
|
|
19
|
+
shortcuts?: Shortcut[];
|
|
20
|
+
introduction: string;
|
|
21
|
+
metaImage?: {
|
|
22
|
+
url?: string;
|
|
23
|
+
alt?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface Props {
|
|
27
|
+
toTopic: (id: string) => string;
|
|
28
|
+
topics: Topic[];
|
|
29
|
+
twoColumns?: boolean;
|
|
30
|
+
shortcutAlwaysExpanded?: boolean;
|
|
31
|
+
showAdditionalCores?: boolean;
|
|
32
|
+
toggleAdditionalCores?: () => void;
|
|
33
|
+
}
|
|
34
|
+
declare const TopicIntroductionList: ({ topics, twoColumns, shortcutAlwaysExpanded, showAdditionalCores, toggleAdditionalCores, ...rest }: Props) => JSX.Element;
|
|
35
|
+
export default TopicIntroductionList;
|
|
@@ -7,16 +7,12 @@ exports["default"] = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
13
11
|
|
|
14
12
|
var _reactI18next = require("react-i18next");
|
|
15
13
|
|
|
16
14
|
var _NoContentBox = _interopRequireDefault(require("../NoContentBox"));
|
|
17
15
|
|
|
18
|
-
var _shapes = require("../shapes");
|
|
19
|
-
|
|
20
16
|
var _TopicIntroduction = require("./TopicIntroduction");
|
|
21
17
|
|
|
22
18
|
var _core = require("@emotion/core");
|
|
@@ -37,9 +33,12 @@ var topicClasses = new _reactBemHelper["default"]({
|
|
|
37
33
|
|
|
38
34
|
var TopicIntroductionList = function TopicIntroductionList(_ref) {
|
|
39
35
|
var topics = _ref.topics,
|
|
40
|
-
twoColumns = _ref.twoColumns,
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
_ref$twoColumns = _ref.twoColumns,
|
|
37
|
+
twoColumns = _ref$twoColumns === void 0 ? false : _ref$twoColumns,
|
|
38
|
+
_ref$shortcutAlwaysEx = _ref.shortcutAlwaysExpanded,
|
|
39
|
+
shortcutAlwaysExpanded = _ref$shortcutAlwaysEx === void 0 ? false : _ref$shortcutAlwaysEx,
|
|
40
|
+
_ref$showAdditionalCo = _ref.showAdditionalCores,
|
|
41
|
+
showAdditionalCores = _ref$showAdditionalCo === void 0 ? false : _ref$showAdditionalCo,
|
|
43
42
|
toggleAdditionalCores = _ref.toggleAdditionalCores,
|
|
44
43
|
rest = _objectWithoutProperties(_ref, ["topics", "twoColumns", "shortcutAlwaysExpanded", "showAdditionalCores", "toggleAdditionalCores"]);
|
|
45
44
|
|
|
@@ -66,11 +65,6 @@ var TopicIntroductionList = function TopicIntroductionList(_ref) {
|
|
|
66
65
|
additional: additional,
|
|
67
66
|
showAdditionalCores: showAdditionalCores,
|
|
68
67
|
shortcutAlwaysExpanded: shortcutAlwaysExpanded,
|
|
69
|
-
messages: {
|
|
70
|
-
shortcutButtonText: t('resource.label'),
|
|
71
|
-
tooltipAdditionalTopic: t('resource.tooltipAdditionalTopic'),
|
|
72
|
-
tooltipCoreTopic: t('resource.tooltipCoreTopic')
|
|
73
|
-
},
|
|
74
68
|
id: "".concat(topic.id, "_").concat(index)
|
|
75
69
|
}));
|
|
76
70
|
}), renderAdditionalTopicsTrigger && (0, _core.jsx)("li", null, (0, _core.jsx)(_NoContentBox["default"], {
|
|
@@ -80,18 +74,5 @@ var TopicIntroductionList = function TopicIntroductionList(_ref) {
|
|
|
80
74
|
})));
|
|
81
75
|
};
|
|
82
76
|
|
|
83
|
-
TopicIntroductionList.propTypes = {
|
|
84
|
-
toTopic: _propTypes["default"].func.isRequired,
|
|
85
|
-
topics: _propTypes["default"].arrayOf(_shapes.TopicShape).isRequired,
|
|
86
|
-
twoColumns: _propTypes["default"].bool,
|
|
87
|
-
shortcutAlwaysExpanded: _propTypes["default"].bool,
|
|
88
|
-
showAdditionalCores: _propTypes["default"].bool,
|
|
89
|
-
toggleAdditionalCores: _propTypes["default"].func.isRequired
|
|
90
|
-
};
|
|
91
|
-
TopicIntroductionList.defaultProps = {
|
|
92
|
-
twoColumns: false,
|
|
93
|
-
shortcutAlwaysExpanded: false,
|
|
94
|
-
showAdditionalCores: false
|
|
95
|
-
};
|
|
96
77
|
var _default = TopicIntroductionList;
|
|
97
78
|
exports["default"] = _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Shortcut } from './TopicIntroductionList';
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
4
|
+
alwaysExpanded?: boolean;
|
|
5
|
+
shortcuts: Shortcut[];
|
|
6
|
+
}
|
|
7
|
+
declare const TopicIntroductionShortcuts: ({ id, alwaysExpanded, shortcuts }: Props) => JSX.Element;
|
|
8
|
+
export default TopicIntroductionShortcuts;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -7,7 +9,7 @@ exports["default"] = void 0;
|
|
|
7
9
|
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _reactI18next = require("react-i18next");
|
|
11
13
|
|
|
12
14
|
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
13
15
|
|
|
@@ -15,8 +17,6 @@ var _common = require("@ndla/icons/common");
|
|
|
15
17
|
|
|
16
18
|
var _TopicShortcutItem = _interopRequireDefault(require("./TopicShortcutItem"));
|
|
17
19
|
|
|
18
|
-
var _shapes = require("../shapes");
|
|
19
|
-
|
|
20
20
|
var _core = require("@emotion/core");
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -25,131 +25,93 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
|
|
27
27
|
|
|
28
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
29
|
-
|
|
30
28
|
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); }
|
|
31
29
|
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
35
|
-
|
|
36
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
37
|
-
|
|
38
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
39
|
-
|
|
40
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
41
31
|
|
|
42
|
-
function
|
|
32
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
43
33
|
|
|
44
|
-
function
|
|
34
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
45
35
|
|
|
46
|
-
function
|
|
36
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
47
37
|
|
|
48
|
-
function
|
|
38
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; 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; }
|
|
49
39
|
|
|
50
|
-
function
|
|
40
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
51
41
|
|
|
52
42
|
var classes = new _reactBemHelper["default"]({
|
|
53
43
|
name: 'topic-shortcuts',
|
|
54
44
|
prefix: 'c-'
|
|
55
45
|
});
|
|
56
46
|
|
|
57
|
-
var TopicIntroductionShortcuts =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
47
|
+
var TopicIntroductionShortcuts = function TopicIntroductionShortcuts(_ref) {
|
|
48
|
+
var id = _ref.id,
|
|
49
|
+
_ref$alwaysExpanded = _ref.alwaysExpanded,
|
|
50
|
+
alwaysExpanded = _ref$alwaysExpanded === void 0 ? false : _ref$alwaysExpanded,
|
|
51
|
+
shortcuts = _ref.shortcuts;
|
|
52
|
+
|
|
53
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
54
|
+
t = _useTranslation.t;
|
|
55
|
+
|
|
56
|
+
var _useState = (0, _react.useState)(alwaysExpanded),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
open = _useState2[0],
|
|
59
|
+
setOpen = _useState2[1];
|
|
60
|
+
|
|
61
|
+
var _useState3 = (0, _react.useState)(false),
|
|
62
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
+
returned = _useState4[0],
|
|
64
|
+
setReturned = _useState4[1];
|
|
65
|
+
|
|
66
|
+
var _useState5 = (0, _react.useState)(true),
|
|
67
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
68
|
+
showButtonText = _useState6[0],
|
|
69
|
+
setShowButtonText = _useState6[1];
|
|
70
|
+
|
|
71
|
+
var handleOnToggle = function handleOnToggle(newOpen) {
|
|
72
|
+
setOpen(newOpen);
|
|
73
|
+
setShowButtonText(!newOpen);
|
|
74
|
+
setReturned(!newOpen);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var onMouseEnter = undefined;
|
|
78
|
+
var onMouseLeave = undefined;
|
|
79
|
+
var buttonView = null;
|
|
80
|
+
|
|
81
|
+
if (!alwaysExpanded) {
|
|
82
|
+
onMouseEnter = function onMouseEnter() {
|
|
83
|
+
return handleOnToggle(true);
|
|
84
|
+
};
|
|
66
85
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
open: props.alwaysExpanded,
|
|
70
|
-
returned: false,
|
|
71
|
-
showButtonText: true
|
|
86
|
+
onMouseLeave = function onMouseLeave() {
|
|
87
|
+
return handleOnToggle(false);
|
|
72
88
|
};
|
|
73
|
-
_this.handleOnToggle = _this.handleOnToggle.bind(_assertThisInitialized(_this));
|
|
74
|
-
return _this;
|
|
75
|
-
}
|
|
76
89
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}, {
|
|
87
|
-
key: "render",
|
|
88
|
-
value: function render() {
|
|
89
|
-
var _this2 = this;
|
|
90
|
-
|
|
91
|
-
var _this$props = this.props,
|
|
92
|
-
shortcuts = _this$props.shortcuts,
|
|
93
|
-
messages = _this$props.messages,
|
|
94
|
-
id = _this$props.id,
|
|
95
|
-
alwaysExpanded = _this$props.alwaysExpanded;
|
|
96
|
-
var _this$state = this.state,
|
|
97
|
-
open = _this$state.open,
|
|
98
|
-
returned = _this$state.returned,
|
|
99
|
-
showButtonText = _this$state.showButtonText;
|
|
100
|
-
var onMouseEnter = null;
|
|
101
|
-
var onMouseLeave = null;
|
|
102
|
-
var buttonView = null;
|
|
103
|
-
|
|
104
|
-
if (!alwaysExpanded) {
|
|
105
|
-
onMouseEnter = function onMouseEnter() {
|
|
106
|
-
return _this2.handleOnToggle(true);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
onMouseLeave = function onMouseLeave() {
|
|
110
|
-
return _this2.handleOnToggle(false);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
buttonView = (0, _core.jsx)("button", _extends({
|
|
114
|
-
type: "button",
|
|
115
|
-
"aria-expanded": this.state.open,
|
|
116
|
-
"aria-label": messages.toggleButtonText,
|
|
117
|
-
"aria-controls": id
|
|
118
|
-
}, classes('button', returned ? 're-enter' : ''), {
|
|
119
|
-
onClick: function onClick() {
|
|
120
|
-
_this2.handleOnToggle(!open);
|
|
121
|
-
}
|
|
122
|
-
}), (0, _core.jsx)(_common.Forward, null), showButtonText && (0, _core.jsx)("span", classes('label'), messages.toggleButtonText));
|
|
90
|
+
buttonView = (0, _core.jsx)("button", _extends({
|
|
91
|
+
type: "button",
|
|
92
|
+
"aria-expanded": open,
|
|
93
|
+
"aria-label": t('resource.label'),
|
|
94
|
+
"aria-controls": id
|
|
95
|
+
}, classes('button', returned ? 're-enter' : ''), {
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
return handleOnToggle(!open);
|
|
123
98
|
}
|
|
99
|
+
}), (0, _core.jsx)(_common.Forward, null), showButtonText && (0, _core.jsx)("span", classes('label'), t('resource.label')));
|
|
100
|
+
}
|
|
124
101
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
}]);
|
|
139
|
-
|
|
140
|
-
return TopicIntroductionShortcuts;
|
|
141
|
-
}(_react.Component);
|
|
142
|
-
|
|
143
|
-
TopicIntroductionShortcuts.propTypes = {
|
|
144
|
-
id: _propTypes["default"].string.isRequired,
|
|
145
|
-
alwaysExpanded: _propTypes["default"].bool,
|
|
146
|
-
messages: _propTypes["default"].shape({
|
|
147
|
-
toggleButtonText: _propTypes["default"].string.isRequired
|
|
148
|
-
}),
|
|
149
|
-
shortcuts: _propTypes["default"].arrayOf(_shapes.ShortcutShape).isRequired
|
|
150
|
-
};
|
|
151
|
-
TopicIntroductionShortcuts.defaultProps = {
|
|
152
|
-
alwaysExpanded: false
|
|
102
|
+
return (0, _core.jsx)("div", _extends({
|
|
103
|
+
onMouseEnter: onMouseEnter,
|
|
104
|
+
onMouseLeave: onMouseLeave
|
|
105
|
+
}, classes()), buttonView, open && (0, _core.jsx)("ul", {
|
|
106
|
+
className: classes('list', open ? 'visible' : '').className
|
|
107
|
+
}, shortcuts.map(function (shortcut) {
|
|
108
|
+
return (0, _core.jsx)("li", _extends({}, classes('item'), {
|
|
109
|
+
key: shortcut.id
|
|
110
|
+
}), (0, _core.jsx)(_TopicShortcutItem["default"], {
|
|
111
|
+
shortcut: shortcut
|
|
112
|
+
}));
|
|
113
|
+
})));
|
|
153
114
|
};
|
|
115
|
+
|
|
154
116
|
var _default = TopicIntroductionShortcuts;
|
|
155
117
|
exports["default"] = _default;
|
|
@@ -7,8 +7,6 @@ exports["default"] = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
13
11
|
|
|
14
12
|
var _tooltip = _interopRequireDefault(require("@ndla/tooltip"));
|
|
@@ -19,8 +17,6 @@ var _reactI18next = require("react-i18next");
|
|
|
19
17
|
|
|
20
18
|
var _ContentTypeBadge = _interopRequireDefault(require("../ContentTypeBadge"));
|
|
21
19
|
|
|
22
|
-
var _shapes = require("../shapes");
|
|
23
|
-
|
|
24
20
|
var _core = require("@emotion/core");
|
|
25
21
|
|
|
26
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -60,12 +56,5 @@ var ShortcutItem = function ShortcutItem(_ref) {
|
|
|
60
56
|
}), (0, _core.jsx)("span", classes('count'), count)));
|
|
61
57
|
};
|
|
62
58
|
|
|
63
|
-
ShortcutItem.propTypes = {
|
|
64
|
-
shortcut: _shapes.ShortcutShape.isRequired,
|
|
65
|
-
disableToolTip: _propTypes["default"].bool
|
|
66
|
-
};
|
|
67
|
-
ShortcutItem.defaultProps = {
|
|
68
|
-
disableToolTip: false
|
|
69
|
-
};
|
|
70
59
|
var _default = ShortcutItem;
|
|
71
60
|
exports["default"] = _default;
|