@ndla/ui 3.2.1 → 3.2.2
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/Article/ArticleAuthorContent.js +1 -2
- package/es/BackgroundImage/BackgroundImage.js +27 -0
- package/es/BackgroundImage/index.js +2 -0
- package/es/ContentLoader/index.js +83 -0
- package/es/Dialog/Dialog.js +64 -0
- package/es/Dialog/index.js +10 -0
- package/es/FactBox/FactBox.js +7 -11
- package/es/Figure/Figure.js +93 -0
- package/es/Figure/FigureExpandButton.js +28 -0
- package/es/Figure/FigureLicense.js +54 -0
- package/es/Figure/FigureLicenseDialog.js +43 -0
- package/es/Figure/index.js +12 -0
- package/es/FileList/File.js +48 -0
- package/es/FileList/FileList.js +20 -0
- package/es/FileList/index.js +3 -0
- package/es/Hero/Hero.js +64 -0
- package/es/Hero/index.js +8 -0
- package/es/Image/Image.js +96 -0
- package/es/Image/ImageLink.js +46 -0
- package/es/Image/LazyLoadImage.js +47 -0
- package/es/Image/index.js +11 -0
- package/es/InfoBox/InfoBox.js +11 -0
- package/es/InfoBox/index.js +1 -0
- package/es/InfoWidget/InfoWidget.js +57 -0
- package/es/InfoWidget/index.js +2 -0
- package/es/Logo/Logo.js +51 -0
- package/es/Logo/SvgLogo.js +54 -0
- package/es/Logo/index.js +9 -0
- package/es/Masthead/Masthead.js +67 -0
- package/es/Masthead/index.js +10 -0
- package/es/NoContentBox/NoContentBox.js +26 -0
- package/es/NoContentBox/index.js +9 -0
- package/es/Portrait/Portrait.js +30 -0
- package/es/Portrait/index.js +9 -0
- package/es/RelatedArticleList/RelatedArticleList.js +4 -23
- package/es/Topic/Topic.js +20 -20
- package/es/Translation/Translation.js +22 -0
- package/es/Translation/TranslationBox.js +17 -0
- package/es/Translation/TranslationLine.js +37 -0
- package/es/Translation/index.js +3 -0
- package/es/index-javascript.js +1 -18
- package/es/index.js +17 -0
- package/es/locale/messages-en.js +4 -0
- package/es/locale/messages-nb.js +5 -1
- package/es/locale/messages-nn.js +5 -1
- package/lib/BackgroundImage/BackgroundImage.js +40 -0
- package/lib/BackgroundImage/index.js +13 -0
- package/lib/ContentLoader/index.js +88 -0
- package/lib/Dialog/Dialog.d.ts +1 -1
- package/lib/Dialog/Dialog.js +70 -0
- package/lib/Dialog/index.js +24 -0
- package/lib/FactBox/FactBox.d.ts +16 -0
- package/lib/FactBox/FactBox.js +5 -11
- package/lib/FactBox/index.d.ts +2 -0
- package/lib/Figure/Figure.js +105 -0
- package/lib/Figure/FigureExpandButton.js +41 -0
- package/lib/Figure/FigureLicense.js +66 -0
- package/lib/Figure/FigureLicenseDialog.js +48 -0
- package/lib/Figure/index.js +49 -0
- package/lib/FileList/File.js +63 -0
- package/lib/FileList/FileList.js +34 -0
- package/lib/FileList/index.js +21 -0
- package/lib/Hero/Hero.js +100 -0
- package/lib/Hero/index.js +55 -0
- package/lib/Image/Image.js +105 -0
- package/lib/Image/ImageLink.js +50 -0
- package/lib/Image/LazyLoadImage.js +51 -0
- package/lib/Image/index.js +38 -0
- package/lib/InfoBox/InfoBox.js +24 -0
- package/lib/InfoBox/index.js +15 -0
- package/lib/InfoWidget/InfoWidget.js +73 -0
- package/lib/InfoWidget/index.js +13 -0
- package/lib/Logo/Logo.js +70 -0
- package/lib/Logo/SvgLogo.js +59 -0
- package/lib/Logo/index.js +20 -0
- package/lib/Masthead/Masthead.js +82 -0
- package/lib/Masthead/index.js +30 -0
- package/lib/NoContentBox/NoContentBox.js +43 -0
- package/lib/NoContentBox/index.js +20 -0
- package/lib/Portrait/Portrait.js +43 -0
- package/lib/Portrait/index.js +20 -0
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +25 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +2 -23
- package/lib/RelatedArticleList/index.d.ts +10 -0
- package/lib/Topic/Topic.js +20 -20
- package/lib/Translation/Translation.js +35 -0
- package/lib/Translation/TranslationBox.js +29 -0
- package/lib/Translation/TranslationLine.js +42 -0
- package/lib/Translation/index.js +31 -0
- package/lib/index-javascript.js +0 -230
- package/lib/index.d.ts +3 -0
- package/lib/index.js +263 -0
- package/lib/locale/messages-en.js +4 -0
- package/lib/locale/messages-nb.js +5 -1
- package/lib/locale/messages-nn.js +5 -1
- package/lib/utils/createUniversalPortal.d.ts +9 -0
- package/package.json +4 -4
- package/src/FactBox/{FactBox.jsx → FactBox.tsx} +12 -14
- package/src/FactBox/{index.js → index.ts} +0 -0
- package/src/RelatedArticleList/{RelatedArticleList.jsx → RelatedArticleList.tsx} +43 -30
- package/src/RelatedArticleList/{index.js → index.ts} +0 -0
- package/src/index-javascript.js +0 -3
- package/src/index.ts +6 -0
- package/src/utils/{createUniversalPortal.jsx → createUniversalPortal.tsx} +3 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FigureLicenseByline = exports.FigureLicenseCta = exports.classLicenses = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
+
|
|
12
|
+
var _util = require("@ndla/util");
|
|
13
|
+
|
|
14
|
+
var _licenses = require("@ndla/licenses");
|
|
15
|
+
|
|
16
|
+
var _core = require("@emotion/core");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
var classLicenses = new _reactBemHelper["default"]({
|
|
23
|
+
name: 'figure-license',
|
|
24
|
+
prefix: 'c-'
|
|
25
|
+
});
|
|
26
|
+
exports.classLicenses = classLicenses;
|
|
27
|
+
|
|
28
|
+
var FigureLicenseCta = function FigureLicenseCta(_ref) {
|
|
29
|
+
var children = _ref.children,
|
|
30
|
+
messages = _ref.messages,
|
|
31
|
+
authors = _ref.authors,
|
|
32
|
+
origin = _ref.origin,
|
|
33
|
+
title = _ref.title;
|
|
34
|
+
return (0, _core.jsx)("div", classLicenses('cta-wrapper'), (0, _core.jsx)("ul", classLicenses('list'), title && (0, _core.jsx)("li", classLicenses('item'), "".concat(messages.title, ": ").concat(title)), authors === null || authors === void 0 ? void 0 : authors.map(function (author) {
|
|
35
|
+
return (0, _core.jsx)("li", _extends({
|
|
36
|
+
key: (0, _util.uuid)()
|
|
37
|
+
}, classLicenses('item')), "".concat(author.type, ": ").concat(author.name));
|
|
38
|
+
}), origin && (0, _core.jsx)("li", classLicenses('item'), messages.source, ":", ' ', origin.startsWith('http') ? (0, _core.jsx)("a", {
|
|
39
|
+
href: origin,
|
|
40
|
+
target: "_blank",
|
|
41
|
+
rel: "noopener noreferrer"
|
|
42
|
+
}, origin) : origin)), (0, _core.jsx)("div", classLicenses('cta-block'), children));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.FigureLicenseCta = FigureLicenseCta;
|
|
46
|
+
|
|
47
|
+
var FigureLicenseByline = function FigureLicenseByline(_ref2) {
|
|
48
|
+
var messages = _ref2.messages,
|
|
49
|
+
license = _ref2.license,
|
|
50
|
+
locale = _ref2.locale;
|
|
51
|
+
return (0, _core.jsx)(_react["default"].Fragment, null, (0, _core.jsx)(_licenses.LicenseDescription, {
|
|
52
|
+
key: "byline",
|
|
53
|
+
highlightCC: true,
|
|
54
|
+
locale: locale,
|
|
55
|
+
messages: messages,
|
|
56
|
+
licenseRights: license.rights
|
|
57
|
+
}), ",", (0, _core.jsx)("a", _extends({
|
|
58
|
+
key: "link"
|
|
59
|
+
}, classLicenses('link'), {
|
|
60
|
+
target: "_blank",
|
|
61
|
+
rel: "noopener noreferrer",
|
|
62
|
+
href: license.url
|
|
63
|
+
}), license.linkText));
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.FigureLicenseByline = FigureLicenseByline;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FigureLicenseDialog = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _Dialog = _interopRequireDefault(require("../Dialog"));
|
|
11
|
+
|
|
12
|
+
var _FigureLicense = require("./FigureLicense");
|
|
13
|
+
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
var FigureLicenseDialog = function FigureLicenseDialog(_ref) {
|
|
21
|
+
var children = _ref.children,
|
|
22
|
+
messages = _ref.messages,
|
|
23
|
+
id = _ref.id,
|
|
24
|
+
authors = _ref.authors,
|
|
25
|
+
origin = _ref.origin,
|
|
26
|
+
title = _ref.title,
|
|
27
|
+
locale = _ref.locale,
|
|
28
|
+
license = _ref.license;
|
|
29
|
+
var headingLabelId = "heading-".concat(id);
|
|
30
|
+
return (0, _core.jsx)(_Dialog["default"], {
|
|
31
|
+
id: id,
|
|
32
|
+
labelledby: headingLabelId,
|
|
33
|
+
messages: messages
|
|
34
|
+
}, (0, _core.jsx)("div", (0, _FigureLicense.classLicenses)(), (0, _core.jsx)("h3", _extends({
|
|
35
|
+
id: headingLabelId
|
|
36
|
+
}, (0, _FigureLicense.classLicenses)('title')), messages.rulesForUse), (0, _core.jsx)(_FigureLicense.FigureLicenseByline, {
|
|
37
|
+
license: license,
|
|
38
|
+
messages: messages,
|
|
39
|
+
locale: locale
|
|
40
|
+
}), (0, _core.jsx)(_FigureLicense.FigureLicenseCta, {
|
|
41
|
+
authors: authors,
|
|
42
|
+
title: title,
|
|
43
|
+
origin: origin,
|
|
44
|
+
messages: messages
|
|
45
|
+
}, children)));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.FigureLicenseDialog = FigureLicenseDialog;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "Figure", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _Figure["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "FigureCaption", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _Figure.FigureCaption;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "FigureLicenseDialog", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _FigureLicenseDialog.FigureLicenseDialog;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "FigureExpandButton", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _FigureExpandButton.FigureExpandButton;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "FigureBylineExpandButton", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _FigureBylineExpandButton.FigureBylineExpandButton;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
var _Figure = _interopRequireWildcard(require("./Figure"));
|
|
40
|
+
|
|
41
|
+
var _FigureLicenseDialog = require("./FigureLicenseDialog");
|
|
42
|
+
|
|
43
|
+
var _FigureExpandButton = require("./FigureExpandButton");
|
|
44
|
+
|
|
45
|
+
var _FigureBylineExpandButton = require("./FigureBylineExpandButton");
|
|
46
|
+
|
|
47
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
48
|
+
|
|
49
|
+
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; }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
+
|
|
12
|
+
var _common = require("@ndla/icons/common");
|
|
13
|
+
|
|
14
|
+
var _safelink = _interopRequireDefault(require("@ndla/safelink"));
|
|
15
|
+
|
|
16
|
+
var _core = require("@emotion/core");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
var classes = (0, _reactBemHelper["default"])('c-file-list');
|
|
23
|
+
|
|
24
|
+
var renderFormat = function renderFormat(format, title, isPrimary, id, isDeadLink) {
|
|
25
|
+
var titleWithFormat = "".concat(title, " (").concat(format.fileType.toUpperCase(), ")");
|
|
26
|
+
var formatId = "".concat(id, "_").concat(format.fileType);
|
|
27
|
+
|
|
28
|
+
if (isDeadLink) {
|
|
29
|
+
return (0, _core.jsx)("span", {
|
|
30
|
+
key: format.url
|
|
31
|
+
}, (0, _core.jsx)(_common.Download, null), (0, _core.jsx)("span", null, isPrimary ? titleWithFormat : "(".concat(format.fileType.toUpperCase(), ")")), (0, _core.jsx)("span", _extends({}, classes('tooltip'), {
|
|
32
|
+
"aria-hidden": true,
|
|
33
|
+
role: "tooltip",
|
|
34
|
+
id: formatId
|
|
35
|
+
}), (0, _core.jsx)("span", classes('tooltip-text'), format.tooltip)));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (0, _core.jsx)(_safelink["default"], _extends({}, classes('link'), {
|
|
39
|
+
key: format.url,
|
|
40
|
+
to: format.url,
|
|
41
|
+
target: "_blank",
|
|
42
|
+
"aria-label": titleWithFormat,
|
|
43
|
+
"aria-describedby": formatId
|
|
44
|
+
}), (0, _core.jsx)(_common.Download, null), (0, _core.jsx)("span", classes('link-text'), (0, _core.jsx)("span", null, isPrimary ? titleWithFormat : "(".concat(format.fileType.toUpperCase(), ")"))), (0, _core.jsx)("span", _extends({}, classes('tooltip'), {
|
|
45
|
+
"aria-hidden": true,
|
|
46
|
+
role: "tooltip",
|
|
47
|
+
id: formatId
|
|
48
|
+
}), (0, _core.jsx)("span", classes('tooltip-text'), format.tooltip)));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var File = function File(_ref) {
|
|
52
|
+
var file = _ref.file,
|
|
53
|
+
id = _ref.id;
|
|
54
|
+
var formatLinks = file.formats.map(function (format, index) {
|
|
55
|
+
return renderFormat(format, file.title, index === 0, id, !file.fileExists);
|
|
56
|
+
});
|
|
57
|
+
return (0, _core.jsx)("li", _extends({}, classes('item'), {
|
|
58
|
+
key: file.title
|
|
59
|
+
}), formatLinks);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var _default = File;
|
|
63
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
11
|
+
|
|
12
|
+
var _File = _interopRequireDefault(require("./File"));
|
|
13
|
+
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
var classes = (0, _reactBemHelper["default"])('c-file-list');
|
|
19
|
+
|
|
20
|
+
var FileList = function FileList(_ref) {
|
|
21
|
+
var files = _ref.files,
|
|
22
|
+
heading = _ref.heading,
|
|
23
|
+
id = _ref.id;
|
|
24
|
+
return (0, _core.jsx)("section", classes(), (0, _core.jsx)("h1", classes('heading'), heading), (0, _core.jsx)("ul", classes('files'), files.map(function (file) {
|
|
25
|
+
return (0, _core.jsx)(_File["default"], {
|
|
26
|
+
key: "file-".concat(id, "-").concat(file.title),
|
|
27
|
+
file: file,
|
|
28
|
+
id: id
|
|
29
|
+
});
|
|
30
|
+
})));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var _default = FileList;
|
|
34
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "File", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _File["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports["default"] = void 0;
|
|
13
|
+
|
|
14
|
+
var _FileList = _interopRequireDefault(require("./FileList"));
|
|
15
|
+
|
|
16
|
+
var _File = _interopRequireDefault(require("./File"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
var _default = _FileList["default"];
|
|
21
|
+
exports["default"] = _default;
|
package/lib/Hero/Hero.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.NdlaFilmHero = exports.SourceMaterialHero = exports.ExternalLearningResourcesHero = exports.SubjectHero = exports.AssessmentResourcesHero = exports.TasksAndActivitiesHero = exports.SubjectMaterialHero = exports.Hero = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _reactBemHelper = _interopRequireDefault(require("react-bem-helper"));
|
|
13
|
+
|
|
14
|
+
var contentTypes = _interopRequireWildcard(require("../model/ContentType"));
|
|
15
|
+
|
|
16
|
+
var _core = require("@emotion/core");
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
24
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
+
|
|
26
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
+
|
|
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); }
|
|
29
|
+
|
|
30
|
+
var classes = new _reactBemHelper["default"]({
|
|
31
|
+
name: 'hero',
|
|
32
|
+
prefix: 'c-'
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
var Hero = function Hero(_ref) {
|
|
36
|
+
var children = _ref.children,
|
|
37
|
+
contentType = _ref.contentType;
|
|
38
|
+
return (0, _core.jsx)("div", classes('', contentType), children || null);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.Hero = Hero;
|
|
42
|
+
|
|
43
|
+
var SubjectMaterialHero = function SubjectMaterialHero(props) {
|
|
44
|
+
return (0, _core.jsx)(Hero, _extends({
|
|
45
|
+
contentType: contentTypes.SUBJECT_MATERIAL
|
|
46
|
+
}, props));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
exports.SubjectMaterialHero = SubjectMaterialHero;
|
|
50
|
+
|
|
51
|
+
var TasksAndActivitiesHero = function TasksAndActivitiesHero(props) {
|
|
52
|
+
return (0, _core.jsx)(Hero, _extends({
|
|
53
|
+
contentType: contentTypes.TASKS_AND_ACTIVITIES
|
|
54
|
+
}, props));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.TasksAndActivitiesHero = TasksAndActivitiesHero;
|
|
58
|
+
|
|
59
|
+
var AssessmentResourcesHero = function AssessmentResourcesHero(props) {
|
|
60
|
+
return (0, _core.jsx)(Hero, _extends({
|
|
61
|
+
contentType: contentTypes.ASSESSMENT_RESOURCES
|
|
62
|
+
}, props));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.AssessmentResourcesHero = AssessmentResourcesHero;
|
|
66
|
+
|
|
67
|
+
var SubjectHero = function SubjectHero(props) {
|
|
68
|
+
return (0, _core.jsx)(Hero, _extends({
|
|
69
|
+
contentType: contentTypes.SUBJECT
|
|
70
|
+
}, props));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
exports.SubjectHero = SubjectHero;
|
|
74
|
+
|
|
75
|
+
var ExternalLearningResourcesHero = function ExternalLearningResourcesHero(props) {
|
|
76
|
+
return (0, _core.jsx)(Hero, _extends({
|
|
77
|
+
contentType: contentTypes.EXTERNAL_LEARNING_RESOURCES
|
|
78
|
+
}, props));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.ExternalLearningResourcesHero = ExternalLearningResourcesHero;
|
|
82
|
+
|
|
83
|
+
var SourceMaterialHero = function SourceMaterialHero(props) {
|
|
84
|
+
return (0, _core.jsx)(Hero, _extends({
|
|
85
|
+
contentType: contentTypes.SOURCE_MATERIAL
|
|
86
|
+
}, props));
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
exports.SourceMaterialHero = SourceMaterialHero;
|
|
90
|
+
|
|
91
|
+
var NdlaFilmHero = function NdlaFilmHero(_ref2) {
|
|
92
|
+
var hasImage = _ref2.hasImage,
|
|
93
|
+
rest = _objectWithoutProperties(_ref2, ["hasImage"]);
|
|
94
|
+
|
|
95
|
+
return (0, _core.jsx)(Hero, _extends({}, rest, {
|
|
96
|
+
contentType: hasImage ? 'ndla-film has-image' : 'ndla-film'
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
exports.NdlaFilmHero = NdlaFilmHero;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "SubjectMaterialHero", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Hero.SubjectMaterialHero;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "TasksAndActivitiesHero", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Hero.TasksAndActivitiesHero;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "AssessmentResourcesHero", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _Hero.AssessmentResourcesHero;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "SubjectHero", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _Hero.SubjectHero;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "ExternalLearningResourcesHero", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _Hero.ExternalLearningResourcesHero;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "SourceMaterialHero", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _Hero.SourceMaterialHero;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "Hero", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _Hero.Hero;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "NdlaFilmHero", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _Hero.NdlaFilmHero;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
var _Hero = require("./Hero");
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.makeSrcQueryString = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledBase = _interopRequireDefault(require("@emotion/styled-base"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _defined = _interopRequireDefault(require("defined"));
|
|
13
|
+
|
|
14
|
+
var _LazyLoadImage = _interopRequireDefault(require("./LazyLoadImage"));
|
|
15
|
+
|
|
16
|
+
var _core = require("@emotion/core");
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
+
|
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
+
|
|
26
|
+
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)."; }
|
|
27
|
+
|
|
28
|
+
var makeSrcQueryString = function makeSrcQueryString(width, crop, focalPoint) {
|
|
29
|
+
var widthParams = width && "width=".concat(width);
|
|
30
|
+
var cropParams = crop && "cropStartX=".concat(crop.startX, "&cropEndX=").concat(crop.endX, "&cropStartY=").concat(crop.startY, "&cropEndY=").concat(crop.endY);
|
|
31
|
+
var focalPointParams = focalPoint && "focalX=".concat(focalPoint.x, "&focalY=").concat(focalPoint.y);
|
|
32
|
+
var params = [widthParams, cropParams, focalPointParams].filter(function (p) {
|
|
33
|
+
return p;
|
|
34
|
+
}).join('&');
|
|
35
|
+
return params;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.makeSrcQueryString = makeSrcQueryString;
|
|
39
|
+
|
|
40
|
+
var getSrcSet = function getSrcSet(src, crop, focalPoint) {
|
|
41
|
+
var widths = [2720, 2080, 1760, 1440, 1120, 1000, 960, 800, 640, 480, 320, 240, 180];
|
|
42
|
+
return widths.map(function (width) {
|
|
43
|
+
return "".concat(src, "?").concat(makeSrcQueryString(width, crop, focalPoint), " ").concat(width, "w");
|
|
44
|
+
}).join(', ');
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var StyledImageWrapper = (0, _styledBase["default"])("div", {
|
|
48
|
+
target: "ejtxxex0",
|
|
49
|
+
label: "StyledImageWrapper"
|
|
50
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
51
|
+
name: "79elbk",
|
|
52
|
+
styles: "position:relative;"
|
|
53
|
+
} : {
|
|
54
|
+
name: "79elbk",
|
|
55
|
+
styles: "position:relative;",
|
|
56
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkltYWdlLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUE2QnFDIiwiZmlsZSI6IkltYWdlLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDE3LXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcy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biAgICA8U3R5bGVkSW1hZ2VXcmFwcGVyPlxuICAgICAgPHBpY3R1cmU+XG4gICAgICAgIDxzb3VyY2UgdHlwZT17Y29udGVudFR5cGV9IHNyY1NldD17c3JjU2V0fSBzaXplcz17c2l6ZXN9IC8+XG4gICAgICAgIDxpbWcgYWx0PXthbHR9IHNyYz17YCR7c3JjfT8ke3F1ZXJ5U3RyaW5nfWB9IHsuLi5yZXN0fSAvPlxuICAgICAgPC9waWN0dXJlPlxuICAgICAge2V4cGFuZEJ1dHRvbn1cbiAgICA8L1N0eWxlZEltYWdlV3JhcHBlcj5cbiAgKTtcbn07XG5cbmV4cG9ydCBkZWZhdWx0IEltYWdlO1xuIl19 */",
|
|
57
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
var Image = function Image(_ref) {
|
|
61
|
+
var alt = _ref.alt,
|
|
62
|
+
src = _ref.src,
|
|
63
|
+
lazyLoad = _ref.lazyLoad,
|
|
64
|
+
lazyLoadSrc = _ref.lazyLoadSrc,
|
|
65
|
+
crop = _ref.crop,
|
|
66
|
+
focalPoint = _ref.focalPoint,
|
|
67
|
+
contentType = _ref.contentType,
|
|
68
|
+
_ref$sizes = _ref.sizes,
|
|
69
|
+
sizes = _ref$sizes === void 0 ? '(min-width: 1024px) 1024px, 100vw' : _ref$sizes,
|
|
70
|
+
expandButton = _ref.expandButton,
|
|
71
|
+
rest = _objectWithoutProperties(_ref, ["alt", "src", "lazyLoad", "lazyLoadSrc", "crop", "focalPoint", "contentType", "sizes", "expandButton"]);
|
|
72
|
+
|
|
73
|
+
var srcSet = (0, _defined["default"])(rest.srcSet, getSrcSet(src, crop, focalPoint));
|
|
74
|
+
var fallbackWidth = (0, _defined["default"])(rest.fallbackWidth, 1024);
|
|
75
|
+
var queryString = makeSrcQueryString(fallbackWidth, crop, focalPoint);
|
|
76
|
+
|
|
77
|
+
if (contentType && contentType === 'image/gif') {
|
|
78
|
+
return (0, _core.jsx)(StyledImageWrapper, null, (0, _core.jsx)("img", _extends({
|
|
79
|
+
alt: alt,
|
|
80
|
+
src: "".concat(src)
|
|
81
|
+
}, rest)));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (lazyLoad) {
|
|
85
|
+
return (0, _core.jsx)(StyledImageWrapper, null, (0, _core.jsx)(_LazyLoadImage["default"], {
|
|
86
|
+
alt: alt,
|
|
87
|
+
src: "".concat(src, "?").concat(queryString),
|
|
88
|
+
srcSet: srcSet,
|
|
89
|
+
sizes: sizes,
|
|
90
|
+
lazyLoadSrc: lazyLoadSrc
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (0, _core.jsx)(StyledImageWrapper, null, (0, _core.jsx)("picture", null, (0, _core.jsx)("source", {
|
|
95
|
+
type: contentType,
|
|
96
|
+
srcSet: srcSet,
|
|
97
|
+
sizes: sizes
|
|
98
|
+
}), (0, _core.jsx)("img", _extends({
|
|
99
|
+
alt: alt,
|
|
100
|
+
src: "".concat(src, "?").concat(queryString)
|
|
101
|
+
}, rest))), expandButton);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var _default = Image;
|
|
105
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ImageLink = ImageLink;
|
|
7
|
+
|
|
8
|
+
var _styledBase = _interopRequireDefault(require("@emotion/styled-base"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _Image = require("./Image");
|
|
13
|
+
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
|
|
22
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
23
|
+
|
|
24
|
+
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)."; }
|
|
25
|
+
|
|
26
|
+
var StyledLink = (0, _styledBase["default"])("a", {
|
|
27
|
+
target: "eo3pjlm0",
|
|
28
|
+
label: "StyledLink"
|
|
29
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
30
|
+
name: "17viinn",
|
|
31
|
+
styles: "box-shadow:inset 0 0;"
|
|
32
|
+
} : {
|
|
33
|
+
name: "17viinn",
|
|
34
|
+
styles: "box-shadow:inset 0 0;",
|
|
35
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkltYWdlTGluay50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBYTJCIiwiZmlsZSI6IkltYWdlTGluay50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAq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Y2hpbGRyZW59XG4gICAgPC9TdHlsZWRMaW5rPlxuICApO1xufVxuIl19 */",
|
|
36
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
function ImageLink(_ref) {
|
|
40
|
+
var src = _ref.src,
|
|
41
|
+
crop = _ref.crop,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
rest = _objectWithoutProperties(_ref, ["src", "crop", "children"]);
|
|
44
|
+
|
|
45
|
+
return (0, _core.jsx)(StyledLink, _extends({
|
|
46
|
+
target: "_blank",
|
|
47
|
+
href: "".concat(src, "?").concat((0, _Image.makeSrcQueryString)(undefined, crop)),
|
|
48
|
+
rel: "noopener noreferrer"
|
|
49
|
+
}, rest), children);
|
|
50
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _core = require("@emotion/core");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
|
|
18
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
+
|
|
20
|
+
// Lazyload image with lazysizes (https://github.com/aFarkas/lazysizes)
|
|
21
|
+
var LazyLoadImage = function LazyLoadImage(_ref) {
|
|
22
|
+
var alt = _ref.alt,
|
|
23
|
+
src = _ref.src,
|
|
24
|
+
srcSet = _ref.srcSet,
|
|
25
|
+
lazyLoadSrc = _ref.lazyLoadSrc,
|
|
26
|
+
sizes = _ref.sizes,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, ["alt", "src", "srcSet", "lazyLoadSrc", "sizes"]);
|
|
28
|
+
|
|
29
|
+
return (0, _core.jsx)(_react["default"].Fragment, null, (0, _core.jsx)("noscript", {
|
|
30
|
+
key: "noscript"
|
|
31
|
+
}, (0, _core.jsx)("img", _extends({
|
|
32
|
+
alt: alt,
|
|
33
|
+
src: "".concat(src),
|
|
34
|
+
srcSet: srcSet,
|
|
35
|
+
sizes: sizes
|
|
36
|
+
}, rest))), ",", (0, _core.jsx)("img", _extends({
|
|
37
|
+
alt: alt,
|
|
38
|
+
key: "img",
|
|
39
|
+
style: {
|
|
40
|
+
width: '100%'
|
|
41
|
+
},
|
|
42
|
+
className: "lazyload",
|
|
43
|
+
src: lazyLoadSrc,
|
|
44
|
+
"data-src": src,
|
|
45
|
+
"data-src-set": srcSet,
|
|
46
|
+
"data-sizes": sizes
|
|
47
|
+
}, rest)));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var _default = LazyLoadImage;
|
|
51
|
+
exports["default"] = _default;
|