@ndla/video-search 2.0.10 → 2.0.11
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/PreviewVideo.js +6 -9
- package/es/VideoLoadMoreButton.js +8 -15
- package/es/VideoSearch.js +29 -64
- package/es/VideoSearchForm.js +14 -36
- package/es/VideoSearchList.js +11 -21
- package/es/VideoSearchResultBrightcove.js +10 -13
- package/es/VideoSearchResultYouTube.js +10 -15
- package/es/VideoTabs.js +11 -31
- package/es/shapes.js +1 -0
- package/es/videoHelpers.js +1 -6
- package/lib/PreviewVideo.js +4 -17
- package/lib/VideoLoadMoreButton.js +7 -22
- package/lib/VideoSearch.js +29 -78
- package/lib/VideoSearchForm.js +14 -45
- package/lib/VideoSearchList.js +10 -29
- package/lib/VideoSearchResultBrightcove.js +8 -24
- package/lib/VideoSearchResultYouTube.js +8 -25
- package/lib/VideoTabs.js +12 -39
- package/lib/index.js +0 -3
- package/lib/shapes.js +2 -9
- package/lib/videoHelpers.js +2 -15
- package/package.json +4 -4
package/es/PreviewVideo.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
|
-
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
|
|
10
4
|
/**
|
|
11
5
|
* Copyright (c) 2017-present, NDLA.
|
|
12
6
|
*
|
|
@@ -14,18 +8,21 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
14
8
|
* LICENSE file in the root directory of this source tree.
|
|
15
9
|
*
|
|
16
10
|
*/
|
|
11
|
+
|
|
17
12
|
import React from 'react';
|
|
18
13
|
import PropTypes from 'prop-types';
|
|
19
14
|
import BEMHelper from 'react-bem-helper';
|
|
20
15
|
import Button from '@ndla/button';
|
|
21
16
|
import { Cross } from '@ndla/icons/action';
|
|
17
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
22
19
|
var classes = new BEMHelper({
|
|
23
20
|
name: 'video-preview',
|
|
24
21
|
prefix: 'c-'
|
|
25
22
|
});
|
|
26
23
|
export default function PreviewVideo(_ref) {
|
|
27
24
|
var onVideoPreview = _ref.onVideoPreview,
|
|
28
|
-
|
|
25
|
+
children = _ref.children;
|
|
29
26
|
return _jsxs("div", _objectSpread(_objectSpread({}, classes()), {}, {
|
|
30
27
|
children: [_jsx(Button, _objectSpread(_objectSpread({}, classes('close')), {}, {
|
|
31
28
|
stripped: true,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
4
|
/**
|
|
10
5
|
* Copyright (c) 2017-present, NDLA.
|
|
11
6
|
*
|
|
@@ -13,27 +8,26 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
13
8
|
* LICENSE file in the root directory of this source tree.
|
|
14
9
|
*
|
|
15
10
|
*/
|
|
11
|
+
|
|
16
12
|
import React from 'react';
|
|
17
13
|
import PropTypes from 'prop-types';
|
|
18
14
|
import BEMHelper from 'react-bem-helper';
|
|
19
15
|
import Button from '@ndla/button';
|
|
20
16
|
import { BrightcoveShape, YouTubeShape } from './shapes';
|
|
17
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
21
18
|
var classes = new BEMHelper({
|
|
22
19
|
name: 'video-search',
|
|
23
20
|
prefix: 'c-'
|
|
24
21
|
});
|
|
25
|
-
|
|
26
22
|
var VideoLoadMoreButton = function VideoLoadMoreButton(props) {
|
|
27
23
|
var videos = props.videos,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
searching = props.searching,
|
|
25
|
+
limit = props.limit,
|
|
26
|
+
translations = props.translations,
|
|
27
|
+
loadMoreVideos = props.loadMoreVideos;
|
|
33
28
|
if (!videos || videos.length === 0 || videos.length % limit !== 0) {
|
|
34
29
|
return null;
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
return _jsx("div", _objectSpread(_objectSpread({}, classes('load-videos')), {}, {
|
|
38
32
|
children: _jsx(Button, {
|
|
39
33
|
disabled: searching,
|
|
@@ -42,7 +36,6 @@ var VideoLoadMoreButton = function VideoLoadMoreButton(props) {
|
|
|
42
36
|
})
|
|
43
37
|
}));
|
|
44
38
|
};
|
|
45
|
-
|
|
46
39
|
VideoLoadMoreButton.propTypes = {
|
|
47
40
|
searching: PropTypes.bool.isRequired,
|
|
48
41
|
videos: PropTypes.oneOfType([PropTypes.arrayOf(BrightcoveShape), PropTypes.arrayOf(YouTubeShape)]),
|
package/es/VideoSearch.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
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); }
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
4
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
|
|
12
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
-
|
|
14
6
|
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); } }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
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); }
|
|
19
|
-
|
|
20
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
-
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
|
-
|
|
24
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
25
|
-
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
26
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
-
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
15
|
/**
|
|
33
16
|
* Copyright (c) 2017-present, NDLA.
|
|
34
17
|
*
|
|
@@ -36,6 +19,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
36
19
|
* LICENSE file in the root directory of this source tree.
|
|
37
20
|
*
|
|
38
21
|
*/
|
|
22
|
+
|
|
39
23
|
import React, { Component } from 'react';
|
|
40
24
|
import PropTypes from 'prop-types';
|
|
41
25
|
import BEMHelper from 'react-bem-helper';
|
|
@@ -45,21 +29,18 @@ import VideoSearchList from './VideoSearchList';
|
|
|
45
29
|
import VideoLoadMoreButton from './VideoLoadMoreButton';
|
|
46
30
|
import VideoTabs from './VideoTabs';
|
|
47
31
|
import { getLastPage } from './videoHelpers';
|
|
32
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
33
|
+
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
48
34
|
var classes = new BEMHelper({
|
|
49
35
|
name: 'video-search',
|
|
50
36
|
prefix: 'c-'
|
|
51
37
|
});
|
|
52
|
-
|
|
53
38
|
var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
54
39
|
_inherits(VideoSearch, _Component);
|
|
55
|
-
|
|
56
40
|
var _super = _createSuper(VideoSearch);
|
|
57
|
-
|
|
58
41
|
function VideoSearch() {
|
|
59
42
|
var _this;
|
|
60
|
-
|
|
61
43
|
_classCallCheck(this, VideoSearch);
|
|
62
|
-
|
|
63
44
|
_this = _super.call(this);
|
|
64
45
|
_this.state = {
|
|
65
46
|
queryObject: {
|
|
@@ -83,7 +64,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
83
64
|
_this.loadMoreVideos = _this.loadMoreVideos.bind(_assertThisInitialized(_this));
|
|
84
65
|
return _this;
|
|
85
66
|
}
|
|
86
|
-
|
|
87
67
|
_createClass(VideoSearch, [{
|
|
88
68
|
key: "componentDidMount",
|
|
89
69
|
value: function componentDidMount() {
|
|
@@ -110,7 +90,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
110
90
|
key: "onSearchTypeChange",
|
|
111
91
|
value: function onSearchTypeChange(type) {
|
|
112
92
|
var queryObject;
|
|
113
|
-
|
|
114
93
|
if (type === 'youtube') {
|
|
115
94
|
queryObject = {
|
|
116
95
|
query: '',
|
|
@@ -128,7 +107,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
128
107
|
start: undefined
|
|
129
108
|
};
|
|
130
109
|
}
|
|
131
|
-
|
|
132
110
|
this.setState({
|
|
133
111
|
queryObject: queryObject,
|
|
134
112
|
selectedType: type,
|
|
@@ -141,14 +119,13 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
141
119
|
key: "loadMoreVideos",
|
|
142
120
|
value: function loadMoreVideos() {
|
|
143
121
|
var _this2 = this;
|
|
144
|
-
|
|
145
122
|
var _this$state = this.state,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
123
|
+
queryObject = _this$state.queryObject,
|
|
124
|
+
videos = _this$state.videos,
|
|
125
|
+
selectedType = _this$state.selectedType;
|
|
149
126
|
var _this$props = this.props,
|
|
150
|
-
|
|
151
|
-
|
|
127
|
+
searchVideos = _this$props.searchVideos,
|
|
128
|
+
onError = _this$props.onError;
|
|
152
129
|
this.setState({
|
|
153
130
|
searching: true
|
|
154
131
|
});
|
|
@@ -166,7 +143,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
166
143
|
});
|
|
167
144
|
})["catch"](function (err) {
|
|
168
145
|
onError(err);
|
|
169
|
-
|
|
170
146
|
_this2.setState({
|
|
171
147
|
searching: false
|
|
172
148
|
});
|
|
@@ -180,11 +156,9 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
180
156
|
});
|
|
181
157
|
var queryObject = this.state.queryObject;
|
|
182
158
|
var nextIndex = queryObject.start + (page.page - queryObject.page) * 10;
|
|
183
|
-
|
|
184
159
|
var newQueryObject = _objectSpread(_objectSpread(_objectSpread({}, queryObject), page), {}, {
|
|
185
160
|
start: nextIndex
|
|
186
161
|
});
|
|
187
|
-
|
|
188
162
|
this.searchVideos(newQueryObject);
|
|
189
163
|
}
|
|
190
164
|
}, {
|
|
@@ -193,18 +167,16 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
193
167
|
var queryObject = _objectSpread(_objectSpread({}, this.state.queryObject), {}, {
|
|
194
168
|
query: query
|
|
195
169
|
});
|
|
196
|
-
|
|
197
170
|
this.searchVideos(queryObject);
|
|
198
171
|
}
|
|
199
172
|
}, {
|
|
200
173
|
key: "searchVideos",
|
|
201
174
|
value: function searchVideos(queryObject) {
|
|
202
175
|
var _this3 = this;
|
|
203
|
-
|
|
204
176
|
var selectedType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.state.selectedType;
|
|
205
177
|
var _this$props2 = this.props,
|
|
206
|
-
|
|
207
|
-
|
|
178
|
+
searchVideos = _this$props2.searchVideos,
|
|
179
|
+
onError = _this$props2.onError;
|
|
208
180
|
searchVideos(queryObject, selectedType).then(function (result) {
|
|
209
181
|
if (selectedType === _this3.state.selectedType) {
|
|
210
182
|
_this3.setState(function (prevState) {
|
|
@@ -223,7 +195,6 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
223
195
|
}
|
|
224
196
|
})["catch"](function (err) {
|
|
225
197
|
onError(err);
|
|
226
|
-
|
|
227
198
|
_this3.setState({
|
|
228
199
|
searching: false
|
|
229
200
|
});
|
|
@@ -233,21 +204,19 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
233
204
|
key: "render",
|
|
234
205
|
value: function render() {
|
|
235
206
|
var _this4 = this;
|
|
236
|
-
|
|
237
207
|
var _this$props3 = this.props,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
208
|
+
translations = _this$props3.translations,
|
|
209
|
+
locale = _this$props3.locale,
|
|
210
|
+
enabledSources = _this$props3.enabledSources;
|
|
241
211
|
var _this$state2 = this.state,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
212
|
+
queryObject = _this$state2.queryObject,
|
|
213
|
+
lastPage = _this$state2.lastPage,
|
|
214
|
+
videos = _this$state2.videos,
|
|
215
|
+
selectedVideo = _this$state2.selectedVideo,
|
|
216
|
+
selectedType = _this$state2.selectedType,
|
|
217
|
+
searching = _this$state2.searching;
|
|
248
218
|
var query = queryObject.query,
|
|
249
|
-
|
|
250
|
-
|
|
219
|
+
page = queryObject.page;
|
|
251
220
|
var paginationItem = function paginationItem() {
|
|
252
221
|
if (selectedType === 'brightcove') {
|
|
253
222
|
return _jsx(VideoLoadMoreButton, {
|
|
@@ -258,14 +227,12 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
258
227
|
translations: translations
|
|
259
228
|
});
|
|
260
229
|
}
|
|
261
|
-
|
|
262
230
|
return _jsx(Pager, {
|
|
263
231
|
page: page || 1,
|
|
264
232
|
lastPage: lastPage,
|
|
265
233
|
onClick: _this4.changeQueryPage
|
|
266
234
|
});
|
|
267
235
|
};
|
|
268
|
-
|
|
269
236
|
var searchListTabs = enabledSources.map(function (source) {
|
|
270
237
|
return {
|
|
271
238
|
title: source,
|
|
@@ -297,10 +264,8 @@ var VideoSearch = /*#__PURE__*/function (_Component) {
|
|
|
297
264
|
}));
|
|
298
265
|
}
|
|
299
266
|
}]);
|
|
300
|
-
|
|
301
267
|
return VideoSearch;
|
|
302
268
|
}(Component);
|
|
303
|
-
|
|
304
269
|
VideoSearch.propTypes = {
|
|
305
270
|
onVideoSelect: PropTypes.func.isRequired,
|
|
306
271
|
searchVideos: PropTypes.func.isRequired,
|
package/es/VideoSearchForm.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
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); }
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
4
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
|
|
12
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
-
|
|
14
6
|
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); } }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
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); }
|
|
19
|
-
|
|
20
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
-
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
|
-
|
|
24
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
25
|
-
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
26
12
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
-
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
15
|
/**
|
|
33
16
|
* Copyright (c) 2016-present, NDLA.
|
|
34
17
|
*
|
|
@@ -36,25 +19,23 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
36
19
|
* LICENSE file in the root directory of this source tree.
|
|
37
20
|
*
|
|
38
21
|
*/
|
|
22
|
+
|
|
39
23
|
import React, { Component } from 'react';
|
|
40
24
|
import PropTypes from 'prop-types';
|
|
41
25
|
import Button from '@ndla/button';
|
|
42
26
|
import BEMHelper from 'react-bem-helper';
|
|
27
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
28
|
+
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
43
29
|
var classes = new BEMHelper({
|
|
44
30
|
name: 'video-search',
|
|
45
31
|
prefix: 'c-'
|
|
46
32
|
});
|
|
47
|
-
|
|
48
33
|
var SearchForm = /*#__PURE__*/function (_Component) {
|
|
49
34
|
_inherits(SearchForm, _Component);
|
|
50
|
-
|
|
51
35
|
var _super = _createSuper(SearchForm);
|
|
52
|
-
|
|
53
36
|
function SearchForm(props) {
|
|
54
37
|
var _this;
|
|
55
|
-
|
|
56
38
|
_classCallCheck(this, SearchForm);
|
|
57
|
-
|
|
58
39
|
_this = _super.call(this, props);
|
|
59
40
|
_this.state = {
|
|
60
41
|
query: props.query
|
|
@@ -64,7 +45,6 @@ var SearchForm = /*#__PURE__*/function (_Component) {
|
|
|
64
45
|
_this.onKeyPress = _this.onKeyPress.bind(_assertThisInitialized(_this));
|
|
65
46
|
return _this;
|
|
66
47
|
}
|
|
67
|
-
|
|
68
48
|
_createClass(SearchForm, [{
|
|
69
49
|
key: "onKeyPress",
|
|
70
50
|
value: function onKeyPress(evt) {
|
|
@@ -89,8 +69,8 @@ var SearchForm = /*#__PURE__*/function (_Component) {
|
|
|
89
69
|
key: "render",
|
|
90
70
|
value: function render() {
|
|
91
71
|
var _this$props = this.props,
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
searching = _this$props.searching,
|
|
73
|
+
translations = _this$props.translations;
|
|
94
74
|
return _jsxs("div", _objectSpread(_objectSpread({}, classes('form')), {}, {
|
|
95
75
|
children: [_jsx("input", _objectSpread(_objectSpread({}, classes('form-query')), {}, {
|
|
96
76
|
type: "text",
|
|
@@ -106,10 +86,8 @@ var SearchForm = /*#__PURE__*/function (_Component) {
|
|
|
106
86
|
}));
|
|
107
87
|
}
|
|
108
88
|
}]);
|
|
109
|
-
|
|
110
89
|
return SearchForm;
|
|
111
90
|
}(Component);
|
|
112
|
-
|
|
113
91
|
SearchForm.propTypes = {
|
|
114
92
|
query: PropTypes.string,
|
|
115
93
|
searching: PropTypes.bool.isRequired,
|
package/es/VideoSearchList.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
-
|
|
9
4
|
/**
|
|
10
5
|
* Copyright (c) 2017-present, NDLA.
|
|
11
6
|
*
|
|
@@ -13,37 +8,35 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
13
8
|
* LICENSE file in the root directory of this source tree.
|
|
14
9
|
*
|
|
15
10
|
*/
|
|
11
|
+
|
|
16
12
|
import React from 'react';
|
|
17
13
|
import PropTypes from 'prop-types';
|
|
18
14
|
import BEMHelper from 'react-bem-helper';
|
|
19
15
|
import { BrightcoveShape, YouTubeShape } from './shapes';
|
|
20
16
|
import VideoSearchResultBrightcove from './VideoSearchResultBrightcove';
|
|
21
17
|
import VideoSearchResultYouTube from './VideoSearchResultYouTube';
|
|
18
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
22
19
|
var classes = new BEMHelper({
|
|
23
20
|
name: 'video-search',
|
|
24
21
|
prefix: 'c-'
|
|
25
22
|
});
|
|
26
|
-
|
|
27
23
|
var VideoSearchList = function VideoSearchList(props) {
|
|
28
24
|
var videos = props.videos,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
locale = props.locale,
|
|
26
|
+
translations = props.translations,
|
|
27
|
+
selectedType = props.selectedType,
|
|
28
|
+
selectedVideo = props.selectedVideo,
|
|
29
|
+
onSelectVideo = props.onSelectVideo,
|
|
30
|
+
onVideoPreview = props.onVideoPreview,
|
|
31
|
+
searching = props.searching;
|
|
37
32
|
if ((!videos || videos.length === 0) && !searching) {
|
|
38
33
|
return _jsx("p", {
|
|
39
34
|
children: translations.noResults
|
|
40
35
|
});
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
if (searching && !(videos.length > 0)) {
|
|
44
38
|
return _jsx("div", _objectSpread({}, classes('result-spinner')));
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
var videoresults = function videoresults() {
|
|
48
41
|
if (selectedType === 'youtube') {
|
|
49
42
|
return videos.map(function (video) {
|
|
@@ -57,7 +50,6 @@ var VideoSearchList = function VideoSearchList(props) {
|
|
|
57
50
|
}, video.cacheId);
|
|
58
51
|
});
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
return videos.map(function (video) {
|
|
62
54
|
return _jsx(VideoSearchResultBrightcove, {
|
|
63
55
|
video: video,
|
|
@@ -69,12 +61,10 @@ var VideoSearchList = function VideoSearchList(props) {
|
|
|
69
61
|
}, video.id);
|
|
70
62
|
});
|
|
71
63
|
};
|
|
72
|
-
|
|
73
64
|
return _jsx("div", _objectSpread(_objectSpread({}, classes('list-inner')), {}, {
|
|
74
65
|
children: videoresults()
|
|
75
66
|
}));
|
|
76
67
|
};
|
|
77
|
-
|
|
78
68
|
VideoSearchList.propTypes = {
|
|
79
69
|
onSelectVideo: PropTypes.func.isRequired,
|
|
80
70
|
onVideoPreview: PropTypes.func.isRequired,
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
|
-
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
|
|
10
4
|
/**
|
|
11
5
|
* Copyright (c) 2017-present, NDLA.
|
|
12
6
|
*
|
|
@@ -14,6 +8,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
14
8
|
* LICENSE file in the root directory of this source tree.
|
|
15
9
|
*
|
|
16
10
|
*/
|
|
11
|
+
|
|
17
12
|
import React from 'react';
|
|
18
13
|
import PropTypes from 'prop-types';
|
|
19
14
|
import Button from '@ndla/button';
|
|
@@ -22,17 +17,19 @@ import { PanoramaPhotosphere } from '@ndla/icons/common';
|
|
|
22
17
|
import BEMHelper from 'react-bem-helper';
|
|
23
18
|
import PreviewVideo from './PreviewVideo';
|
|
24
19
|
import { LicenseShape, BrightcoveShape } from './shapes';
|
|
20
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
21
|
+
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
25
22
|
var classes = new BEMHelper({
|
|
26
23
|
name: 'video-search',
|
|
27
24
|
prefix: 'c-'
|
|
28
25
|
});
|
|
29
26
|
export default function VideoSearchResultBrightcove(_ref) {
|
|
30
27
|
var video = _ref.video,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
onVideoPreview = _ref.onVideoPreview,
|
|
29
|
+
selectedVideo = _ref.selectedVideo,
|
|
30
|
+
onSelectVideo = _ref.onSelectVideo,
|
|
31
|
+
locale = _ref.locale,
|
|
32
|
+
translations = _ref.translations;
|
|
36
33
|
var active = selectedVideo && selectedVideo.id === video.id ? 'active' : '';
|
|
37
34
|
var license = video.custom_fields && video.custom_fields.license ? getLicenseByNBTitle(video.custom_fields.license, locale) : '';
|
|
38
35
|
var thumbnailSource = video.images && video.images.thumbnail ? video.images.thumbnail.src : '';
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
-
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
|
-
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
-
|
|
10
4
|
/**
|
|
11
5
|
* Copyright (c) 2017-present, NDLA.
|
|
12
6
|
*
|
|
@@ -14,6 +8,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
14
8
|
* LICENSE file in the root directory of this source tree.
|
|
15
9
|
*
|
|
16
10
|
*/
|
|
11
|
+
|
|
17
12
|
import React from 'react';
|
|
18
13
|
import PropTypes from 'prop-types';
|
|
19
14
|
import Button from '@ndla/button';
|
|
@@ -21,22 +16,22 @@ import BEMHelper from 'react-bem-helper';
|
|
|
21
16
|
import PreviewVideo from './PreviewVideo';
|
|
22
17
|
import { YouTubeShape } from './shapes';
|
|
23
18
|
import { setLocaleDate, setYouTubeDuration } from './videoHelpers';
|
|
19
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
20
|
+
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
24
21
|
var classes = new BEMHelper({
|
|
25
22
|
name: 'video-search',
|
|
26
23
|
prefix: 'c-'
|
|
27
24
|
});
|
|
28
25
|
export default function VideoSearchResultYouTube(_ref) {
|
|
29
26
|
var _video$pagemap, _video$pagemap$videoo, _selectedVideo$pagema, _selectedVideo$pagema2, _selectedVideo$pagema3;
|
|
30
|
-
|
|
31
27
|
var video = _ref.video,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
onVideoPreview = _ref.onVideoPreview,
|
|
29
|
+
selectedVideo = _ref.selectedVideo,
|
|
30
|
+
onSelectVideo = _ref.onSelectVideo,
|
|
31
|
+
translations = _ref.translations,
|
|
32
|
+
locale = _ref.locale;
|
|
37
33
|
var videoData = video === null || video === void 0 ? void 0 : (_video$pagemap = video.pagemap) === null || _video$pagemap === void 0 ? void 0 : (_video$pagemap$videoo = _video$pagemap.videoobject) === null || _video$pagemap$videoo === void 0 ? void 0 : _video$pagemap$videoo[0];
|
|
38
34
|
var activeVideo = (selectedVideo === null || selectedVideo === void 0 ? void 0 : (_selectedVideo$pagema = selectedVideo.pagemap) === null || _selectedVideo$pagema === void 0 ? void 0 : (_selectedVideo$pagema2 = _selectedVideo$pagema.videoobject) === null || _selectedVideo$pagema2 === void 0 ? void 0 : (_selectedVideo$pagema3 = _selectedVideo$pagema2[0]) === null || _selectedVideo$pagema3 === void 0 ? void 0 : _selectedVideo$pagema3.videoid) === (videoData === null || videoData === void 0 ? void 0 : videoData.videoid);
|
|
39
|
-
|
|
40
35
|
if (videoData) {
|
|
41
36
|
return _jsxs("div", _objectSpread(_objectSpread({}, classes('list-item', activeVideo ? 'active' : '')), {}, {
|
|
42
37
|
children: [_jsxs("div", _objectSpread(_objectSpread({}, classes('list-item-inner')), {}, {
|