@ndla/ui 3.2.1-alpha.3 → 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/AuthorInfo/AuthorInfo.js +1 -2
- package/es/BackgroundImage/BackgroundImage.js +5 -15
- package/es/ContentLoader/index.js +14 -27
- package/es/Dialog/Dialog.js +10 -28
- package/es/FactBox/FactBox.js +7 -11
- package/es/Figure/Figure.js +9 -41
- package/es/Figure/FigureExpandButton.js +2 -11
- package/es/Figure/FigureLicense.js +4 -24
- package/es/Figure/FigureLicenseDialog.js +2 -20
- package/es/FileList/File.js +0 -13
- package/es/FileList/FileList.js +0 -13
- package/es/Hero/Hero.js +0 -6
- package/es/Image/Image.js +4 -27
- package/es/Image/ImageLink.js +3 -12
- package/es/Image/LazyLoadImage.js +4 -13
- package/es/InfoBox/InfoBox.js +0 -4
- package/es/InfoWidget/InfoWidget.js +2 -21
- package/es/Logo/Logo.js +6 -22
- package/es/Logo/SvgLogo.js +4 -12
- package/es/Masthead/Masthead.js +12 -33
- package/es/NoContentBox/NoContentBox.js +2 -11
- package/es/Portrait/Portrait.js +0 -11
- package/es/RelatedArticleList/RelatedArticleList.js +4 -23
- package/es/Topic/Topic.js +20 -20
- package/es/Translation/Translation.js +0 -5
- package/es/Translation/TranslationBox.js +7 -3
- package/es/Translation/TranslationLine.js +4 -15
- 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.d.ts +11 -0
- package/lib/BackgroundImage/BackgroundImage.js +5 -17
- package/lib/BackgroundImage/index.d.ts +2 -0
- package/lib/ContentLoader/index.d.ts +20 -0
- package/lib/ContentLoader/index.js +14 -28
- package/lib/Dialog/Dialog.d.ts +23 -0
- package/lib/Dialog/Dialog.js +9 -29
- package/lib/Dialog/index.d.ts +10 -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.d.ts +50 -0
- package/lib/Figure/Figure.js +7 -41
- package/lib/Figure/FigureExpandButton.d.ts +16 -0
- package/lib/Figure/FigureExpandButton.js +2 -13
- package/lib/Figure/FigureLicense.d.ts +33 -0
- package/lib/Figure/FigureLicense.js +5 -27
- package/lib/Figure/FigureLicenseDialog.d.ts +29 -0
- package/lib/Figure/FigureLicenseDialog.js +1 -22
- package/lib/Figure/index.d.ts +12 -0
- package/lib/FileList/File.d.ts +7 -0
- package/lib/FileList/File.js +0 -14
- package/lib/FileList/FileList.d.ts +17 -0
- package/lib/FileList/FileList.js +0 -14
- package/lib/FileList/index.d.ts +3 -0
- package/lib/Hero/Hero.d.ts +26 -0
- package/lib/Hero/Hero.js +0 -8
- package/lib/Hero/index.d.ts +8 -0
- package/lib/Image/Image.d.ts +25 -0
- package/lib/Image/Image.js +4 -28
- package/lib/Image/ImageLink.d.ts +18 -0
- package/lib/Image/ImageLink.js +3 -15
- package/lib/Image/LazyLoadImage.d.ts +17 -0
- package/lib/Image/LazyLoadImage.js +3 -13
- package/lib/Image/index.d.ts +11 -0
- package/lib/InfoBox/InfoBox.d.ts +6 -0
- package/lib/InfoBox/InfoBox.js +0 -5
- package/{src/InfoBox/index.js → lib/InfoBox/index.d.ts} +0 -0
- package/lib/InfoWidget/InfoWidget.d.ts +19 -0
- package/lib/InfoWidget/InfoWidget.js +2 -22
- package/lib/InfoWidget/index.d.ts +2 -0
- package/lib/Logo/Logo.d.ts +24 -0
- package/lib/Logo/Logo.js +6 -29
- package/lib/Logo/SvgLogo.d.ts +14 -0
- package/lib/Logo/SvgLogo.js +4 -13
- package/lib/Logo/index.d.ts +9 -0
- package/lib/Masthead/Masthead.d.ts +27 -0
- package/lib/Masthead/Masthead.js +10 -34
- package/lib/Masthead/index.d.ts +10 -0
- package/lib/NoContentBox/NoContentBox.d.ts +14 -0
- package/lib/NoContentBox/NoContentBox.js +1 -11
- package/lib/NoContentBox/index.d.ts +9 -0
- package/lib/Portrait/Portrait.d.ts +15 -0
- package/lib/Portrait/Portrait.js +0 -12
- package/lib/Portrait/index.d.ts +9 -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.d.ts +3 -2
- package/lib/Topic/Topic.js +20 -20
- package/lib/Translation/Translation.d.ts +14 -0
- package/lib/Translation/Translation.js +0 -6
- package/lib/Translation/TranslationBox.d.ts +10 -0
- package/lib/Translation/TranslationBox.js +6 -2
- package/lib/Translation/TranslationLine.d.ts +16 -0
- package/lib/Translation/TranslationLine.js +4 -22
- package/{src/Translation/index.js → lib/Translation/index.d.ts} +0 -0
- package/lib/index-javascript.js +0 -230
- package/lib/index.d.ts +17 -0
- package/lib/index.js +263 -0
- package/lib/locale/messages-en.d.ts +4 -0
- package/lib/locale/messages-en.js +4 -0
- package/lib/locale/messages-nb.d.ts +4 -0
- package/lib/locale/messages-nb.js +5 -1
- package/lib/locale/messages-nn.d.ts +4 -0
- package/lib/locale/messages-nn.js +5 -1
- package/lib/types.d.ts +10 -0
- package/lib/utils/createUniversalPortal.d.ts +9 -0
- package/package.json +6 -6
- package/src/Article/ArticleAuthorContent.tsx +0 -1
- package/src/AuthorInfo/AuthorInfo.tsx +0 -1
- package/src/BackgroundImage/BackgroundImage.tsx +32 -0
- package/src/BackgroundImage/{index.js → index.ts} +0 -0
- package/src/ContentLoader/{index.js → index.tsx} +20 -30
- package/src/Dialog/{Dialog.jsx → Dialog.tsx} +20 -32
- package/src/Dialog/{index.js → index.ts} +0 -0
- package/src/FactBox/{FactBox.jsx → FactBox.tsx} +12 -14
- package/src/FactBox/{index.js → index.ts} +0 -0
- package/src/Figure/{Figure.js → Figure.tsx} +44 -54
- package/src/Figure/{FigureExpandButton.js → FigureExpandButton.tsx} +8 -9
- package/src/Figure/{FigureLicense.js → FigureLicense.tsx} +32 -30
- package/src/Figure/{FigureLicenseDialog.js → FigureLicenseDialog.tsx} +22 -22
- package/src/Figure/{index.js → index.ts} +0 -0
- package/src/FileList/{File.jsx → File.tsx} +8 -18
- package/src/FileList/FileList.tsx +36 -0
- package/src/FileList/{index.js → index.ts} +0 -0
- package/src/Hero/Hero.tsx +56 -0
- package/src/Hero/{index.js → index.ts} +0 -0
- package/src/Image/{Image.jsx → Image.tsx} +30 -30
- package/src/Image/{ImageLink.js → ImageLink.tsx} +11 -12
- package/src/Image/LazyLoadImage.tsx +40 -0
- package/src/Image/__tests__/__snapshots__/Image-test.jsx.snap +4 -3
- package/src/Image/{index.js → index.ts} +0 -0
- package/src/InfoBox/InfoBox.tsx +11 -0
- package/src/InfoBox/index.ts +1 -0
- package/src/InfoWidget/{InfoWidget.jsx → InfoWidget.tsx} +19 -26
- package/src/InfoWidget/{index.js → index.ts} +0 -0
- package/src/Logo/{Logo.jsx → Logo.tsx} +21 -28
- package/src/Logo/{SvgLogo.jsx → SvgLogo.tsx} +8 -14
- package/src/Logo/{index.js → index.ts} +0 -0
- package/src/Masthead/{Masthead.jsx → Masthead.tsx} +33 -35
- package/src/Masthead/{index.js → index.ts} +0 -0
- package/src/NoContentBox/{NoContentBox.jsx → NoContentBox.tsx} +7 -13
- package/src/NoContentBox/{index.js → index.ts} +0 -0
- package/src/Portrait/{Portrait.jsx → Portrait.tsx} +8 -14
- package/src/Portrait/{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/Topic/Topic.tsx +3 -2
- package/src/Translation/{Translation.jsx → Translation.tsx} +7 -8
- package/src/Translation/TranslationBox.tsx +20 -0
- package/src/Translation/{TranslationLine.jsx → TranslationLine.tsx} +11 -18
- package/src/Translation/index.ts +3 -0
- package/src/index-javascript.js +0 -32
- package/src/index.ts +41 -0
- package/src/locale/messages-en.ts +4 -0
- package/src/locale/messages-nb.ts +5 -1
- package/src/locale/messages-nn.ts +5 -1
- package/src/types.ts +12 -0
- package/src/utils/{createUniversalPortal.jsx → createUniversalPortal.tsx} +3 -3
- package/es/Image/shapes.js +0 -18
- package/lib/Image/shapes.js +0 -33
- package/src/BackgroundImage/BackgroundImage.jsx +0 -39
- package/src/FileList/FileList.jsx +0 -36
- package/src/Hero/Hero.jsx +0 -38
- package/src/Image/LazyLoadImage.jsx +0 -39
- package/src/Image/shapes.js +0 -21
- package/src/InfoBox/InfoBox.jsx +0 -13
- package/src/Translation/TranslationBox.jsx +0 -12
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, {
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
9
|
+
import React, { ReactNode } from 'react';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
12
11
|
|
|
13
12
|
const classes = new BEMHelper({
|
|
@@ -15,15 +14,22 @@ const classes = new BEMHelper({
|
|
|
15
14
|
prefix: 'c-',
|
|
16
15
|
});
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
interface Props {
|
|
18
|
+
isTerm?: boolean;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
lang?: string;
|
|
21
|
+
langName?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const TranslationLine = ({ children, lang, langName, isTerm = false }: Props) => {
|
|
19
25
|
const hasLang = langName && lang;
|
|
20
26
|
const content = (
|
|
21
|
-
|
|
27
|
+
<>
|
|
22
28
|
<div {...classes('line-body')} lang={lang}>
|
|
23
29
|
{children}
|
|
24
30
|
</div>
|
|
25
31
|
{hasLang && <div {...classes('line-lang')}>{langName}</div>}
|
|
26
|
-
|
|
32
|
+
</>
|
|
27
33
|
);
|
|
28
34
|
|
|
29
35
|
if (isTerm) {
|
|
@@ -33,17 +39,4 @@ const TranslationLine = ({ children, lang, langName, isTerm }) => {
|
|
|
33
39
|
return <dd {...classes('line', hasLang ? 'lang' : '')}>{content}</dd>;
|
|
34
40
|
};
|
|
35
41
|
|
|
36
|
-
TranslationLine.propTypes = {
|
|
37
|
-
isTerm: PropTypes.bool,
|
|
38
|
-
children: PropTypes.node.isRequired,
|
|
39
|
-
lang: PropTypes.string,
|
|
40
|
-
langName: PropTypes.string,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
TranslationLine.defaultProps = {
|
|
44
|
-
isTerm: false,
|
|
45
|
-
lang: undefined,
|
|
46
|
-
langName: undefined,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
42
|
export default TranslationLine;
|
package/src/index-javascript.js
CHANGED
|
@@ -6,13 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export { InfoBox } from './InfoBox';
|
|
10
|
-
|
|
11
|
-
export { default as Logo } from './Logo';
|
|
12
9
|
export { default as Table } from './Table';
|
|
13
10
|
export { FilterList, FilterListPhone, FilterButtons } from './Filter';
|
|
14
|
-
export { default as FactBox } from './FactBox';
|
|
15
|
-
export { default as FileList, File } from './FileList';
|
|
16
11
|
|
|
17
12
|
export {
|
|
18
13
|
SearchOverlay,
|
|
@@ -39,10 +34,8 @@ export {
|
|
|
39
34
|
ExternalLearningResourcesBadge,
|
|
40
35
|
SourceMaterialBadge,
|
|
41
36
|
} from './ContentTypeBadge';
|
|
42
|
-
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
43
37
|
export { default as TopicIntroductionList } from './TopicIntroductionList';
|
|
44
38
|
export { default as TopicMenu, TopicMenuButton } from './TopicMenu';
|
|
45
|
-
export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
|
|
46
39
|
export {
|
|
47
40
|
default as CompetenceGoals,
|
|
48
41
|
CompetenceGoalList,
|
|
@@ -51,21 +44,7 @@ export {
|
|
|
51
44
|
CompetenceGoalsDialog,
|
|
52
45
|
} from './CompetenceGoals';
|
|
53
46
|
|
|
54
|
-
export { default as NoContentBox } from './NoContentBox';
|
|
55
|
-
|
|
56
47
|
export { default as ResourcesWrapper, ResourcesTitle, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
57
|
-
export {
|
|
58
|
-
SubjectMaterialHero,
|
|
59
|
-
TasksAndActivitiesHero,
|
|
60
|
-
AssessmentResourcesHero,
|
|
61
|
-
SubjectHero,
|
|
62
|
-
ExternalLearningResourcesHero,
|
|
63
|
-
SourceMaterialHero,
|
|
64
|
-
Hero,
|
|
65
|
-
NdlaFilmHero,
|
|
66
|
-
} from './Hero';
|
|
67
|
-
export { default as Masthead, MastheadItem } from './Masthead';
|
|
68
|
-
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
|
|
69
48
|
export {
|
|
70
49
|
MediaList,
|
|
71
50
|
MediaListItem,
|
|
@@ -77,17 +56,8 @@ export {
|
|
|
77
56
|
|
|
78
57
|
export { EmbeddedTwitter, EmbeddedFacebook, EmbeddedFacebookPage } from './Embedded';
|
|
79
58
|
|
|
80
|
-
export { default as Image, ImageLink } from './Image';
|
|
81
|
-
export { makeSrcQueryString } from './Image';
|
|
82
|
-
export { default as Portrait } from './Portrait';
|
|
83
|
-
export { Translation, TranslationLine, TranslationBox } from './Translation';
|
|
84
|
-
|
|
85
|
-
export { default as ContentLoader } from './ContentLoader';
|
|
86
|
-
|
|
87
59
|
export { DisplayOnPageYOffset } from './Animation';
|
|
88
60
|
|
|
89
|
-
export { default as InfoWidget } from './InfoWidget';
|
|
90
|
-
|
|
91
61
|
export {
|
|
92
62
|
FilmSlideshow,
|
|
93
63
|
MovieGrid,
|
|
@@ -96,5 +66,3 @@ export {
|
|
|
96
66
|
FilmMovieList,
|
|
97
67
|
AllMoviesAlphabetically,
|
|
98
68
|
} from './NDLAFilm';
|
|
99
|
-
|
|
100
|
-
export { default as Spinner } from './Spinner';
|
package/src/index.ts
CHANGED
|
@@ -24,10 +24,30 @@ export {
|
|
|
24
24
|
default as Article,
|
|
25
25
|
} from './Article';
|
|
26
26
|
|
|
27
|
+
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
28
|
+
|
|
29
|
+
export { default as NoContentBox } from './NoContentBox';
|
|
30
|
+
|
|
31
|
+
export { default as Masthead, MastheadItem } from './Masthead';
|
|
32
|
+
|
|
33
|
+
export { default as Portrait } from './Portrait';
|
|
34
|
+
|
|
35
|
+
export { default as ContentLoader } from './ContentLoader';
|
|
36
|
+
|
|
37
|
+
export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
|
|
38
|
+
|
|
27
39
|
export { ErrorResourceAccessDenied, default as ErrorMessage } from './ErrorMessage';
|
|
28
40
|
|
|
41
|
+
export { default as FileList, File } from './FileList';
|
|
42
|
+
|
|
29
43
|
export { BlogPost, BlogPostWrapper } from './BlogPosts';
|
|
30
44
|
|
|
45
|
+
export { default as Logo } from './Logo';
|
|
46
|
+
|
|
47
|
+
export { InfoBox } from './InfoBox';
|
|
48
|
+
|
|
49
|
+
export { default as InfoWidget } from './InfoWidget';
|
|
50
|
+
|
|
31
51
|
export {
|
|
32
52
|
FrontpageInfo,
|
|
33
53
|
FrontpageFilm,
|
|
@@ -39,8 +59,26 @@ export {
|
|
|
39
59
|
FrontpageProgramMenu,
|
|
40
60
|
} from './Frontpage';
|
|
41
61
|
|
|
62
|
+
export { default as FactBox } from './FactBox';
|
|
63
|
+
|
|
64
|
+
export { default as Image, ImageLink } from './Image';
|
|
65
|
+
export { makeSrcQueryString } from './Image';
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
SubjectMaterialHero,
|
|
69
|
+
TasksAndActivitiesHero,
|
|
70
|
+
AssessmentResourcesHero,
|
|
71
|
+
SubjectHero,
|
|
72
|
+
ExternalLearningResourcesHero,
|
|
73
|
+
SourceMaterialHero,
|
|
74
|
+
Hero,
|
|
75
|
+
NdlaFilmHero,
|
|
76
|
+
} from './Hero';
|
|
77
|
+
|
|
42
78
|
export { Footer, EditorName, FooterText, FooterAuth } from './Footer';
|
|
43
79
|
|
|
80
|
+
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
|
|
81
|
+
|
|
44
82
|
export { LanguageSelector } from './LanguageSelector';
|
|
45
83
|
|
|
46
84
|
export {
|
|
@@ -55,6 +93,9 @@ export {
|
|
|
55
93
|
LearningPathMobileStepInfo,
|
|
56
94
|
LearningPathMobileHeader,
|
|
57
95
|
} from './LearningPaths';
|
|
96
|
+
export { Translation, TranslationLine, TranslationBox } from './Translation';
|
|
97
|
+
|
|
98
|
+
export { default as Spinner } from './Spinner';
|
|
58
99
|
|
|
59
100
|
export { default as SearchResultSleeve } from './Search/SearchResultSleeve';
|
|
60
101
|
|
|
@@ -808,6 +808,10 @@ const messages = {
|
|
|
808
808
|
reuse: 'Use video',
|
|
809
809
|
error: 'Sorry, an error occurred while loading the video or metadata about the video.',
|
|
810
810
|
},
|
|
811
|
+
other: {
|
|
812
|
+
download: 'Download content',
|
|
813
|
+
reuse: 'Use content',
|
|
814
|
+
},
|
|
811
815
|
concept: {
|
|
812
816
|
showDescription: 'Show concept description',
|
|
813
817
|
error: {
|
|
@@ -538,7 +538,7 @@ const messages = {
|
|
|
538
538
|
es: 'Spansk',
|
|
539
539
|
zh: 'Kinesisk',
|
|
540
540
|
unknown: 'Ukjent',
|
|
541
|
-
prefixChangeLanguage: 'Velg
|
|
541
|
+
prefixChangeLanguage: 'Velg språk',
|
|
542
542
|
},
|
|
543
543
|
changeLanguage: {
|
|
544
544
|
nb: 'Endre språk til bokmål',
|
|
@@ -807,6 +807,10 @@ const messages = {
|
|
|
807
807
|
reuse: 'Bruk video',
|
|
808
808
|
error: 'Beklager, en feil oppstod ved lasting av videoen eller metadata om videoen.',
|
|
809
809
|
},
|
|
810
|
+
other: {
|
|
811
|
+
download: 'Last ned innhold',
|
|
812
|
+
reuse: 'Bruk innhold',
|
|
813
|
+
},
|
|
810
814
|
concept: {
|
|
811
815
|
showDescription: 'Vis beskrivelsen av forklaringen.',
|
|
812
816
|
error: {
|
|
@@ -539,7 +539,7 @@ const messages = {
|
|
|
539
539
|
es: 'Spansk',
|
|
540
540
|
zh: 'Kinesisk',
|
|
541
541
|
unknown: 'Ukjent',
|
|
542
|
-
prefixChangeLanguage: 'Vel
|
|
542
|
+
prefixChangeLanguage: 'Vel språk',
|
|
543
543
|
},
|
|
544
544
|
changeLanguage: {
|
|
545
545
|
nb: 'Endre språk til bokmål',
|
|
@@ -808,6 +808,10 @@ const messages = {
|
|
|
808
808
|
reuse: 'Bruk video',
|
|
809
809
|
error: 'Orsak, ein feil oppstod ved lasting av videoen eller metadata om videoen.',
|
|
810
810
|
},
|
|
811
|
+
other: {
|
|
812
|
+
download: 'Last ned innhald',
|
|
813
|
+
reuse: 'Bruk innhald',
|
|
814
|
+
},
|
|
811
815
|
concept: {
|
|
812
816
|
showDescription: 'Vis skildring av forklaringa',
|
|
813
817
|
error: {
|
package/src/types.ts
CHANGED
|
@@ -45,6 +45,18 @@ export interface License {
|
|
|
45
45
|
license: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export interface ImageCrop {
|
|
49
|
+
startX: number;
|
|
50
|
+
startY: number;
|
|
51
|
+
endX: number;
|
|
52
|
+
endY: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ImageFocalPoint {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
export interface Copyright {
|
|
49
61
|
license: License;
|
|
50
62
|
creators: Array<Contributor>;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
// N.B This helper is intended to be used in https://github.com/ndlano/article-converter. It is not a general soultion for using portals in SSR applications.
|
|
10
10
|
|
|
11
|
-
import React from 'react';
|
|
11
|
+
import React, { ReactNode } from 'react';
|
|
12
12
|
import ReactDOM from 'react-dom';
|
|
13
13
|
|
|
14
14
|
function canUseDOM() {
|
|
@@ -20,9 +20,9 @@ function canUseDOM() {
|
|
|
20
20
|
); // window.document.hidden === jsdom check
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export function createUniversalPortal(children, selector) {
|
|
23
|
+
export function createUniversalPortal(children: ReactNode, selector: string) {
|
|
24
24
|
if (!canUseDOM()) {
|
|
25
25
|
return <div data-react-universal-portal>{children}</div>;
|
|
26
26
|
}
|
|
27
|
-
return ReactDOM.createPortal(children, document.querySelector(selector));
|
|
27
|
+
return ReactDOM.createPortal(children, document.querySelector(selector) as Element);
|
|
28
28
|
}
|
package/es/Image/shapes.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
|
-
export var CropShape = PropTypes.shape({
|
|
10
|
-
startX: PropTypes.number.isRequired,
|
|
11
|
-
startY: PropTypes.number.isRequired,
|
|
12
|
-
endX: PropTypes.number.isRequired,
|
|
13
|
-
endY: PropTypes.number.isRequired
|
|
14
|
-
});
|
|
15
|
-
export var FocalPointShape = PropTypes.shape({
|
|
16
|
-
x: PropTypes.number.isRequired,
|
|
17
|
-
y: PropTypes.number.isRequired
|
|
18
|
-
});
|
package/lib/Image/shapes.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FocalPointShape = exports.CropShape = void 0;
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (c) 2019-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
|
-
var CropShape = _propTypes["default"].shape({
|
|
20
|
-
startX: _propTypes["default"].number.isRequired,
|
|
21
|
-
startY: _propTypes["default"].number.isRequired,
|
|
22
|
-
endX: _propTypes["default"].number.isRequired,
|
|
23
|
-
endY: _propTypes["default"].number.isRequired
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
exports.CropShape = CropShape;
|
|
27
|
-
|
|
28
|
-
var FocalPointShape = _propTypes["default"].shape({
|
|
29
|
-
x: _propTypes["default"].number.isRequired,
|
|
30
|
-
y: _propTypes["default"].number.isRequired
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
exports.FocalPointShape = FocalPointShape;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import BEMHelper from 'react-bem-helper';
|
|
4
|
-
|
|
5
|
-
import { breakpoints } from '@ndla/util';
|
|
6
|
-
|
|
7
|
-
const classes = BEMHelper('c-background-image');
|
|
8
|
-
|
|
9
|
-
const BackgroundImage = ({ images, showOverlay }) => (
|
|
10
|
-
<div {...classes('', showOverlay)}>
|
|
11
|
-
{images &&
|
|
12
|
-
images.map((image) =>
|
|
13
|
-
image.types.map((type) => (
|
|
14
|
-
<div
|
|
15
|
-
key={`${image.url}${type}`}
|
|
16
|
-
{...classes('background', type)}
|
|
17
|
-
style={{ backgroundImage: `url(${image.url})` }}
|
|
18
|
-
/>
|
|
19
|
-
)),
|
|
20
|
-
)}
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
BackgroundImage.propTypes = {
|
|
25
|
-
showOverlay: PropTypes.bool,
|
|
26
|
-
className: PropTypes.string,
|
|
27
|
-
images: PropTypes.arrayOf(
|
|
28
|
-
PropTypes.shape({
|
|
29
|
-
url: PropTypes.string.isRequired,
|
|
30
|
-
types: PropTypes.arrayOf(PropTypes.oneOf(Object.keys(breakpoints))).isRequired,
|
|
31
|
-
}),
|
|
32
|
-
).isRequired,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
BackgroundImage.defaultProps = {
|
|
36
|
-
showOverlay: false,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default BackgroundImage;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import BEMHelper from 'react-bem-helper';
|
|
4
|
-
import File from './File';
|
|
5
|
-
|
|
6
|
-
const classes = BEMHelper('c-file-list');
|
|
7
|
-
|
|
8
|
-
const FileList = ({ files, heading, id }) => (
|
|
9
|
-
<section {...classes()}>
|
|
10
|
-
<h1 {...classes('heading')}>{heading}</h1>
|
|
11
|
-
<ul {...classes('files')}>
|
|
12
|
-
{files.map((file) => (
|
|
13
|
-
<File key={`file-${id}-${file.title}`} file={file} id={id} />
|
|
14
|
-
))}
|
|
15
|
-
</ul>
|
|
16
|
-
</section>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
FileList.propTypes = {
|
|
20
|
-
id: PropTypes.string.isRequired,
|
|
21
|
-
heading: PropTypes.string.isRequired,
|
|
22
|
-
files: PropTypes.arrayOf(
|
|
23
|
-
PropTypes.shape({
|
|
24
|
-
title: PropTypes.string.isRequired,
|
|
25
|
-
formats: PropTypes.arrayOf(
|
|
26
|
-
PropTypes.shape({
|
|
27
|
-
url: PropTypes.string.isRequired,
|
|
28
|
-
fileType: PropTypes.string.isRequired,
|
|
29
|
-
tooltip: PropTypes.string.isRequired,
|
|
30
|
-
}),
|
|
31
|
-
).isRequired,
|
|
32
|
-
}),
|
|
33
|
-
).isRequired,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default FileList;
|
package/src/Hero/Hero.jsx
DELETED
|
@@ -1,38 +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 React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
import BEMHelper from 'react-bem-helper';
|
|
12
|
-
import { ContentTypeShape } from '../shapes';
|
|
13
|
-
|
|
14
|
-
import * as contentTypes from '../model/ContentType';
|
|
15
|
-
|
|
16
|
-
const classes = new BEMHelper({
|
|
17
|
-
name: 'hero',
|
|
18
|
-
prefix: 'c-',
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export const Hero = ({ children, contentType }) => <div {...classes('', contentType)}>{children || null}</div>;
|
|
22
|
-
|
|
23
|
-
Hero.propTypes = {
|
|
24
|
-
contentType: ContentTypeShape,
|
|
25
|
-
children: PropTypes.node,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const SubjectMaterialHero = (props) => <Hero contentType={contentTypes.SUBJECT_MATERIAL} {...props} />;
|
|
29
|
-
export const TasksAndActivitiesHero = (props) => <Hero contentType={contentTypes.TASKS_AND_ACTIVITIES} {...props} />;
|
|
30
|
-
export const AssessmentResourcesHero = (props) => <Hero contentType={contentTypes.ASSESSMENT_RESOURCES} {...props} />;
|
|
31
|
-
export const SubjectHero = (props) => <Hero contentType={contentTypes.SUBJECT} {...props} />;
|
|
32
|
-
export const ExternalLearningResourcesHero = (props) => (
|
|
33
|
-
<Hero contentType={contentTypes.EXTERNAL_LEARNING_RESOURCES} {...props} />
|
|
34
|
-
);
|
|
35
|
-
export const SourceMaterialHero = (props) => <Hero contentType={contentTypes.SOURCE_MATERIAL} {...props} />;
|
|
36
|
-
export const NdlaFilmHero = ({ hasImage, ...rest }) => (
|
|
37
|
-
<Hero {...rest} contentType={hasImage ? 'ndla-film has-image' : 'ndla-film'} />
|
|
38
|
-
);
|
|
@@ -1,39 +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 React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
|
|
12
|
-
// Lazyload image with lazysizes (https://github.com/aFarkas/lazysizes)
|
|
13
|
-
const LazyLoadImage = ({ alt, src, srcSet, lazyLoadSrc, sizes, ...rest }) => [
|
|
14
|
-
<noscript key="noscript">
|
|
15
|
-
<img alt={alt} src={`${src}`} srcSet={srcSet} sizes={sizes} {...rest} />
|
|
16
|
-
</noscript>,
|
|
17
|
-
<img
|
|
18
|
-
alt={alt}
|
|
19
|
-
key="img"
|
|
20
|
-
style={{ width: '100%' }}
|
|
21
|
-
className="lazyload"
|
|
22
|
-
src={lazyLoadSrc}
|
|
23
|
-
data-src={src}
|
|
24
|
-
data-src-set={srcSet}
|
|
25
|
-
data-sizes={sizes}
|
|
26
|
-
{...rest}
|
|
27
|
-
/>,
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
LazyLoadImage.propTypes = {
|
|
31
|
-
alt: PropTypes.string.isRequired,
|
|
32
|
-
src: PropTypes.string.isRequired,
|
|
33
|
-
sizes: PropTypes.string,
|
|
34
|
-
contentType: PropTypes.string,
|
|
35
|
-
srcSet: PropTypes.string,
|
|
36
|
-
lazyLoadSrc: PropTypes.string.isRequired,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export default LazyLoadImage;
|
package/src/Image/shapes.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2019-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
|
|
11
|
-
export const CropShape = PropTypes.shape({
|
|
12
|
-
startX: PropTypes.number.isRequired,
|
|
13
|
-
startY: PropTypes.number.isRequired,
|
|
14
|
-
endX: PropTypes.number.isRequired,
|
|
15
|
-
endY: PropTypes.number.isRequired,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const FocalPointShape = PropTypes.shape({
|
|
19
|
-
x: PropTypes.number.isRequired,
|
|
20
|
-
y: PropTypes.number.isRequired,
|
|
21
|
-
});
|
package/src/InfoBox/InfoBox.jsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import BEMHelper from 'react-bem-helper';
|
|
4
|
-
|
|
5
|
-
const classes = BEMHelper('c-info-box');
|
|
6
|
-
|
|
7
|
-
const InfoBox = ({ children }) => <div {...classes()}>{children}</div>;
|
|
8
|
-
|
|
9
|
-
InfoBox.propTypes = {
|
|
10
|
-
children: PropTypes.node.isRequired,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default InfoBox;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ArticleTabs } from '@ndla/tabs';
|
|
3
|
-
|
|
4
|
-
const TranslationBox = (props) => (
|
|
5
|
-
<div className="c-translation-box">
|
|
6
|
-
<div className="c-bodybox c-bodybox--translation">
|
|
7
|
-
<ArticleTabs {...props} />
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export default TranslationBox;
|