@ndla/ui 44.0.19 → 44.0.21
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/ArticleByline.js +18 -12
- package/es/BlogPost/BlogPost.js +9 -6
- package/es/CampaignBlock/CampaignBlock.js +10 -7
- package/es/ContactBlock/ContactBlock.js +30 -33
- package/es/Footer/FooterPrivacy.js +27 -14
- package/es/Grid/Grid.js +2 -2
- package/es/KeyFigure/KeyFigure.js +12 -10
- package/es/LearningPaths/LearningPathSticky.js +7 -3
- package/es/LinkBlock/LinkBlock.js +10 -7
- package/es/Masthead/MastheadSearchModal.js +4 -2
- package/es/ResourceGroup/ResourceItem.js +50 -63
- package/es/ResourceGroup/ResourceList.js +11 -19
- package/es/locale/messages-en.js +2 -2
- package/es/locale/messages-nb.js +2 -2
- package/es/locale/messages-nn.js +2 -2
- package/es/locale/messages-se.js +2 -2
- package/es/locale/messages-sma.js +2 -2
- package/es/utils/relativeUrl.js +18 -0
- package/lib/Article/ArticleByline.js +18 -12
- package/lib/BlogPost/BlogPost.d.ts +2 -1
- package/lib/BlogPost/BlogPost.js +9 -6
- package/lib/CampaignBlock/CampaignBlock.d.ts +2 -1
- package/lib/CampaignBlock/CampaignBlock.js +10 -7
- package/lib/ContactBlock/ContactBlock.js +30 -33
- package/lib/Footer/FooterPrivacy.js +32 -21
- package/lib/Grid/Grid.js +2 -2
- package/lib/KeyFigure/KeyFigure.js +12 -10
- package/lib/LearningPaths/LearningPathSticky.js +7 -3
- package/lib/LinkBlock/LinkBlock.d.ts +4 -1
- package/lib/LinkBlock/LinkBlock.js +10 -7
- package/lib/Masthead/MastheadSearchModal.js +4 -2
- package/lib/ResourceGroup/ResourceItem.d.ts +1 -1
- package/lib/ResourceGroup/ResourceItem.js +50 -63
- package/lib/ResourceGroup/ResourceList.js +11 -19
- package/lib/locale/messages-en.js +2 -2
- package/lib/locale/messages-nb.js +2 -2
- package/lib/locale/messages-nn.js +2 -2
- package/lib/locale/messages-se.js +2 -2
- package/lib/locale/messages-sma.js +2 -2
- package/lib/utils/relativeUrl.d.ts +8 -0
- package/lib/utils/relativeUrl.js +25 -0
- package/package.json +7 -7
- package/src/Article/ArticleByline.tsx +9 -3
- package/src/BlogPost/BlogPost.tsx +7 -4
- package/src/CampaignBlock/CampaignBlock.tsx +5 -1
- package/src/ContactBlock/ContactBlock.tsx +20 -7
- package/src/Footer/FooterPrivacy.tsx +21 -30
- package/src/Grid/Grid.tsx +1 -1
- package/src/KeyFigure/KeyFigure.tsx +6 -2
- package/src/LearningPaths/LearningPathSticky.tsx +17 -9
- package/src/LinkBlock/LinkBlock.tsx +8 -2
- package/src/Masthead/MastheadSearchModal.tsx +6 -1
- package/src/ResourceGroup/ResourceItem.tsx +45 -61
- package/src/ResourceGroup/ResourceList.tsx +2 -24
- package/src/locale/messages-en.ts +2 -2
- package/src/locale/messages-nb.ts +2 -2
- package/src/locale/messages-nn.ts +2 -2
- package/src/locale/messages-se.ts +2 -2
- package/src/locale/messages-sma.ts +2 -2
- package/src/utils/relativeUrl.ts +20 -0
|
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
9
|
-
var _react = require("@emotion/react");
|
|
10
9
|
var _reactI18next = require("react-i18next");
|
|
11
10
|
var _core = require("@ndla/core");
|
|
12
11
|
var _NoContentBox = _interopRequireDefault(require("../NoContentBox"));
|
|
13
12
|
var _ResourceItem = _interopRequireDefault(require("./ResourceItem"));
|
|
14
13
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
15
14
|
var _excluded = ["id"];
|
|
16
|
-
var _templateObject;
|
|
17
15
|
/**
|
|
18
16
|
* Copyright (c) 2017-present, NDLA.
|
|
19
17
|
*
|
|
@@ -29,22 +27,17 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
29
27
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
30
28
|
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; }
|
|
31
29
|
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; }
|
|
32
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
|
-
var fakeLoadingAnimation = (0, _react.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: 0.5;\n }\n 99% {\n opacity: 0.5;\n }\n 100% {\n opacity: 1;\n }\n"])));
|
|
34
30
|
var StyledResourceList = /*#__PURE__*/(0, _base.default)("ul", {
|
|
35
31
|
target: "e1uqs7m20",
|
|
36
32
|
label: "StyledResourceList"
|
|
37
|
-
})("list-style:none;margin:0;padding:0;font-family:", _core.fonts.sans, ";"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
title = _ref2.title,
|
|
46
|
-
showAdditionalResources = _ref2.showAdditionalResources,
|
|
47
|
-
heartButton = _ref2.heartButton;
|
|
33
|
+
})("list-style:none;margin:0;padding:0;font-family:", _core.fonts.sans, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlJlc291cmNlTGlzdC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZ0JvQyIsImZpbGUiOiJSZXNvdXJjZUxpc3QudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTctcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqL1xuXG5pbXBvcnQgeyBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgeyB1c2VUcmFuc2xhdGlvbiB9IGZyb20gJ3JlYWN0LWkxOG5leHQnO1xuaW1wb3J0IHsgZm9udHMgfSBmcm9tICdAbmRsYS9jb3JlJztcbmltcG9ydCBOb0NvbnRlbnRCb3ggZnJvbSAnLi4vTm9Db250ZW50Qm94JztcbmltcG9ydCBSZXNvdXJjZUl0ZW0gZnJvbSAnLi9SZXNvdXJjZUl0ZW0nO1xuaW1wb3J0IHsgUmVzb3VyY2UgfSBmcm9tICcuLi90eXBlcyc7XG5cbmNvbnN0IFN0eWxlZFJlc291cmNlTGlzdCA9IHN0eWxlZC51bGBcbiAgbGlzdC1zdHlsZTogbm9uZTtcbiAgbWFyZ2luOiAwO1xuICBwYWRkaW5nOiAwO1xuICBmb250LWZhbWlseTogJHtmb250cy5zYW5zfTtcbmA7XG5cbmV4cG9ydCB0eXBlIFJlc291cmNlTGlzdFByb3BzID0ge1xuICByZXNvdXJjZXM6IFJlc291cmNlW107XG4gIG9uQ2xpY2s/OiAoKSA9PiB2b2lkO1xuICBjb250ZW50VHlwZT86IHN0cmluZztcbiAgdGl0bGU/OiBzdHJpbmc7XG4gIHNob3dBZGRpdGlvbmFsUmVzb3VyY2VzPzogYm9vbGVhbjtcbiAgaGVhcnRCdXR0b24/OiAocGF0aDogc3RyaW5nKSA9PiBSZWFjdE5vZGU7XG59O1xuXG5jb25zdCBSZXNvdXJjZUxpc3QgPSAoe1xuICByZXNvdXJjZXMsXG4gIG9uQ2xpY2ssXG4gIGNvbnRlbnRUeXBlLFxuICB0aXRsZSxcbiAgc2hvd0FkZGl0aW9uYWxSZXNvdXJjZXMsXG4gIGhlYXJ0QnV0dG9uLFxufTogUmVzb3VyY2VMaXN0UHJvcHMpID0+IHtcbiAgY29uc3QgeyB0IH0gPSB1c2VUcmFuc2xhdGlvbigpO1xuICBjb25zdCByZW5kZXJBZGRpdGlvbmFsUmVzb3VyY2VUcmlnZ2VyID1cbiAgICAhc2hvd0FkZGl0aW9uYWxSZXNvdXJjZXMgJiZcbiAgICByZXNvdXJjZXMuZmlsdGVyKChyZXMpID0+IHJlcy5hZGRpdGlvbmFsKS5sZW5ndGggPiAwICYmXG4gICAgcmVzb3VyY2VzLmZpbHRlcigocmVzKSA9PiAhcmVzLmFkZGl0aW9uYWwpLmxlbmd0aCA9PT0gMDtcblxuICByZXR1cm4gKFxuICAgIDxkaXY+XG4gICAgICA8U3R5bGVkUmVzb3VyY2VMaXN0PlxuICAgICAgICB7cmVzb3VyY2VzLm1hcCgoeyBpZCwgLi4ucmVzb3VyY2UgfSkgPT4gKFxuICAgICAgICAgIDxSZXNvdXJjZUl0ZW1cbiAgICAgICAgICAgIGlkPXtpZH1cbiAgICAgICAgICAgIGtleT17aWR9XG4gICAgICAgICAgICBjb250ZW50VHlwZT17Y29udGVudFR5cGV9XG4gICAgICAgICAgICBzaG93QWRkaXRpb25hbFJlc291cmNlcz17c2hvd0FkZGl0aW9uYWxSZXNvdXJjZXN9XG4gICAgICAgICAgICBoZWFydEJ1dHRvbj17aGVhcnRCdXR0b259XG4gICAgICAgICAgICB7Li4ucmVzb3VyY2V9XG4gICAgICAgICAgICBjb250ZW50VHlwZURlc2NyaXB0aW9uPXtcbiAgICAgICAgICAgICAgcmVzb3VyY2UuYWRkaXRpb25hbCA/IHQoJ3Jlc291cmNlLnRvb2x0aXBBZGRpdGlvbmFsVG9waWMnKSA6IHQoJ3Jlc291cmNlLnRvb2x0aXBDb3JlVG9waWMnKVxuICAgICAgICAgICAgfVxuICAgICAgICAgIC8+XG4gICAgICAgICkpfVxuICAgICAgICB7cmVuZGVyQWRkaXRpb25hbFJlc291cmNlVHJpZ2dlciAmJiAoXG4gICAgICAgICAgPGxpPlxuICAgICAgICAgICAgPE5vQ29udGVudEJveFxuICAgICAgICAgICAgICBvbkNsaWNrPXtvbkNsaWNrfVxuICAgICAgICAgICAgICBidXR0b25UZXh0PXt0KCdyZXNvdXJjZS50b2dnbGVGaWx0ZXJMYWJlbCcpfVxuICAgICAgICAgICAgICB0ZXh0PXtcbiAgICAgICAgICAgICAgICB0aXRsZVxuICAgICAgICAgICAgICAgICAgPyB0KCdyZXNvdXJjZS5ub0NvcmVSZXNvdXJjZXNBdmFpbGFibGUnLCB7XG4gICAgICAgICAgICAgICAgICAgICAgbmFtZTogdGl0bGUudG9Mb3dlckNhc2UoKSxcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgIDogdCgncmVzb3VyY2Uubm9Db3JlUmVzb3VyY2VzQXZhaWxhYmxlVW5zcGVjaWZpYycpXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8+XG4gICAgICAgICAgPC9saT5cbiAgICAgICAgKX1cbiAgICAgIDwvU3R5bGVkUmVzb3VyY2VMaXN0PlxuICAgIDwvZGl2PlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgUmVzb3VyY2VMaXN0O1xuIl19 */"));
|
|
34
|
+
var ResourceList = function ResourceList(_ref) {
|
|
35
|
+
var resources = _ref.resources,
|
|
36
|
+
onClick = _ref.onClick,
|
|
37
|
+
contentType = _ref.contentType,
|
|
38
|
+
title = _ref.title,
|
|
39
|
+
showAdditionalResources = _ref.showAdditionalResources,
|
|
40
|
+
heartButton = _ref.heartButton;
|
|
48
41
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
49
42
|
t = _useTranslation.t;
|
|
50
43
|
var renderAdditionalResourceTrigger = !showAdditionalResources && resources.filter(function (res) {
|
|
@@ -54,10 +47,9 @@ var ResourceList = function ResourceList(_ref2) {
|
|
|
54
47
|
}).length === 0;
|
|
55
48
|
return (0, _jsxRuntime.jsx)("div", {
|
|
56
49
|
children: (0, _jsxRuntime.jsxs)(StyledResourceList, {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
resource = _objectWithoutProperties(_ref3, _excluded);
|
|
50
|
+
children: [resources.map(function (_ref2) {
|
|
51
|
+
var id = _ref2.id,
|
|
52
|
+
resource = _objectWithoutProperties(_ref2, _excluded);
|
|
61
53
|
return (0, _jsxRuntime.jsx)(_ResourceItem.default, _objectSpread(_objectSpread({
|
|
62
54
|
id: id,
|
|
63
55
|
contentType: contentType,
|
|
@@ -847,8 +847,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
847
847
|
},
|
|
848
848
|
openMenuTooltip: 'Open menu',
|
|
849
849
|
mobileStepInfo: '{{currentPage}} out of {{totalPages}}',
|
|
850
|
-
nextArrow: '
|
|
851
|
-
previousArrow: '
|
|
850
|
+
nextArrow: 'Go to next step',
|
|
851
|
+
previousArrow: 'Go to previous step'
|
|
852
852
|
},
|
|
853
853
|
dropdown: {
|
|
854
854
|
numberHits: "Search returned {{hits}} hits",
|
|
@@ -845,8 +845,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
845
845
|
},
|
|
846
846
|
openMenuTooltip: 'Vis læringssti',
|
|
847
847
|
mobileStepInfo: '{{currentPage}} av {{totalPages}}',
|
|
848
|
-
nextArrow: '
|
|
849
|
-
previousArrow: '
|
|
848
|
+
nextArrow: 'Gå til neste steg',
|
|
849
|
+
previousArrow: 'Gå til forrige steg'
|
|
850
850
|
},
|
|
851
851
|
dropdown: {
|
|
852
852
|
numberHits: "S\xF8ket gav {{hits}} treff",
|
|
@@ -845,8 +845,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
845
845
|
},
|
|
846
846
|
openMenuTooltip: 'Vis læringssti',
|
|
847
847
|
mobileStepInfo: '{{currentPage}} av {{totalPages}}',
|
|
848
|
-
nextArrow: '
|
|
849
|
-
previousArrow: '
|
|
848
|
+
nextArrow: 'Gå til neste steg',
|
|
849
|
+
previousArrow: 'Gå til førre steg'
|
|
850
850
|
},
|
|
851
851
|
dropdown: {
|
|
852
852
|
numberHits: "S\xF8ket gav {{hits}} treff",
|
|
@@ -845,8 +845,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
845
845
|
},
|
|
846
846
|
openMenuTooltip: 'Čájet oahppobálgá',
|
|
847
847
|
mobileStepInfo: '{{currentPage}} oktiibuot {{totalPages}} siidduin',
|
|
848
|
-
nextArrow: '
|
|
849
|
-
previousArrow: '
|
|
848
|
+
nextArrow: 'Gå til neste steg',
|
|
849
|
+
previousArrow: 'Gå til førre steg'
|
|
850
850
|
},
|
|
851
851
|
dropdown: {
|
|
852
852
|
numberHits: "Ohcamis ledje {{hits}} deaivama",
|
|
@@ -845,8 +845,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
845
845
|
},
|
|
846
846
|
openMenuTooltip: 'Vuesehth lïeremebaalkam',
|
|
847
847
|
mobileStepInfo: '{{currentPage}} ållesth {{totalPages}}:ste',
|
|
848
|
-
nextArrow: '
|
|
849
|
-
previousArrow: '
|
|
848
|
+
nextArrow: 'Gå til neste steg',
|
|
849
|
+
previousArrow: 'Gå til førre steg'
|
|
850
850
|
},
|
|
851
851
|
dropdown: {
|
|
852
852
|
numberHits: "Datne {{hits}} gaavnedimmieh \xE5adtjoejih",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-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 declare const usePossiblyRelativeUrl: (url: string, path?: string) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePossiblyRelativeUrl = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) 2023-present, NDLA.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the GPLv3 license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var ENV_REGEX = /(staging|test)\.?/;
|
|
16
|
+
var NDLA_URL = /(.*\.)?ndla.no.*/;
|
|
17
|
+
var usePossiblyRelativeUrl = function usePossiblyRelativeUrl(url, path) {
|
|
18
|
+
if (!path) return url;
|
|
19
|
+
if (!NDLA_URL.test(url) || !NDLA_URL.test(path)) return url;
|
|
20
|
+
var urlObj = new URL(url.replace(ENV_REGEX, ''));
|
|
21
|
+
var pathObj = new URL(path.replace(ENV_REGEX, ''));
|
|
22
|
+
if (urlObj.host === pathObj.host) return urlObj.pathname;
|
|
23
|
+
return url;
|
|
24
|
+
};
|
|
25
|
+
exports.usePossiblyRelativeUrl = usePossiblyRelativeUrl;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "44.0.
|
|
3
|
+
"version": "44.0.21",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"types"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/accordion": "^2.2.
|
|
34
|
+
"@ndla/accordion": "^2.2.21",
|
|
35
35
|
"@ndla/article-scripts": "^3.0.20",
|
|
36
|
-
"@ndla/button": "^11.0.
|
|
36
|
+
"@ndla/button": "^11.0.6",
|
|
37
37
|
"@ndla/carousel": "^3.1.15",
|
|
38
38
|
"@ndla/core": "^4.1.6",
|
|
39
39
|
"@ndla/dropdown-menu": "^1.0.4",
|
|
40
|
-
"@ndla/forms": "^4.3.
|
|
40
|
+
"@ndla/forms": "^4.3.21",
|
|
41
41
|
"@ndla/hooks": "^2.0.9",
|
|
42
42
|
"@ndla/icons": "^4.0.5",
|
|
43
43
|
"@ndla/licenses": "^7.1.3",
|
|
44
44
|
"@ndla/modal": "^4.0.4",
|
|
45
|
-
"@ndla/notion": "^5.0.
|
|
46
|
-
"@ndla/safelink": "^4.1.
|
|
45
|
+
"@ndla/notion": "^5.0.20",
|
|
46
|
+
"@ndla/safelink": "^4.1.20",
|
|
47
47
|
"@ndla/select": "^2.4.11",
|
|
48
48
|
"@ndla/switch": "^1.1.11",
|
|
49
49
|
"@ndla/tabs": "^3.0.7",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "072f73eedfbdc11fd4a6412b756c3d3d9ca19d6a"
|
|
87
87
|
}
|
|
@@ -97,6 +97,12 @@ const StyledAccordionHeader = styled(AccordionHeader)`
|
|
|
97
97
|
font-size: ${fonts.sizes('16px', '29px')};
|
|
98
98
|
font-weight: ${fonts.weight.semibold};
|
|
99
99
|
|
|
100
|
+
&[data-background-color='white'][data-state='closed'] {
|
|
101
|
+
background-color: ${colors.background.default};
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
|
|
105
|
+
const StyledAccordionContent = styled(AccordionContent)`
|
|
100
106
|
&[data-background-color='white'] {
|
|
101
107
|
background-color: ${colors.background.default};
|
|
102
108
|
}
|
|
@@ -166,16 +172,16 @@ const ArticleByline = ({
|
|
|
166
172
|
<StyledAccordionHeader headingLevel="h2" data-background-color={accordionHeaderVariant}>
|
|
167
173
|
{t('article.useContent')}
|
|
168
174
|
</StyledAccordionHeader>
|
|
169
|
-
<
|
|
175
|
+
<StyledAccordionContent data-background-color={accordionHeaderVariant}>{licenseBox}</StyledAccordionContent>
|
|
170
176
|
</AccordionItem>
|
|
171
177
|
)}
|
|
172
178
|
|
|
173
179
|
{!!footnotes?.length && (
|
|
174
180
|
<AccordionItem value={footnotesAccordionId}>
|
|
175
181
|
<StyledAccordionHeader headingLevel="h2">{t('article.footnotes')}</StyledAccordionHeader>
|
|
176
|
-
<
|
|
182
|
+
<StyledAccordionContent forceMount data-background-color={accordionHeaderVariant}>
|
|
177
183
|
<ArticleFootNotes footNotes={footnotes} />
|
|
178
|
-
</
|
|
184
|
+
</StyledAccordionContent>
|
|
179
185
|
</AccordionItem>
|
|
180
186
|
)}
|
|
181
187
|
</AccordionRoot>
|
|
@@ -12,6 +12,7 @@ import SafeLink from '@ndla/safelink';
|
|
|
12
12
|
import { colors, fonts, misc, spacing } from '@ndla/core';
|
|
13
13
|
import { Quote } from '@ndla/icons/editor';
|
|
14
14
|
import { HeadingLevel } from '../types';
|
|
15
|
+
import { usePossiblyRelativeUrl } from '../utils/relativeUrl';
|
|
15
16
|
|
|
16
17
|
export interface Props {
|
|
17
18
|
title: {
|
|
@@ -26,6 +27,7 @@ export interface Props {
|
|
|
26
27
|
url: string;
|
|
27
28
|
alt: string;
|
|
28
29
|
};
|
|
30
|
+
path?: string;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
const Container = styled(SafeLink)`
|
|
@@ -37,7 +39,7 @@ const Container = styled(SafeLink)`
|
|
|
37
39
|
max-height: fit-content;
|
|
38
40
|
gap: ${spacing.nsmall};
|
|
39
41
|
box-shadow: none;
|
|
40
|
-
border: 1px solid ${colors.brand.
|
|
42
|
+
border: 1px solid ${colors.brand.lighter};
|
|
41
43
|
border-radius: ${misc.borderRadius};
|
|
42
44
|
padding: ${spacing.normal} ${spacing.medium};
|
|
43
45
|
height: 100%;
|
|
@@ -47,7 +49,7 @@ const Container = styled(SafeLink)`
|
|
|
47
49
|
&:hover,
|
|
48
50
|
&:focus-within {
|
|
49
51
|
.blog-title {
|
|
50
|
-
|
|
52
|
+
text-decoration: underline;
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
`;
|
|
@@ -79,9 +81,10 @@ const StyledImg = styled.img`
|
|
|
79
81
|
border: 0;
|
|
80
82
|
`;
|
|
81
83
|
|
|
82
|
-
const BlogPost = ({ title, author, url, metaImage, headingLevel: Heading = 'h3', size = 'normal' }: Props) => {
|
|
84
|
+
const BlogPost = ({ title, author, url, metaImage, headingLevel: Heading = 'h3', size = 'normal', path }: Props) => {
|
|
85
|
+
const href = usePossiblyRelativeUrl(url, path);
|
|
83
86
|
return (
|
|
84
|
-
<Container data-size={size} to={
|
|
87
|
+
<Container data-size={size} to={href}>
|
|
85
88
|
<Heading className="blog-title" css={headingCss} lang={title.language}>
|
|
86
89
|
{title.title}
|
|
87
90
|
</Heading>
|
|
@@ -12,6 +12,7 @@ import SafeLink from '@ndla/safelink';
|
|
|
12
12
|
import { Forward } from '@ndla/icons/common';
|
|
13
13
|
import { breakpoints, colors, fonts, spacing, mq, misc } from '@ndla/core';
|
|
14
14
|
import { HeadingLevel } from '../types';
|
|
15
|
+
import { usePossiblyRelativeUrl } from '../utils/relativeUrl';
|
|
15
16
|
|
|
16
17
|
interface Image {
|
|
17
18
|
src: string;
|
|
@@ -35,6 +36,7 @@ interface Props {
|
|
|
35
36
|
imageBefore?: Image;
|
|
36
37
|
imageAfter?: Image;
|
|
37
38
|
className?: string;
|
|
39
|
+
path?: string;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
const Container = styled.div`
|
|
@@ -91,15 +93,17 @@ const CampaignBlock = ({
|
|
|
91
93
|
headingLevel: Heading = 'h2',
|
|
92
94
|
imageAfter,
|
|
93
95
|
url,
|
|
96
|
+
path,
|
|
94
97
|
className,
|
|
95
98
|
}: Props) => {
|
|
99
|
+
const href = usePossiblyRelativeUrl(url.url, path);
|
|
96
100
|
return (
|
|
97
101
|
<Container className={className} data-type="campaign-block">
|
|
98
102
|
{imageBefore && <StyledImg src={imageBefore.src} height={200} width={240} alt="" />}
|
|
99
103
|
<TextWrapper>
|
|
100
104
|
<Heading css={headingStyle}>{title.title}</Heading>
|
|
101
105
|
<StyledDescription>{description.text}</StyledDescription>
|
|
102
|
-
<StyledLink to={
|
|
106
|
+
<StyledLink to={href}>
|
|
103
107
|
{url.text}
|
|
104
108
|
<Forward />
|
|
105
109
|
</StyledLink>
|
|
@@ -15,6 +15,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import concat from 'lodash/concat';
|
|
16
16
|
import { errorSvgSrc } from '../Embed/ImageEmbed';
|
|
17
17
|
|
|
18
|
+
const BLOB_WIDTH = 90;
|
|
19
|
+
|
|
18
20
|
interface Props {
|
|
19
21
|
image?: IImageMetaInformationV3;
|
|
20
22
|
jobTitle: string;
|
|
@@ -27,6 +29,7 @@ interface Props {
|
|
|
27
29
|
}
|
|
28
30
|
const BlockWrapper = styled.div`
|
|
29
31
|
display: flex;
|
|
32
|
+
position: relative;
|
|
30
33
|
flex-direction: column;
|
|
31
34
|
padding: 0 0 ${spacing.medium} ${spacing.medium};
|
|
32
35
|
font-family: ${fonts.sans};
|
|
@@ -54,6 +57,7 @@ const StyledHeader = styled.div`
|
|
|
54
57
|
|
|
55
58
|
const StyledText = styled.div`
|
|
56
59
|
display: flex;
|
|
60
|
+
${fonts.sizes('16px', '26px')};
|
|
57
61
|
overflow-wrap: anywhere;
|
|
58
62
|
color: ${colors.text.light};
|
|
59
63
|
gap: ${spacing.xxsmall};
|
|
@@ -68,13 +72,18 @@ const EmailLink = styled.a`
|
|
|
68
72
|
`;
|
|
69
73
|
|
|
70
74
|
const SummaryBlock = styled.p`
|
|
71
|
-
font-family: ${fonts.
|
|
72
|
-
padding: 0
|
|
75
|
+
font-family: ${fonts.sans};
|
|
76
|
+
padding: 0;
|
|
77
|
+
max-width: calc(100% - (${BLOB_WIDTH}px / 2));
|
|
73
78
|
${mq.range({ from: breakpoints.tabletWide })} {
|
|
74
79
|
padding-top: 0;
|
|
75
80
|
}
|
|
76
81
|
`;
|
|
77
82
|
|
|
83
|
+
const InfoWrapper = styled.div`
|
|
84
|
+
max-width: calc(100% - ${BLOB_WIDTH}px);
|
|
85
|
+
`;
|
|
86
|
+
|
|
78
87
|
const TextWrapper = styled.div`
|
|
79
88
|
display: flex;
|
|
80
89
|
overflow: hidden;
|
|
@@ -83,13 +92,17 @@ const TextWrapper = styled.div`
|
|
|
83
92
|
|
|
84
93
|
const BlobWrapper = styled.div`
|
|
85
94
|
height: 180px;
|
|
86
|
-
width:
|
|
95
|
+
width: ${BLOB_WIDTH}px;
|
|
96
|
+
position: absolute;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
right: 0px;
|
|
87
99
|
`;
|
|
88
100
|
|
|
89
101
|
const ImageWrapper = styled.div`
|
|
90
102
|
display: flex;
|
|
91
103
|
flex-direction: column;
|
|
92
|
-
gap: ${spacing.
|
|
104
|
+
gap: ${spacing.xsmall};
|
|
105
|
+
${fonts.sizes('16px', '26px')};
|
|
93
106
|
padding: ${spacing.medium} ${spacing.medium} 0 0;
|
|
94
107
|
${mq.range({ from: breakpoints.tabletWide })} {
|
|
95
108
|
padding-right: 0;
|
|
@@ -102,7 +115,7 @@ const blobStyling = css`
|
|
|
102
115
|
transform: translate(10%, 0);
|
|
103
116
|
`;
|
|
104
117
|
const Email = styled.div`
|
|
105
|
-
|
|
118
|
+
white-space: nowrap;
|
|
106
119
|
`;
|
|
107
120
|
|
|
108
121
|
const ContentWrapper = styled.div`
|
|
@@ -135,14 +148,14 @@ const ContactBlock = ({ image, jobTitle, description, name, email, blobColor = '
|
|
|
135
148
|
</ImageWrapper>
|
|
136
149
|
<ContentWrapper>
|
|
137
150
|
<TextWrapper>
|
|
138
|
-
<
|
|
151
|
+
<InfoWrapper>
|
|
139
152
|
<StyledHeader>{name}</StyledHeader>
|
|
140
153
|
<StyledText>{jobTitle}</StyledText>
|
|
141
154
|
<StyledText>
|
|
142
155
|
<Email>{`${t('email')}:`}</Email>
|
|
143
156
|
<EmailLink href={`mailto:${email}?subject=Contact us`}>{email}</EmailLink>
|
|
144
157
|
</StyledText>
|
|
145
|
-
</
|
|
158
|
+
</InfoWrapper>
|
|
146
159
|
<BlobWrapper>
|
|
147
160
|
<Blob css={blobStyling} color={isGreenBlob ? colors.support.greenLight : colors.support.redLight} />
|
|
148
161
|
</BlobWrapper>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
|
-
import { spacing, fonts,
|
|
10
|
+
import { spacing, fonts, mq, breakpoints } from '@ndla/core';
|
|
11
11
|
|
|
12
12
|
type FooterPrivacyProps = {
|
|
13
13
|
privacyLinks: {
|
|
@@ -17,60 +17,51 @@ type FooterPrivacyProps = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const StyledPrivacyLink = styled.a`
|
|
20
|
-
background: none;
|
|
21
20
|
color: #fff;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
box-shadow: ${misc.textLinkBoxShadow};
|
|
25
|
-
cursor: pointer;
|
|
21
|
+
box-shadow: none;
|
|
22
|
+
text-decoration: underline;
|
|
26
23
|
&:hover,
|
|
27
24
|
&:focus {
|
|
28
|
-
|
|
25
|
+
text-decoration: none;
|
|
29
26
|
}
|
|
30
27
|
`;
|
|
31
28
|
|
|
32
29
|
const StyledLinkSpacer = styled.span`
|
|
33
|
-
margin
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
${mq.range({ until: breakpoints.mobileWide })} {
|
|
37
|
-
visibility: hidden;
|
|
30
|
+
margin: 0 ${spacing.small};
|
|
31
|
+
${mq.range({ until: breakpoints.tablet })} {
|
|
32
|
+
display: none;
|
|
38
33
|
}
|
|
39
34
|
`;
|
|
40
35
|
|
|
41
36
|
const StyledFooterText = styled.div`
|
|
42
37
|
display: flex;
|
|
43
|
-
flex-direction: row;
|
|
44
38
|
align-items: center;
|
|
45
39
|
justify-content: center;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
text-align: center;
|
|
49
|
-
}
|
|
50
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
51
|
-
${fonts.sizes(16, 1.5)};
|
|
52
|
-
> span {
|
|
53
|
-
padding: 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
${mq.range({ until: breakpoints.mobileWide })} {
|
|
57
|
-
${fonts.sizes(14, 1.3)};
|
|
58
|
-
> span {
|
|
59
|
-
padding-bottom: ${spacing.xsmall};
|
|
60
|
-
}
|
|
40
|
+
${fonts.sizes(16, 1.5)};
|
|
41
|
+
${mq.range({ until: breakpoints.tablet })} {
|
|
61
42
|
flex-direction: column;
|
|
43
|
+
gap: ${spacing.small};
|
|
62
44
|
}
|
|
63
45
|
margin-bottom: ${spacing.large};
|
|
64
46
|
`;
|
|
65
47
|
|
|
48
|
+
const TextWrapper = styled.div`
|
|
49
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-self: flex-start;
|
|
53
|
+
text-align: center;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
66
57
|
const FooterPrivacy = ({ privacyLinks }: FooterPrivacyProps) => {
|
|
67
58
|
return (
|
|
68
59
|
<StyledFooterText>
|
|
69
60
|
{privacyLinks.map((link, index) => (
|
|
70
|
-
<
|
|
61
|
+
<TextWrapper key={link.label}>
|
|
71
62
|
{index > 0 && <StyledLinkSpacer aria-hidden>|</StyledLinkSpacer>}
|
|
72
63
|
<StyledPrivacyLink href={link.url}>{link.label}</StyledPrivacyLink>
|
|
73
|
-
</
|
|
64
|
+
</TextWrapper>
|
|
74
65
|
))}
|
|
75
66
|
</StyledFooterText>
|
|
76
67
|
);
|
package/src/Grid/Grid.tsx
CHANGED
|
@@ -16,10 +16,14 @@ const ContentWrapper = styled.div`
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
padding: ${spacing.small};
|
|
18
18
|
align-items: center;
|
|
19
|
+
${mq.range({ from: breakpoints.tabletWide })} {
|
|
20
|
+
padding: ${spacing.medium} ${spacing.large};
|
|
21
|
+
}
|
|
19
22
|
`;
|
|
20
23
|
|
|
21
24
|
const StyledImage = styled.img`
|
|
22
|
-
|
|
25
|
+
height: 150px;
|
|
26
|
+
width: 150px;
|
|
23
27
|
`;
|
|
24
28
|
|
|
25
29
|
const TitleWrapper = styled.div`
|
|
@@ -60,7 +64,7 @@ interface Props {
|
|
|
60
64
|
const KeyFigure = ({ image, title, subtitle }: Props) => {
|
|
61
65
|
return (
|
|
62
66
|
<ContentWrapper>
|
|
63
|
-
<StyledImage src={image?.src} width={
|
|
67
|
+
<StyledImage src={image?.src} width={150} height={150} alt={image?.alt} />
|
|
64
68
|
<TitleWrapper>{title}</TitleWrapper>
|
|
65
69
|
<SubTitleWrapper>{subtitle}</SubTitleWrapper>
|
|
66
70
|
</ContentWrapper>
|
|
@@ -12,6 +12,7 @@ import { css } from '@emotion/react';
|
|
|
12
12
|
import { colors, spacing, animations, mq, breakpoints } from '@ndla/core';
|
|
13
13
|
import { Back, Forward } from '@ndla/icons/common';
|
|
14
14
|
import SafeLink from '@ndla/safelink';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
15
16
|
|
|
16
17
|
const FOOTER_HEIGHT = '78px';
|
|
17
18
|
const FOOTER_HEIGHT_MOBILE = spacing.large;
|
|
@@ -114,14 +115,21 @@ type PropsSiblings = {
|
|
|
114
115
|
stepId: number;
|
|
115
116
|
};
|
|
116
117
|
|
|
117
|
-
export const LearningPathStickySibling = ({ title, toLearningPathUrl, pathId, stepId, arrow }: PropsSiblings) =>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
export const LearningPathStickySibling = ({ title, toLearningPathUrl, pathId, stepId, arrow }: PropsSiblings) => {
|
|
119
|
+
const { t } = useTranslation();
|
|
120
|
+
return (
|
|
121
|
+
<SafeLink
|
|
122
|
+
to={toLearningPathUrl(pathId, stepId)}
|
|
123
|
+
css={SafeLinkCSS}
|
|
124
|
+
aria-label={arrow === 'left' ? t('learningPath.previousArrow') : t('learningPath.nextArrow')}
|
|
125
|
+
>
|
|
126
|
+
{arrow === 'left' && <Back className="c-icon--medium" />}
|
|
127
|
+
<div>
|
|
128
|
+
<StyledTitle>{title}</StyledTitle>
|
|
129
|
+
</div>
|
|
130
|
+
{arrow === 'right' && <Forward className="c-icon--medium" />}
|
|
131
|
+
</SafeLink>
|
|
132
|
+
);
|
|
133
|
+
};
|
|
126
134
|
|
|
127
135
|
export const LearningPathStickyPlaceholder = () => <div css={SafeLinkCSS} />;
|
|
@@ -15,6 +15,7 @@ import { breakpoints, colors, spacing, mq } from '@ndla/core';
|
|
|
15
15
|
import { LinkBlockEmbedData } from '@ndla/types-embed';
|
|
16
16
|
import { useMemo } from 'react';
|
|
17
17
|
import Heading from '../Typography/Heading';
|
|
18
|
+
import { usePossiblyRelativeUrl } from '../utils/relativeUrl';
|
|
18
19
|
|
|
19
20
|
const StyledForward = styled(Forward)`
|
|
20
21
|
margin: 0 ${spacing.nsmall};
|
|
@@ -72,7 +73,12 @@ const StyledCalenderEd = styled(CalendarEd)`
|
|
|
72
73
|
color: ${colors.icon.iconBlue};
|
|
73
74
|
`;
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
interface Props extends Omit<LinkBlockEmbedData, 'resource'> {
|
|
77
|
+
path?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const LinkBlock = ({ title, language, date, url, path }: Props) => {
|
|
81
|
+
const href = usePossiblyRelativeUrl(url, path);
|
|
76
82
|
const formattedDate = useMemo(() => {
|
|
77
83
|
if (!date) return null;
|
|
78
84
|
const locale = language === 'nb' ? nb : language === 'nn' ? nn : enGB;
|
|
@@ -80,7 +86,7 @@ const LinkBlock = ({ title, language, date, url }: Omit<LinkBlockEmbedData, 'res
|
|
|
80
86
|
}, [date, language]);
|
|
81
87
|
|
|
82
88
|
return (
|
|
83
|
-
<StyledSafeLink to={
|
|
89
|
+
<StyledSafeLink to={href}>
|
|
84
90
|
<InfoWrapper>
|
|
85
91
|
<Heading element="h3" margin="none" headingStyle="h3" lang={language}>
|
|
86
92
|
{title}
|
|
@@ -71,7 +71,12 @@ const MastheadSearchModal = ({ onClose: onSearchClose, children, ndlaFilm }: Pro
|
|
|
71
71
|
return (
|
|
72
72
|
<Modal open={isOpen} onOpenChange={setIsOpen}>
|
|
73
73
|
<ModalTrigger>
|
|
74
|
-
<ToggleSearchButton
|
|
74
|
+
<ToggleSearchButton
|
|
75
|
+
onClick={() => setIsOpen(true)}
|
|
76
|
+
ndlaFilm={ndlaFilm}
|
|
77
|
+
aria-label={t('masthead.menu.search')}
|
|
78
|
+
title={t('masthead.menu.search')}
|
|
79
|
+
>
|
|
75
80
|
{t('masthead.menu.search')}
|
|
76
81
|
</ToggleSearchButton>
|
|
77
82
|
</ModalTrigger>
|