@ndla/ui 52.0.0 → 53.0.1
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/Article.js +110 -117
- package/es/Article/ArticleHeaderWrapper.js +14 -9
- package/es/Embed/ImageEmbed.js +10 -4
- package/es/all.css +1 -1
- package/es/index.js +0 -1
- package/es/locale/messages-en.js +5 -0
- package/es/locale/messages-nb.js +5 -0
- package/es/locale/messages-nn.js +5 -0
- package/es/locale/messages-se.js +5 -0
- package/es/locale/messages-sma.js +5 -0
- package/lib/Article/Article.d.ts +4 -5
- package/lib/Article/Article.js +109 -116
- package/lib/Article/ArticleByline.js +1 -1
- package/lib/Article/ArticleFootNotes.js +1 -1
- package/lib/Article/ArticleHeaderWrapper.js +15 -10
- package/lib/Article/ArticleParagraph.js +1 -1
- package/lib/Article/index.d.ts +1 -0
- package/lib/Article/index.js +1 -1
- package/lib/AudioPlayer/AudioPlayer.js +1 -1
- package/lib/AudioPlayer/Controls.js +1 -1
- package/lib/AudioPlayer/index.js +1 -1
- package/lib/BlogPost/BlogPost.js +1 -1
- package/lib/BlogPost/index.js +1 -1
- package/lib/Breadcrumb/Breadcrumb.js +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/Breadcrumb/HomeBreadcrumb.js +1 -1
- package/lib/Breadcrumb/index.js +1 -1
- package/lib/CampaignBlock/CampaignBlock.js +1 -1
- package/lib/CampaignBlock/index.js +1 -1
- package/lib/CodeBlock/CodeBlock.js +1 -1
- package/lib/CodeBlock/index.js +1 -1
- package/lib/ContactBlock/ContactBlock.js +1 -1
- package/lib/ContactBlock/index.js +1 -1
- package/lib/ContentPlaceholder/ContentPlaceholder.js +1 -1
- package/lib/ContentPlaceholder/index.js +1 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.js +1 -1
- package/lib/CopyParagraphButton/CopyParagraphButton.js +1 -1
- package/lib/CopyParagraphButton/index.js +1 -1
- package/lib/CreatedBy/CreatedBy.js +1 -1
- package/lib/CreatedBy/index.js +1 -1
- package/lib/DefinitionList/DefinitionDescription.js +1 -1
- package/lib/DefinitionList/DefinitionTerm.js +1 -1
- package/lib/DefinitionList/index.js +1 -1
- package/lib/Embed/AudioEmbed.js +1 -1
- package/lib/Embed/BrightcoveEmbed.js +1 -1
- package/lib/Embed/ConceptEmbed.js +1 -1
- package/lib/Embed/ConceptListEmbed.js +1 -1
- package/lib/Embed/ContentLinkEmbed.js +1 -1
- package/lib/Embed/CopyrightEmbed.js +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.js +1 -1
- package/lib/Embed/ExternalEmbed.js +1 -1
- package/lib/Embed/FootnoteEmbed.js +1 -1
- package/lib/Embed/H5pEmbed.js +1 -1
- package/lib/Embed/IframeEmbed.js +1 -1
- package/lib/Embed/ImageEmbed.js +11 -5
- package/lib/Embed/UnknownEmbed.js +1 -1
- package/lib/Embed/UuDisclaimerEmbed.js +1 -1
- package/lib/Embed/conceptComponents.js +1 -1
- package/lib/Embed/index.js +1 -1
- package/lib/ErrorMessage/ErrorMessage.js +1 -1
- package/lib/ErrorMessage/ErrorResourceAccessDenied.js +1 -1
- package/lib/ErrorMessage/index.js +1 -1
- package/lib/FactBox/FactBox.js +1 -1
- package/lib/FactBox/index.js +1 -1
- package/lib/Figure/Figure.js +1 -1
- package/lib/Figure/index.js +1 -1
- package/lib/FileList/File.js +1 -1
- package/lib/FileList/FileList.js +1 -1
- package/lib/FileList/Format.js +1 -1
- package/lib/FileList/index.js +1 -1
- package/lib/Footer/FooterBlock.js +1 -1
- package/lib/FramedContent/FramedContent.js +1 -1
- package/lib/FramedContent/index.js +1 -1
- package/lib/FrontpageArticle/FrontpageArticle.js +1 -1
- package/lib/Gloss/Gloss.js +1 -1
- package/lib/Gloss/GlossExample.js +1 -1
- package/lib/Gloss/index.js +1 -1
- package/lib/Grid/Grid.js +1 -1
- package/lib/Hero/Hero.js +1 -1
- package/lib/Hero/HeroContent.js +1 -1
- package/lib/Image/Image.js +1 -1
- package/lib/Image/ImageLink.js +1 -1
- package/lib/KeyFigure/KeyFigure.js +1 -1
- package/lib/KeyFigure/index.js +1 -1
- package/lib/LanguageSelector/LanguageSelector.js +1 -1
- package/lib/LanguageSelector/index.js +1 -1
- package/lib/Layout/OneColumn.js +1 -1
- package/lib/Layout/PageContainer.js +1 -1
- package/lib/Layout/index.js +1 -1
- package/lib/LetterFilter/LetterFilter.js +1 -1
- package/lib/LetterFilter/index.js +1 -1
- package/lib/LicenseByline/EmbedByline.js +1 -1
- package/lib/LicenseByline/LicenseDescription.js +1 -1
- package/lib/LicenseByline/LicenseLink.js +1 -1
- package/lib/LicenseByline/index.js +1 -1
- package/lib/LinkBlock/LinkBlock.js +1 -1
- package/lib/LinkBlock/LinkBlockSection.js +1 -1
- package/lib/LinkBlock/index.js +1 -1
- package/lib/List/OrderedList.js +1 -1
- package/lib/List/UnOrderedList.js +1 -1
- package/lib/List/index.js +1 -1
- package/lib/Logo/Logo.js +1 -1
- package/lib/Logo/SvgLogo.js +1 -1
- package/lib/Logo/index.js +1 -1
- package/lib/MediaList/MediaList.js +1 -1
- package/lib/Messages/MessageBanner.js +1 -1
- package/lib/Messages/MessageBox.js +1 -1
- package/lib/Messages/index.js +1 -1
- package/lib/MyNdla/Resource/Folder.js +1 -1
- package/lib/MyNdla/Resource/index.js +1 -1
- package/lib/MyNdla/index.js +1 -1
- package/lib/Notion/Notion.js +1 -1
- package/lib/Notion/NotionImage.js +1 -1
- package/lib/Notion/index.js +1 -1
- package/lib/ProgrammeCard/ProgrammeCard.js +1 -1
- package/lib/ProgrammeCard/index.js +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.js +1 -1
- package/lib/Resource/BlockResource.js +1 -1
- package/lib/Resource/ListResource.js +1 -1
- package/lib/Resource/index.js +1 -1
- package/lib/Resource/resourceComponents.js +1 -1
- package/lib/ResourceBox/ResourceBox.js +1 -1
- package/lib/ResourceBox/index.js +1 -1
- package/lib/Search/ActiveFilterContent.js +1 -1
- package/lib/Search/ActiveFilters.js +1 -1
- package/lib/Search/ContentTypeResult.js +1 -1
- package/lib/Search/ContentTypeResultStyles.js +1 -1
- package/lib/Search/LoadingWrapper.js +1 -1
- package/lib/Search/SearchField.js +1 -1
- package/lib/Search/SearchFieldForm.js +1 -1
- package/lib/Search/SearchResult.js +1 -1
- package/lib/Search/SearchResultSleeve.js +1 -1
- package/lib/Search/index.js +1 -1
- package/lib/SnackBar/DefaultSnackbar.js +1 -1
- package/lib/SnackBar/SnackbarProvider.js +1 -1
- package/lib/SnackBar/index.js +1 -1
- package/lib/Table/Table.js +1 -1
- package/lib/TagSelector/Control.js +1 -1
- package/lib/TagSelector/DropdownIndicator.js +1 -1
- package/lib/TagSelector/MenuList.js +1 -1
- package/lib/TagSelector/Option.js +1 -1
- package/lib/TagSelector/SelectContainer.js +1 -1
- package/lib/TagSelector/TagSelector.js +1 -1
- package/lib/TagSelector/ValueButton.js +1 -1
- package/lib/TagSelector/index.js +1 -1
- package/lib/TreeStructure/AddFolderButton.js +1 -1
- package/lib/TreeStructure/ComboboxButton.js +1 -1
- package/lib/TreeStructure/FolderItem.js +1 -1
- package/lib/TreeStructure/FolderItems.js +1 -1
- package/lib/TreeStructure/TreeStructure.js +1 -1
- package/lib/TreeStructure/index.js +1 -1
- package/lib/all.css +1 -1
- package/lib/i18n/i18n.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -26
- package/lib/locale/messages-en.d.ts +5 -0
- package/lib/locale/messages-en.js +6 -1
- package/lib/locale/messages-nb.d.ts +5 -0
- package/lib/locale/messages-nb.js +6 -1
- package/lib/locale/messages-nn.d.ts +5 -0
- package/lib/locale/messages-nn.js +6 -1
- package/lib/locale/messages-se.d.ts +5 -0
- package/lib/locale/messages-se.js +6 -1
- package/lib/locale/messages-sma.d.ts +5 -0
- package/lib/locale/messages-sma.js +6 -1
- package/lib/utils/resourceTypeColor.js +1 -1
- package/package.json +6 -7
- package/src/Article/Article.tsx +177 -113
- package/src/Article/ArticleHeaderWrapper.tsx +16 -9
- package/src/Article/index.ts +2 -0
- package/src/CodeBlock/CodeBlock.stories.tsx +1 -3
- package/src/Embed/ImageEmbed.tsx +5 -1
- package/src/LicenseByline/EmbedByline.stories.tsx +2 -2
- package/src/all.scss +2 -3
- package/src/index.ts +2 -2
- package/src/locale/messages-en.ts +5 -0
- package/src/locale/messages-nb.ts +5 -0
- package/src/locale/messages-nn.ts +5 -0
- package/src/locale/messages-se.ts +5 -0
- package/src/locale/messages-sma.ts +5 -0
- package/es/Article/ArticleNotions.js +0 -90
- package/es/Masthead/Masthead.js +0 -62
- package/es/Masthead/SkipToMainContent.js +0 -30
- package/es/Masthead/index.js +0 -13
- package/es/Masthead/utils.js +0 -38
- package/lib/Article/ArticleNotions.d.ts +0 -14
- package/lib/Article/ArticleNotions.js +0 -96
- package/lib/Masthead/Masthead.d.ts +0 -23
- package/lib/Masthead/Masthead.js +0 -68
- package/lib/Masthead/SkipToMainContent.d.ts +0 -12
- package/lib/Masthead/SkipToMainContent.js +0 -37
- package/lib/Masthead/index.d.ts +0 -12
- package/lib/Masthead/index.js +0 -36
- package/lib/Masthead/utils.d.ts +0 -11
- package/lib/Masthead/utils.js +0 -46
- package/src/Article/ArticleNotions.tsx +0 -139
- package/src/Article/component.article.scss +0 -149
- package/src/Masthead/Masthead.tsx +0 -100
- package/src/Masthead/SkipToMainContent.tsx +0 -54
- package/src/Masthead/index.ts +0 -16
- package/src/Masthead/utils.ts +0 -45
- package/src/main.scss +0 -4
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
8
|
-
var _reactI18next = require("react-i18next");
|
|
9
|
-
var _core = require("@ndla/core");
|
|
10
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (c) 2022-present, NDLA.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const StyledSkipToMainContent = /*#__PURE__*/(0, _base.default)("a", {
|
|
21
|
-
target: "e13a8y7u0",
|
|
22
|
-
label: "StyledSkipToMainContent"
|
|
23
|
-
})("position:absolute;top:10px;left:0;right:0;margin:0 auto;color:", _core.colors.white, ";background:", _core.colors.brand.primary, ";left:auto;top:auto;width:30%;height:auto;overflow:auto;margin:10px 35%;padding:5px;border-radius:15px;border:4px solid ", _core.colors.brand.tertiary, ";text-align:center;font-size:1.2em;z-index:", _core.stackOrder.popover, ";animation-name:fadeIn;animation-duration:0.3s;transform:translateY(-150%);&:focus{transform:translateY(0);}" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlNraXBUb01haW5Db250ZW50LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFnQndDIiwiZmlsZSI6IlNraXBUb01haW5Db250ZW50LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIyLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKi9cblxuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tIFwicmVhY3QtaTE4bmV4dFwiO1xuaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5pbXBvcnQgeyBjb2xvcnMsIHN0YWNrT3JkZXIgfSBmcm9tIFwiQG5kbGEvY29yZVwiO1xuXG5pbnRlcmZhY2UgUHJvcHMge1xuICBza2lwVG9NYWluQ29udGVudElkOiBzdHJpbmc7XG59XG5cbmNvbnN0IFN0eWxlZFNraXBUb01haW5Db250ZW50ID0gc3R5bGVkLmFgXG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgdG9wOiAxMHB4O1xuICBsZWZ0OiAwO1xuICByaWdodDogMDtcbiAgbWFyZ2luOiAwIGF1dG87XG4gIGNvbG9yOiAke2NvbG9ycy53aGl0ZX07XG4gIGJhY2tncm91bmQ6ICR7Y29sb3JzLmJyYW5kLnByaW1hcnl9O1xuICBsZWZ0OiBhdXRvO1xuICB0b3A6IGF1dG87XG4gIHdpZHRoOiAzMCU7XG4gIGhlaWdodDogYXV0bztcbiAgb3ZlcmZsb3c6IGF1dG87XG4gIG1hcmdpbjogMTBweCAzNSU7XG4gIHBhZGRpbmc6IDVweDtcbiAgYm9yZGVyLXJhZGl1czogMTVweDtcbiAgYm9yZGVyOiA0cHggc29saWQgJHtjb2xvcnMuYnJhbmQudGVydGlhcnl9O1xuICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gIGZvbnQtc2l6ZTogMS4yZW07XG4gIHotaW5kZXg6ICR7c3RhY2tPcmRlci5wb3BvdmVyfTtcbiAgYW5pbWF0aW9uLW5hbWU6IGZhZGVJbjtcbiAgYW5pbWF0aW9uLWR1cmF0aW9uOiAwLjNzO1xuICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoLTE1MCUpO1xuICAmOmZvY3VzIHtcbiAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZVkoMCk7XG4gIH1cbmA7XG5cbmNvbnN0IFNraXBUb01haW5Db250ZW50ID0gKHsgc2tpcFRvTWFpbkNvbnRlbnRJZCB9OiBQcm9wcykgPT4ge1xuICBjb25zdCB7IHQgfSA9IHVzZVRyYW5zbGF0aW9uKCk7XG4gIHJldHVybiAoXG4gICAgPFN0eWxlZFNraXBUb01haW5Db250ZW50IHRhYkluZGV4PXswfSBocmVmPXtgIyR7c2tpcFRvTWFpbkNvbnRlbnRJZH1gfT5cbiAgICAgIHt0KFwibWFzdGhlYWQuc2tpcFRvQ29udGVudFwiKX1cbiAgICA8L1N0eWxlZFNraXBUb01haW5Db250ZW50PlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgU2tpcFRvTWFpbkNvbnRlbnQ7XG4iXX0= */"));
|
|
24
|
-
const SkipToMainContent = _ref => {
|
|
25
|
-
let {
|
|
26
|
-
skipToMainContentId
|
|
27
|
-
} = _ref;
|
|
28
|
-
const {
|
|
29
|
-
t
|
|
30
|
-
} = (0, _reactI18next.useTranslation)();
|
|
31
|
-
return (0, _jsxRuntime.jsx)(StyledSkipToMainContent, {
|
|
32
|
-
tabIndex: 0,
|
|
33
|
-
href: "#".concat(skipToMainContentId),
|
|
34
|
-
children: t("masthead.skipToContent")
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var _default = exports.default = SkipToMainContent;
|
package/lib/Masthead/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2017-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import Masthead from "./Masthead";
|
|
9
|
-
import { default as SkipToMainContent } from "./SkipToMainContent";
|
|
10
|
-
import { getMastheadHeight, useMastheadHeight } from "./utils";
|
|
11
|
-
export { getMastheadHeight, useMastheadHeight, SkipToMainContent };
|
|
12
|
-
export default Masthead;
|
package/lib/Masthead/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "SkipToMainContent", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _SkipToMainContent.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.default = void 0;
|
|
13
|
-
Object.defineProperty(exports, "getMastheadHeight", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _utils.getMastheadHeight;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "useMastheadHeight", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _utils.useMastheadHeight;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
var _Masthead = _interopRequireDefault(require("./Masthead"));
|
|
26
|
-
var _SkipToMainContent = _interopRequireDefault(require("./SkipToMainContent"));
|
|
27
|
-
var _utils = require("./utils");
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
/**
|
|
30
|
-
* Copyright (c) 2017-present, NDLA.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
var _default = exports.default = _Masthead.default;
|
package/lib/Masthead/utils.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-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 getMastheadHeight: () => number | undefined;
|
|
9
|
-
export declare const useMastheadHeight: () => {
|
|
10
|
-
height: number | undefined;
|
|
11
|
-
};
|
package/lib/Masthead/utils.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useMastheadHeight = exports.getMastheadHeight = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _util = require("@ndla/util");
|
|
9
|
-
/**
|
|
10
|
-
* Copyright (c) 2022-present, NDLA.
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
13
|
-
* LICENSE file in the root directory of this source tree.
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const getMastheadHeight = () => {
|
|
18
|
-
if (typeof window !== "undefined") {
|
|
19
|
-
const masthead = document.getElementById("masthead");
|
|
20
|
-
return masthead === null || masthead === void 0 ? void 0 : masthead.getBoundingClientRect().height;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
exports.getMastheadHeight = getMastheadHeight;
|
|
24
|
-
const useMastheadHeight = () => {
|
|
25
|
-
const [height, setHeight] = (0, _react.useState)();
|
|
26
|
-
const [mounted, setMounted] = (0, _react.useState)(false);
|
|
27
|
-
(0, _react.useEffect)(() => {
|
|
28
|
-
setMounted(true);
|
|
29
|
-
}, []);
|
|
30
|
-
(0, _react.useEffect)(() => {
|
|
31
|
-
if (mounted) {
|
|
32
|
-
const masthead = document.getElementById("masthead");
|
|
33
|
-
const handleHeightChange = el => {
|
|
34
|
-
const newHeight = el.getBoundingClientRect().height;
|
|
35
|
-
setHeight(newHeight);
|
|
36
|
-
};
|
|
37
|
-
if (masthead) {
|
|
38
|
-
(0, _util.resizeObserver)(masthead, handleHeightChange);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, [mounted]);
|
|
42
|
-
return {
|
|
43
|
-
height
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
exports.useMastheadHeight = useMastheadHeight;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ReactNode } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { breakpoints, colors, fonts, misc, mq, spacing, stackOrder } from "@ndla/core";
|
|
13
|
-
import { Explanation, NotionFlip } from "@ndla/icons/common";
|
|
14
|
-
import { ModalHeader, ModalCloseButton, ModalBody, Modal, ModalTitle, ModalTrigger, ModalContent } from "@ndla/modal";
|
|
15
|
-
|
|
16
|
-
const ArticleNotionsContainer = styled.div`
|
|
17
|
-
margin-bottom: 26px;
|
|
18
|
-
|
|
19
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
20
|
-
margin-bottom: 0;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
const NotionsTrigger = styled.div`
|
|
25
|
-
padding: 0 ${spacing.nsmall};
|
|
26
|
-
display: inline-flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
background-color: ${colors.brand.greyLighter};
|
|
29
|
-
border-radius: ${misc.borderRadius};
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
|
|
32
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
33
|
-
position: fixed;
|
|
34
|
-
border: none;
|
|
35
|
-
padding: 0;
|
|
36
|
-
height: auto;
|
|
37
|
-
top: 12rem;
|
|
38
|
-
right: 18px;
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
z-index: ${stackOrder.trigger};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
svg {
|
|
44
|
-
&:first-of-type {
|
|
45
|
-
display: none;
|
|
46
|
-
width: 40px;
|
|
47
|
-
height: 54px;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
color: #def1ed;
|
|
50
|
-
|
|
51
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
52
|
-
display: block;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
&:nth-of-type(2) {
|
|
56
|
-
display: block;
|
|
57
|
-
color: ${colors.brand.primary};
|
|
58
|
-
margin-right: 8px;
|
|
59
|
-
|
|
60
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
61
|
-
display: none;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
span {
|
|
67
|
-
${fonts.sizes("16px", "39px")};
|
|
68
|
-
display: block;
|
|
69
|
-
font-family: ${fonts.sans};
|
|
70
|
-
font-weight: ${fonts.weight.semibold};
|
|
71
|
-
color: ${colors.brand.primary};
|
|
72
|
-
padding-bottom: 1px;
|
|
73
|
-
|
|
74
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
75
|
-
display: none;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
const ModalHeadingContainer = styled.div`
|
|
81
|
-
display: flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
|
|
84
|
-
svg {
|
|
85
|
-
display: block;
|
|
86
|
-
width: 2rem;
|
|
87
|
-
height: 2rem;
|
|
88
|
-
color: #638b98;
|
|
89
|
-
margin: 0 1rem 0 -0.25rem;
|
|
90
|
-
|
|
91
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
92
|
-
width: 3rem;
|
|
93
|
-
height: 3rem;
|
|
94
|
-
margin: 0 1.5rem 0 -0.5rem;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
98
|
-
|
|
99
|
-
const StyledModalHeader = styled(ModalHeader)`
|
|
100
|
-
display: flex;
|
|
101
|
-
justify-content: space-between;
|
|
102
|
-
align-items: center;
|
|
103
|
-
`;
|
|
104
|
-
|
|
105
|
-
type ArticleNotionsProps = {
|
|
106
|
-
children?: ReactNode;
|
|
107
|
-
buttonOffsetRight: number;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const ArticleNotions = ({ buttonOffsetRight, children }: ArticleNotionsProps) => {
|
|
111
|
-
const { t } = useTranslation();
|
|
112
|
-
const leftOffset = `${buttonOffsetRight - 32}px`;
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<ArticleNotionsContainer>
|
|
116
|
-
<Modal>
|
|
117
|
-
<ModalTrigger>
|
|
118
|
-
<NotionsTrigger role="button" aria-label={t("article.notionsPrompt")} style={{ left: leftOffset }}>
|
|
119
|
-
<NotionFlip />
|
|
120
|
-
<Explanation />
|
|
121
|
-
<span>{t("article.notionsPrompt")}</span>
|
|
122
|
-
</NotionsTrigger>
|
|
123
|
-
</ModalTrigger>
|
|
124
|
-
<ModalContent size="large">
|
|
125
|
-
<StyledModalHeader>
|
|
126
|
-
<ModalHeadingContainer>
|
|
127
|
-
<Explanation />
|
|
128
|
-
<ModalTitle>{t("article.notionsPrompt")}</ModalTitle>
|
|
129
|
-
</ModalHeadingContainer>
|
|
130
|
-
<ModalCloseButton />
|
|
131
|
-
</StyledModalHeader>
|
|
132
|
-
<ModalBody modifier="notions-modal-body no-padding">{children}</ModalBody>
|
|
133
|
-
</ModalContent>
|
|
134
|
-
</Modal>
|
|
135
|
-
</ArticleNotionsContainer>
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export default ArticleNotions;
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
** ARTICLE
|
|
3
|
-
** Clean-modifier is used to avoid negative margin (when used in design manual)
|
|
4
|
-
** Title has icon when article is a resource type
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
.c-article {
|
|
8
|
-
font-family: $font-serif;
|
|
9
|
-
background: $white;
|
|
10
|
-
margin-top: $spacing--large;
|
|
11
|
-
margin-right: auto;
|
|
12
|
-
margin-bottom: $spacing;
|
|
13
|
-
margin-left: auto;
|
|
14
|
-
overflow-wrap: break-word;
|
|
15
|
-
@include font-size(18px, 29px);
|
|
16
|
-
position: relative;
|
|
17
|
-
|
|
18
|
-
mjx-stretchy-v > mjx-ext > mjx-c {
|
|
19
|
-
transform: scaleY(100) translateY(0.075em);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
> section > p {
|
|
23
|
-
&:not([class]) {
|
|
24
|
-
margin-bottom: 29px;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@include mq(tablet) {
|
|
29
|
-
@include font-size(18px, 29px);
|
|
30
|
-
|
|
31
|
-
> section > p {
|
|
32
|
-
&:not([class]) {
|
|
33
|
-
margin-bottom: 35px;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
padding: 0 $spacing $spacing;
|
|
38
|
-
margin-bottom: $spacing--large;
|
|
39
|
-
margin-top: -$spacing * 6;
|
|
40
|
-
padding-top: $spacing--large + $spacing;
|
|
41
|
-
&--subject-material {
|
|
42
|
-
border: 2px solid $subject-material-light;
|
|
43
|
-
}
|
|
44
|
-
&--assessment-resources {
|
|
45
|
-
border: 2px solid $assessment-resource-background;
|
|
46
|
-
}
|
|
47
|
-
&--tasks-and-activities {
|
|
48
|
-
border: 2px solid $tasks-and-activities-background;
|
|
49
|
-
}
|
|
50
|
-
&--concept {
|
|
51
|
-
border: 2px solid $concept-light;
|
|
52
|
-
}
|
|
53
|
-
&--source-material {
|
|
54
|
-
border: 2px solid $source-material-light;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
@include mq(desktop) {
|
|
58
|
-
padding-bottom: $spacing--large;
|
|
59
|
-
margin-bottom: $spacing--large;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&:after {
|
|
63
|
-
content: "";
|
|
64
|
-
display: table;
|
|
65
|
-
clear: both;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
p {
|
|
69
|
-
margin-top: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&--multidisciplinary-topic {
|
|
73
|
-
margin-top: 0;
|
|
74
|
-
padding: $spacing--small;
|
|
75
|
-
@include mq(tablet) {
|
|
76
|
-
padding: 0;
|
|
77
|
-
}
|
|
78
|
-
border: none;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
.c-article--clean {
|
|
82
|
-
margin-top: $spacing;
|
|
83
|
-
padding: $spacing--small;
|
|
84
|
-
@include mq(tablet) {
|
|
85
|
-
padding: 0;
|
|
86
|
-
}
|
|
87
|
-
border: none;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.c-article--in-topic {
|
|
91
|
-
margin-top: 0;
|
|
92
|
-
padding: 0;
|
|
93
|
-
padding-left: $spacing--medium;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.c-article__header {
|
|
97
|
-
margin-bottom: $spacing;
|
|
98
|
-
@include mq(tablet) {
|
|
99
|
-
margin-bottom: $spacing--large;
|
|
100
|
-
}
|
|
101
|
-
@include mq(desktop) {
|
|
102
|
-
margin-bottom: $spacing--large;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.c-article__competence {
|
|
107
|
-
margin-top: $spacing;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.c-article__title {
|
|
111
|
-
position: relative;
|
|
112
|
-
|
|
113
|
-
h1 {
|
|
114
|
-
margin: 0;
|
|
115
|
-
@include mq($until: tablet) {
|
|
116
|
-
line-height: 2rem;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
padding: 0 0 $spacing 0;
|
|
121
|
-
|
|
122
|
-
@include mq(tablet) {
|
|
123
|
-
padding: 0 0 $spacing--medium 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
p {
|
|
127
|
-
@include font-size(18px, 24px);
|
|
128
|
-
color: $text-light-color;
|
|
129
|
-
text-transform: uppercase;
|
|
130
|
-
margin-bottom: 0;
|
|
131
|
-
font-family: $font;
|
|
132
|
-
@include mq($until: tablet) {
|
|
133
|
-
margin-bottom: 0;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.c-article__title--icon {
|
|
139
|
-
padding-left: 80px;
|
|
140
|
-
|
|
141
|
-
[data-badge] {
|
|
142
|
-
position: absolute;
|
|
143
|
-
left: 0;
|
|
144
|
-
|
|
145
|
-
@include mq(tablet) {
|
|
146
|
-
top: $spacing--xsmall;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ReactNode } from "react";
|
|
10
|
-
import { css } from "@emotion/react";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { breakpoints, colors, fonts, mq, spacing, stackOrder } from "@ndla/core";
|
|
13
|
-
import SkipToMainContent from "./SkipToMainContent";
|
|
14
|
-
import { MessageBanner } from "../Messages";
|
|
15
|
-
|
|
16
|
-
const MastheadContent = styled.div`
|
|
17
|
-
justify-content: center;
|
|
18
|
-
align-items: center;
|
|
19
|
-
text-align: center;
|
|
20
|
-
padding: ${spacing.small} ${spacing.normal};
|
|
21
|
-
font-weight: ${fonts.weight.normal};
|
|
22
|
-
display: flex;
|
|
23
|
-
height: 84px;
|
|
24
|
-
justify-content: space-between;
|
|
25
|
-
gap: ${spacing.xsmall};
|
|
26
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
27
|
-
padding: ${spacing.small};
|
|
28
|
-
gap: ${spacing.xsmall};
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
interface StyledMastheadProps {
|
|
33
|
-
fixed: boolean;
|
|
34
|
-
ndlaFilm: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const StyledMasthead = styled.div<StyledMastheadProps>`
|
|
38
|
-
z-index: ${stackOrder.banner};
|
|
39
|
-
position: relative;
|
|
40
|
-
background: white;
|
|
41
|
-
border-bottom: 1px solid ${colors.brand.greyLighter};
|
|
42
|
-
min-height: 84px;
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-flow: column;
|
|
45
|
-
justify-content: flex-end;
|
|
46
|
-
${(p) =>
|
|
47
|
-
p.fixed &&
|
|
48
|
-
css`
|
|
49
|
-
top: 0;
|
|
50
|
-
position: sticky;
|
|
51
|
-
@media print {
|
|
52
|
-
position: relative;
|
|
53
|
-
}
|
|
54
|
-
`};
|
|
55
|
-
${(p) =>
|
|
56
|
-
p.ndlaFilm &&
|
|
57
|
-
css`
|
|
58
|
-
background: ${colors.ndlaFilm.filmColorLight};
|
|
59
|
-
background-image: linear-gradient(0deg, ${colors.ndlaFilm.filmColorLight}, ${colors.ndlaFilm.filmColor});
|
|
60
|
-
border: 0;
|
|
61
|
-
border-bottom: 1px solid #18334c;
|
|
62
|
-
`};
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
interface Alert {
|
|
66
|
-
content: string;
|
|
67
|
-
closable?: boolean;
|
|
68
|
-
number: number;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
interface Props {
|
|
72
|
-
children?: ReactNode;
|
|
73
|
-
fixed?: boolean;
|
|
74
|
-
ndlaFilm?: boolean;
|
|
75
|
-
skipToMainContentId?: string;
|
|
76
|
-
messages?: Alert[];
|
|
77
|
-
onCloseAlert?: (id: number) => void;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const Masthead = ({ children, fixed, ndlaFilm, skipToMainContentId, messages, onCloseAlert }: Props) => {
|
|
81
|
-
return (
|
|
82
|
-
<>
|
|
83
|
-
{skipToMainContentId && <SkipToMainContent skipToMainContentId={skipToMainContentId} />}
|
|
84
|
-
<StyledMasthead fixed={!!fixed} ndlaFilm={!!ndlaFilm} id="masthead">
|
|
85
|
-
{messages?.map((message) => (
|
|
86
|
-
<MessageBanner
|
|
87
|
-
key={message.number}
|
|
88
|
-
showCloseButton={message.closable}
|
|
89
|
-
onClose={() => onCloseAlert?.(message.number)}
|
|
90
|
-
>
|
|
91
|
-
{message.content}
|
|
92
|
-
</MessageBanner>
|
|
93
|
-
))}
|
|
94
|
-
<MastheadContent className="u-1/1">{children}</MastheadContent>
|
|
95
|
-
</StyledMasthead>
|
|
96
|
-
</>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default Masthead;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-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
|
-
|
|
9
|
-
import { useTranslation } from "react-i18next";
|
|
10
|
-
import styled from "@emotion/styled";
|
|
11
|
-
import { colors, stackOrder } from "@ndla/core";
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
skipToMainContentId: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const StyledSkipToMainContent = styled.a`
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 10px;
|
|
20
|
-
left: 0;
|
|
21
|
-
right: 0;
|
|
22
|
-
margin: 0 auto;
|
|
23
|
-
color: ${colors.white};
|
|
24
|
-
background: ${colors.brand.primary};
|
|
25
|
-
left: auto;
|
|
26
|
-
top: auto;
|
|
27
|
-
width: 30%;
|
|
28
|
-
height: auto;
|
|
29
|
-
overflow: auto;
|
|
30
|
-
margin: 10px 35%;
|
|
31
|
-
padding: 5px;
|
|
32
|
-
border-radius: 15px;
|
|
33
|
-
border: 4px solid ${colors.brand.tertiary};
|
|
34
|
-
text-align: center;
|
|
35
|
-
font-size: 1.2em;
|
|
36
|
-
z-index: ${stackOrder.popover};
|
|
37
|
-
animation-name: fadeIn;
|
|
38
|
-
animation-duration: 0.3s;
|
|
39
|
-
transform: translateY(-150%);
|
|
40
|
-
&:focus {
|
|
41
|
-
transform: translateY(0);
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
const SkipToMainContent = ({ skipToMainContentId }: Props) => {
|
|
46
|
-
const { t } = useTranslation();
|
|
47
|
-
return (
|
|
48
|
-
<StyledSkipToMainContent tabIndex={0} href={`#${skipToMainContentId}`}>
|
|
49
|
-
{t("masthead.skipToContent")}
|
|
50
|
-
</StyledSkipToMainContent>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default SkipToMainContent;
|
package/src/Masthead/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2017-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
|
-
|
|
9
|
-
import Masthead from "./Masthead";
|
|
10
|
-
|
|
11
|
-
import { default as SkipToMainContent } from "./SkipToMainContent";
|
|
12
|
-
import { getMastheadHeight, useMastheadHeight } from "./utils";
|
|
13
|
-
|
|
14
|
-
export { getMastheadHeight, useMastheadHeight, SkipToMainContent };
|
|
15
|
-
|
|
16
|
-
export default Masthead;
|
package/src/Masthead/utils.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-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
|
-
|
|
9
|
-
import { useEffect, useState } from "react";
|
|
10
|
-
import { resizeObserver } from "@ndla/util";
|
|
11
|
-
|
|
12
|
-
export const getMastheadHeight = (): number | undefined => {
|
|
13
|
-
if (typeof window !== "undefined") {
|
|
14
|
-
const masthead = document.getElementById("masthead");
|
|
15
|
-
return masthead?.getBoundingClientRect().height;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const useMastheadHeight = () => {
|
|
20
|
-
const [height, setHeight] = useState<number>();
|
|
21
|
-
const [mounted, setMounted] = useState(false);
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
setMounted(true);
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (mounted) {
|
|
29
|
-
const masthead = document.getElementById("masthead");
|
|
30
|
-
|
|
31
|
-
const handleHeightChange = (el: HTMLElement) => {
|
|
32
|
-
const newHeight = el.getBoundingClientRect().height;
|
|
33
|
-
setHeight(newHeight);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
if (masthead) {
|
|
37
|
-
resizeObserver(masthead, handleHeightChange);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, [mounted]);
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
height,
|
|
44
|
-
};
|
|
45
|
-
};
|
package/src/main.scss
DELETED