@ndla/ui 3.3.9 → 3.3.14
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 +23 -1
- package/es/Article/ArticleNotions.js +80 -32
- package/es/Breadcrumblist/Breadcrumblist.js +14 -10
- package/es/CloseButton/CloseButton.js +62 -0
- package/es/CloseButton/index.js +9 -0
- package/es/Figure/Figure.js +3 -1
- package/es/Frontpage/FrontpageAllSubjects.js +7 -7
- package/es/Frontpage/FrontpageProgramMenu.js +10 -10
- package/es/Frontpage/FrontpageSearch.js +2 -4
- package/es/MediaList/MediaList.js +22 -73
- package/es/MessageBox/MessageBox.js +146 -78
- package/es/MessageBox/MessageBoxTag.js +37 -0
- package/es/MessageBox/index.js +3 -1
- package/es/NDLAFilm/AboutNdlaFilm.js +6 -17
- package/es/NDLAFilm/AllMoviesAlphabetically.js +11 -11
- package/es/NDLAFilm/CategorySelect.js +17 -18
- package/es/NDLAFilm/FilmContentCard.js +8 -22
- package/es/NDLAFilm/FilmContentCardTags.js +4 -8
- package/es/NDLAFilm/FilmMovieList.js +6 -21
- package/es/NDLAFilm/FilmMovieSearch.js +18 -26
- package/es/NDLAFilm/FilmSlideshow.js +2 -1
- package/es/NDLAFilm/MovieGrid.js +10 -19
- package/es/NDLAFilm/VisualElement.js +22 -29
- package/es/Programme/Programme.js +15 -8
- package/es/Search/SearchResultSleeve.js +12 -15
- package/es/SearchTypeResult/SearchFieldHeader.js +5 -5
- package/es/SearchTypeResult/SearchHeader.js +9 -9
- package/es/SearchTypeResult/SearchItem.js +19 -19
- package/es/SearchTypeResult/SearchNotionItem.js +12 -12
- package/es/SearchTypeResult/SearchNotionsResult.js +9 -14
- package/es/TopicIntroductionList/TopicIntroduction.js +14 -33
- package/es/TopicIntroductionList/TopicIntroductionList.js +6 -23
- package/es/TopicIntroductionList/TopicIntroductionShortcuts.js +71 -110
- package/es/TopicIntroductionList/TopicShortcutItem.js +0 -9
- package/es/all.css +1 -4
- package/es/index-javascript.js +1 -5
- package/es/index.js +6 -1
- package/es/locale/messages-en.js +10 -0
- package/es/locale/messages-nb.js +10 -0
- package/es/locale/messages-nn.js +10 -0
- package/es/shapes.js +0 -6
- package/lib/Article/Article.d.ts +3 -1
- package/lib/Article/Article.js +25 -3
- package/lib/Article/ArticleNotions.js +79 -30
- package/lib/Breadcrumblist/Breadcrumblist.d.ts +2 -1
- package/lib/Breadcrumblist/Breadcrumblist.js +15 -10
- package/lib/CloseButton/CloseButton.d.ts +6 -0
- package/lib/CloseButton/CloseButton.js +69 -0
- package/lib/CloseButton/index.d.ts +9 -0
- package/lib/CloseButton/index.js +15 -0
- package/lib/Figure/Figure.js +3 -1
- package/lib/Frontpage/FrontpageAllSubjects.d.ts +1 -1
- package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
- package/lib/Frontpage/FrontpageProgramMenu.js +10 -10
- package/lib/Frontpage/FrontpageSearch.d.ts +3 -5
- package/lib/Frontpage/FrontpageSearch.js +2 -4
- package/lib/MediaList/MediaList.d.ts +48 -0
- package/lib/MediaList/MediaList.js +24 -78
- package/lib/MediaList/index.d.ts +8 -0
- package/lib/MessageBox/MessageBox.d.ts +22 -6
- package/lib/MessageBox/MessageBox.js +146 -77
- package/lib/MessageBox/MessageBoxTag.d.ts +12 -0
- package/lib/MessageBox/MessageBoxTag.js +44 -0
- package/lib/MessageBox/index.d.ts +3 -1
- package/lib/MessageBox/index.js +22 -2
- package/lib/NDLAFilm/AboutNdlaFilm.d.ts +15 -0
- package/lib/NDLAFilm/AboutNdlaFilm.js +6 -18
- package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +2 -2
- package/lib/NDLAFilm/AllMoviesAlphabetically.js +11 -11
- package/lib/NDLAFilm/CategorySelect.d.ts +11 -0
- package/lib/NDLAFilm/CategorySelect.js +20 -19
- package/lib/NDLAFilm/FilmContentCard.d.ts +11 -0
- package/lib/NDLAFilm/FilmContentCard.js +8 -23
- package/lib/NDLAFilm/FilmContentCardTags.d.ts +7 -0
- package/lib/NDLAFilm/FilmContentCardTags.js +4 -9
- package/lib/NDLAFilm/FilmMovieList.d.ts +19 -0
- package/lib/NDLAFilm/FilmMovieList.js +5 -21
- package/lib/NDLAFilm/FilmMovieSearch.d.ts +21 -0
- package/lib/NDLAFilm/FilmMovieSearch.js +25 -30
- package/lib/NDLAFilm/FilmSlideshow.d.ts +5 -5
- package/lib/NDLAFilm/MovieGrid.d.ts +13 -0
- package/lib/NDLAFilm/MovieGrid.js +9 -21
- package/lib/NDLAFilm/SlideshowIndicator.d.ts +2 -2
- package/lib/NDLAFilm/VisualElement.d.ts +16 -0
- package/lib/NDLAFilm/VisualElement.js +22 -30
- package/lib/NDLAFilm/index.d.ts +14 -0
- package/lib/NDLAFilm/types.d.ts +6 -4
- package/lib/Programme/Programme.d.ts +2 -1
- package/lib/Programme/Programme.js +18 -9
- package/lib/Search/SearchResultSleeve.d.ts +4 -6
- package/lib/Search/SearchResultSleeve.js +10 -11
- package/lib/SearchTypeResult/SearchFieldHeader.d.ts +3 -3
- package/lib/SearchTypeResult/SearchFieldHeader.js +5 -5
- package/lib/SearchTypeResult/SearchHeader.d.ts +3 -3
- package/lib/SearchTypeResult/SearchHeader.js +9 -9
- package/lib/SearchTypeResult/SearchItem.d.ts +2 -3
- package/lib/SearchTypeResult/SearchItem.js +19 -19
- package/lib/SearchTypeResult/SearchNotionItem.d.ts +1 -1
- package/lib/SearchTypeResult/SearchNotionItem.js +12 -12
- package/lib/SearchTypeResult/SearchNotionsResult.js +8 -13
- package/lib/SearchTypeResult/index.d.ts +1 -0
- package/lib/TopicIntroductionList/TopicIntroduction.d.ts +21 -0
- package/lib/TopicIntroductionList/TopicIntroduction.js +16 -36
- package/lib/TopicIntroductionList/TopicIntroductionList.d.ts +35 -0
- package/lib/TopicIntroductionList/TopicIntroductionList.js +6 -25
- package/lib/TopicIntroductionList/TopicIntroductionShortcuts.d.ts +8 -0
- package/lib/TopicIntroductionList/TopicIntroductionShortcuts.js +72 -110
- package/lib/TopicIntroductionList/TopicShortcutItem.d.ts +6 -0
- package/lib/TopicIntroductionList/TopicShortcutItem.js +0 -11
- package/lib/TopicIntroductionList/index.d.ts +9 -0
- package/lib/all.css +1 -4
- package/lib/index-javascript.js +3 -137
- package/lib/index.d.ts +6 -1
- package/lib/index.js +178 -0
- package/lib/locale/messages-en.d.ts +10 -0
- package/lib/locale/messages-en.js +10 -0
- package/lib/locale/messages-nb.d.ts +10 -0
- package/lib/locale/messages-nb.js +10 -0
- package/lib/locale/messages-nn.d.ts +10 -0
- package/lib/locale/messages-nn.js +10 -0
- package/lib/shapes.js +1 -10
- package/lib/types.d.ts +2 -2
- package/package.json +12 -12
- package/src/Article/Article.tsx +17 -0
- package/src/Article/ArticleNotions.tsx +10 -7
- package/src/Breadcrumblist/Breadcrumblist.tsx +5 -3
- package/src/CloseButton/CloseButton.tsx +40 -0
- package/src/CloseButton/index.ts +11 -0
- package/src/Figure/Figure.tsx +2 -1
- package/src/Figure/component.figure.scss +37 -3
- package/src/Frontpage/FrontpageAllSubjects.tsx +2 -2
- package/src/Frontpage/FrontpageProgramMenu.tsx +1 -0
- package/src/Frontpage/FrontpageSearch.tsx +3 -7
- package/src/MediaList/MediaList.tsx +158 -0
- package/src/MediaList/{index.js → index.ts} +0 -0
- package/src/MessageBox/MessageBox.tsx +117 -96
- package/src/MessageBox/MessageBoxTag.tsx +35 -0
- package/src/MessageBox/index.ts +3 -1
- package/src/NDLAFilm/{AboutNdlaFilm.jsx → AboutNdlaFilm.tsx} +19 -18
- package/src/NDLAFilm/AllMoviesAlphabetically.tsx +3 -3
- package/src/NDLAFilm/{CategorySelect.jsx → CategorySelect.tsx} +23 -20
- package/src/NDLAFilm/{FilmContentCard.jsx → FilmContentCard.tsx} +21 -21
- package/src/NDLAFilm/{FilmContentCardTags.jsx → FilmContentCardTags.tsx} +7 -7
- package/src/NDLAFilm/{FilmMovieList.jsx → FilmMovieList.tsx} +17 -27
- package/src/NDLAFilm/FilmMovieSearch.tsx +71 -0
- package/src/NDLAFilm/FilmSlideshow.tsx +7 -6
- package/src/NDLAFilm/MovieGrid.tsx +76 -0
- package/src/NDLAFilm/SlideshowIndicator.tsx +2 -2
- package/src/NDLAFilm/VisualElement.tsx +40 -0
- package/src/NDLAFilm/{index.js → index.ts} +0 -0
- package/src/NDLAFilm/types.ts +7 -4
- package/src/Programme/Programme.tsx +7 -3
- package/src/Search/SearchResultSleeve.tsx +7 -19
- package/src/SearchTypeResult/SearchFieldHeader.tsx +3 -3
- package/src/SearchTypeResult/SearchHeader.tsx +3 -3
- package/src/SearchTypeResult/SearchItem.tsx +4 -5
- package/src/SearchTypeResult/SearchNotionItem.tsx +1 -2
- package/src/SearchTypeResult/SearchNotionsResult.tsx +3 -8
- package/src/SearchTypeResult/index.ts +2 -0
- package/src/TopicIntroductionList/{TopicIntroduction.jsx → TopicIntroduction.tsx} +22 -35
- package/src/TopicIntroductionList/{TopicIntroductionList.jsx → TopicIntroductionList.tsx} +32 -26
- package/src/TopicIntroductionList/TopicIntroductionShortcuts.tsx +71 -0
- package/src/TopicIntroductionList/{TopicShortcutItem.jsx → TopicShortcutItem.tsx} +5 -13
- package/src/TopicIntroductionList/{index.js → index.ts} +0 -0
- package/src/index-javascript.js +0 -30
- package/src/index.ts +33 -1
- package/src/locale/messages-en.ts +14 -0
- package/src/locale/messages-nb.ts +14 -0
- package/src/locale/messages-nn.ts +14 -0
- package/src/shapes.js +0 -7
- package/src/types.ts +2 -2
- package/es/NDLAFilm/interfaces.js +0 -0
- package/es/NDLAFilm/shapes.js +0 -15
- package/lib/NDLAFilm/interfaces.d.ts +0 -10
- package/lib/NDLAFilm/interfaces.js +0 -1
- package/lib/NDLAFilm/shapes.d.ts +0 -15
- package/lib/NDLAFilm/shapes.js +0 -30
- package/src/MediaList/MediaList.jsx +0 -182
- package/src/NDLAFilm/FilmMovieSearch.jsx +0 -66
- package/src/NDLAFilm/MovieGrid.jsx +0 -75
- package/src/NDLAFilm/VisualElement.jsx +0 -48
- package/src/NDLAFilm/interfaces.ts +0 -10
- package/src/NDLAFilm/shapes.ts +0 -17
- package/src/TopicIntroductionList/TopicIntroductionShortcuts.jsx +0 -92
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
12
11
|
import { useTranslation } from 'react-i18next';
|
|
13
12
|
import NoContentBox from '../NoContentBox';
|
|
14
|
-
import { TopicShape } from '../shapes';
|
|
15
13
|
import { TopicIntroduction } from './TopicIntroduction';
|
|
16
14
|
|
|
17
15
|
const topicClasses = new BEMHelper({
|
|
@@ -20,14 +18,42 @@ const topicClasses = new BEMHelper({
|
|
|
20
18
|
outputIsString: true,
|
|
21
19
|
});
|
|
22
20
|
|
|
21
|
+
export interface Shortcut {
|
|
22
|
+
id: string | number;
|
|
23
|
+
tooltip: string;
|
|
24
|
+
contentType: string;
|
|
25
|
+
url: string;
|
|
26
|
+
count: number;
|
|
27
|
+
}
|
|
28
|
+
export interface Topic {
|
|
29
|
+
name: string;
|
|
30
|
+
id: string;
|
|
31
|
+
additional?: boolean;
|
|
32
|
+
shortcuts?: Shortcut[];
|
|
33
|
+
introduction: string;
|
|
34
|
+
metaImage?: {
|
|
35
|
+
url?: string;
|
|
36
|
+
alt?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface Props {
|
|
41
|
+
toTopic: (id: string) => string;
|
|
42
|
+
topics: Topic[];
|
|
43
|
+
twoColumns?: boolean;
|
|
44
|
+
shortcutAlwaysExpanded?: boolean;
|
|
45
|
+
showAdditionalCores?: boolean;
|
|
46
|
+
toggleAdditionalCores?: () => void;
|
|
47
|
+
}
|
|
48
|
+
|
|
23
49
|
const TopicIntroductionList = ({
|
|
24
50
|
topics,
|
|
25
|
-
twoColumns,
|
|
26
|
-
shortcutAlwaysExpanded,
|
|
27
|
-
showAdditionalCores,
|
|
51
|
+
twoColumns = false,
|
|
52
|
+
shortcutAlwaysExpanded = false,
|
|
53
|
+
showAdditionalCores = false,
|
|
28
54
|
toggleAdditionalCores,
|
|
29
55
|
...rest
|
|
30
|
-
}) => {
|
|
56
|
+
}: Props) => {
|
|
31
57
|
const { t } = useTranslation();
|
|
32
58
|
const renderAdditionalTopicsTrigger =
|
|
33
59
|
!showAdditionalCores &&
|
|
@@ -47,11 +73,6 @@ const TopicIntroductionList = ({
|
|
|
47
73
|
additional={additional}
|
|
48
74
|
showAdditionalCores={showAdditionalCores}
|
|
49
75
|
shortcutAlwaysExpanded={shortcutAlwaysExpanded}
|
|
50
|
-
messages={{
|
|
51
|
-
shortcutButtonText: t('resource.label'),
|
|
52
|
-
tooltipAdditionalTopic: t('resource.tooltipAdditionalTopic'),
|
|
53
|
-
tooltipCoreTopic: t('resource.tooltipCoreTopic'),
|
|
54
|
-
}}
|
|
55
76
|
id={`${topic.id}_${index}`}
|
|
56
77
|
/>
|
|
57
78
|
);
|
|
@@ -69,19 +90,4 @@ const TopicIntroductionList = ({
|
|
|
69
90
|
);
|
|
70
91
|
};
|
|
71
92
|
|
|
72
|
-
TopicIntroductionList.propTypes = {
|
|
73
|
-
toTopic: PropTypes.func.isRequired,
|
|
74
|
-
topics: PropTypes.arrayOf(TopicShape).isRequired,
|
|
75
|
-
twoColumns: PropTypes.bool,
|
|
76
|
-
shortcutAlwaysExpanded: PropTypes.bool,
|
|
77
|
-
showAdditionalCores: PropTypes.bool,
|
|
78
|
-
toggleAdditionalCores: PropTypes.func.isRequired,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
TopicIntroductionList.defaultProps = {
|
|
82
|
-
twoColumns: false,
|
|
83
|
-
shortcutAlwaysExpanded: false,
|
|
84
|
-
showAdditionalCores: false,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
93
|
export default TopicIntroductionList;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import BEMHelper from 'react-bem-helper';
|
|
4
|
+
import { Forward } from '@ndla/icons/common';
|
|
5
|
+
|
|
6
|
+
import ShortcutItem from './TopicShortcutItem';
|
|
7
|
+
|
|
8
|
+
import { Shortcut } from './TopicIntroductionList';
|
|
9
|
+
|
|
10
|
+
const classes = new BEMHelper({
|
|
11
|
+
name: 'topic-shortcuts',
|
|
12
|
+
prefix: 'c-',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
id: string;
|
|
17
|
+
alwaysExpanded?: boolean;
|
|
18
|
+
shortcuts: Shortcut[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const TopicIntroductionShortcuts = ({ id, alwaysExpanded = false, shortcuts }: Props) => {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const [open, setOpen] = useState(alwaysExpanded);
|
|
24
|
+
const [returned, setReturned] = useState(false);
|
|
25
|
+
const [showButtonText, setShowButtonText] = useState(true);
|
|
26
|
+
|
|
27
|
+
const handleOnToggle = (newOpen: boolean) => {
|
|
28
|
+
setOpen(newOpen);
|
|
29
|
+
setShowButtonText(!newOpen);
|
|
30
|
+
setReturned(!newOpen);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
let onMouseEnter = undefined;
|
|
34
|
+
let onMouseLeave = undefined;
|
|
35
|
+
|
|
36
|
+
let buttonView = null;
|
|
37
|
+
|
|
38
|
+
if (!alwaysExpanded) {
|
|
39
|
+
onMouseEnter = () => handleOnToggle(true);
|
|
40
|
+
onMouseLeave = () => handleOnToggle(false);
|
|
41
|
+
|
|
42
|
+
buttonView = (
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
aria-expanded={open}
|
|
46
|
+
aria-label={t('resource.label')}
|
|
47
|
+
aria-controls={id}
|
|
48
|
+
{...classes('button', returned ? 're-enter' : '')}
|
|
49
|
+
onClick={() => handleOnToggle(!open)}>
|
|
50
|
+
<Forward />
|
|
51
|
+
{showButtonText && <span {...classes('label')}>{t('resource.label')}</span>}
|
|
52
|
+
</button>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return (
|
|
56
|
+
<div onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} {...classes()}>
|
|
57
|
+
{buttonView}
|
|
58
|
+
{open && (
|
|
59
|
+
<ul className={classes('list', open ? 'visible' : '').className}>
|
|
60
|
+
{shortcuts.map((shortcut) => (
|
|
61
|
+
<li {...classes('item')} key={shortcut.id}>
|
|
62
|
+
<ShortcutItem shortcut={shortcut} />
|
|
63
|
+
</li>
|
|
64
|
+
))}
|
|
65
|
+
</ul>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default TopicIntroductionShortcuts;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import BEMHelper from 'react-bem-helper';
|
|
4
3
|
import Tooltip from '@ndla/tooltip';
|
|
5
4
|
import SafeLink from '@ndla/safelink';
|
|
6
5
|
import { useTranslation } from 'react-i18next';
|
|
7
6
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
8
|
-
|
|
9
|
-
import { ShortcutShape } from '../shapes';
|
|
7
|
+
import { Shortcut } from './TopicIntroductionList';
|
|
10
8
|
|
|
11
9
|
const classes = new BEMHelper({
|
|
12
10
|
name: 'topic-shortcuts',
|
|
13
11
|
prefix: 'c-',
|
|
14
12
|
});
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
interface Props {
|
|
15
|
+
shortcut: Shortcut;
|
|
16
|
+
}
|
|
17
|
+
const ShortcutItem = ({ shortcut: { id, tooltip, contentType, url, count } }: Props) => {
|
|
17
18
|
const { t } = useTranslation();
|
|
18
19
|
return (
|
|
19
20
|
<Tooltip
|
|
@@ -29,13 +30,4 @@ const ShortcutItem = ({ shortcut: { id, tooltip, contentType, url, count } }) =>
|
|
|
29
30
|
);
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
ShortcutItem.propTypes = {
|
|
33
|
-
shortcut: ShortcutShape.isRequired,
|
|
34
|
-
disableToolTip: PropTypes.bool,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
ShortcutItem.defaultProps = {
|
|
38
|
-
disableToolTip: false,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
33
|
export default ShortcutItem;
|
|
File without changes
|
package/src/index-javascript.js
CHANGED
|
@@ -23,16 +23,6 @@ export {
|
|
|
23
23
|
ToggleSearchButton,
|
|
24
24
|
} from './Search';
|
|
25
25
|
|
|
26
|
-
export {
|
|
27
|
-
default as ContentTypeBadge,
|
|
28
|
-
SubjectMaterialBadge,
|
|
29
|
-
TasksAndActivitiesBadge,
|
|
30
|
-
AssessmentResourcesBadge,
|
|
31
|
-
LearningPathBadge,
|
|
32
|
-
SubjectBadge,
|
|
33
|
-
ExternalLearningResourcesBadge,
|
|
34
|
-
SourceMaterialBadge,
|
|
35
|
-
} from './ContentTypeBadge';
|
|
36
26
|
export { default as TopicIntroductionList } from './TopicIntroductionList';
|
|
37
27
|
export { default as TopicMenu, TopicMenuButton } from './TopicMenu';
|
|
38
28
|
export {
|
|
@@ -43,24 +33,4 @@ export {
|
|
|
43
33
|
CompetenceGoalsDialog,
|
|
44
34
|
} from './CompetenceGoals';
|
|
45
35
|
|
|
46
|
-
export {
|
|
47
|
-
MediaList,
|
|
48
|
-
MediaListItem,
|
|
49
|
-
MediaListItemBody,
|
|
50
|
-
MediaListItemActions,
|
|
51
|
-
MediaListItemImage,
|
|
52
|
-
MediaListItemMeta,
|
|
53
|
-
} from './MediaList';
|
|
54
|
-
|
|
55
36
|
export { EmbeddedTwitter, EmbeddedFacebook, EmbeddedFacebookPage } from './Embedded';
|
|
56
|
-
|
|
57
|
-
export { DisplayOnPageYOffset } from './Animation';
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
FilmSlideshow,
|
|
61
|
-
MovieGrid,
|
|
62
|
-
AboutNdlaFilm,
|
|
63
|
-
FilmMovieSearch,
|
|
64
|
-
FilmMovieList,
|
|
65
|
-
AllMoviesAlphabetically,
|
|
66
|
-
} from './NDLAFilm';
|
package/src/index.ts
CHANGED
|
@@ -115,8 +115,9 @@ export { default as CreatedBy } from './CreatedBy';
|
|
|
115
115
|
|
|
116
116
|
export { default as Breadcrumblist } from './Breadcrumblist';
|
|
117
117
|
|
|
118
|
-
export { MessageBox } from './MessageBox';
|
|
118
|
+
export { MessageBox, MessageBoxTag, MessageBoxType } from './MessageBox';
|
|
119
119
|
|
|
120
|
+
export { CloseButton } from './CloseButton';
|
|
120
121
|
export { default as AudioPlayer, initAudioPlayers } from './AudioPlayer';
|
|
121
122
|
|
|
122
123
|
export { NavigationHeading, NavigationBox, NavigationTopicAbout } from './Navigation';
|
|
@@ -157,6 +158,37 @@ export { default as ResourceGroup } from './ResourceGroup';
|
|
|
157
158
|
|
|
158
159
|
export { default as LayoutItem, OneColumn, PageContainer, Content } from './Layout';
|
|
159
160
|
|
|
161
|
+
export {
|
|
162
|
+
FilmSlideshow,
|
|
163
|
+
MovieGrid,
|
|
164
|
+
AboutNdlaFilm,
|
|
165
|
+
FilmMovieSearch,
|
|
166
|
+
FilmMovieList,
|
|
167
|
+
AllMoviesAlphabetically,
|
|
168
|
+
} from './NDLAFilm';
|
|
169
|
+
|
|
170
|
+
export { DisplayOnPageYOffset } from './Animation';
|
|
171
|
+
|
|
172
|
+
export {
|
|
173
|
+
MediaList,
|
|
174
|
+
MediaListItem,
|
|
175
|
+
MediaListItemBody,
|
|
176
|
+
MediaListItemActions,
|
|
177
|
+
MediaListItemImage,
|
|
178
|
+
MediaListItemMeta,
|
|
179
|
+
} from './MediaList';
|
|
180
|
+
|
|
181
|
+
export {
|
|
182
|
+
default as ContentTypeBadge,
|
|
183
|
+
SubjectMaterialBadge,
|
|
184
|
+
TasksAndActivitiesBadge,
|
|
185
|
+
AssessmentResourcesBadge,
|
|
186
|
+
LearningPathBadge,
|
|
187
|
+
SubjectBadge,
|
|
188
|
+
ExternalLearningResourcesBadge,
|
|
189
|
+
SourceMaterialBadge,
|
|
190
|
+
} from './ContentTypeBadge';
|
|
191
|
+
|
|
160
192
|
export {
|
|
161
193
|
SubjectAbout,
|
|
162
194
|
SubjectArchive,
|
|
@@ -313,6 +313,20 @@ const messages = {
|
|
|
313
313
|
h5p: 'Interactive',
|
|
314
314
|
},
|
|
315
315
|
},
|
|
316
|
+
messageBoxInfo: {
|
|
317
|
+
outdatedCoursePlan:
|
|
318
|
+
'This course is not updated to the current curriculum. Follow this link to find the updated version of the course: ',
|
|
319
|
+
updateBrowser:
|
|
320
|
+
'Your browser is outdated. Update it, or find a safe and updated browser on https://browsehappy.com.',
|
|
321
|
+
noContent: 'We are sorry, but we do not yet offer any program courses.',
|
|
322
|
+
feide: 'This resource is accessible only to teachers who are logged in with Feide.',
|
|
323
|
+
resources:
|
|
324
|
+
'This is not a complete course produced by NDLA, but a collection of resources we hope you will find useful.',
|
|
325
|
+
beta: 'This course is in beta.',
|
|
326
|
+
outdatedSubject: 'This topic is part of a course that is not updated to the current curriculum.',
|
|
327
|
+
newVersion:
|
|
328
|
+
'This learning resource is not updated to the current curriculum. You can find an updated version here: ',
|
|
329
|
+
},
|
|
316
330
|
article: {
|
|
317
331
|
edition: 'Edition',
|
|
318
332
|
publisher: 'Publisher',
|
|
@@ -312,6 +312,20 @@ const messages = {
|
|
|
312
312
|
h5p: 'Interaktiv',
|
|
313
313
|
},
|
|
314
314
|
},
|
|
315
|
+
messageBoxInfo: {
|
|
316
|
+
outdatedCoursePlan:
|
|
317
|
+
'Dette faget følger en utgått læreplan. Gå til faget som er oppdatert etter gjeldende læreplan:',
|
|
318
|
+
updateBrowser:
|
|
319
|
+
'Nettleseren din er utdatert. Oppdater den, eller finn en trygg og oppdatert nettleser på https://browsehappy.com.',
|
|
320
|
+
noContent: 'Vi har dessverre ikke noen programfag ennå.',
|
|
321
|
+
feide: 'Denne ressursen er bare tilgjengelig for lærere som er pålogget med Feide.',
|
|
322
|
+
resources:
|
|
323
|
+
'Dette er ikke et komplett læremiddel produsert av NDLA, men ei ressurssamling som vi håper kan være nyttig for deg.',
|
|
324
|
+
beta: 'Dette faget er i betaversjon.',
|
|
325
|
+
outdatedSubject: 'Dette emnet hører til et fag som ikke er oppdatert etter gjeldende læreplan.',
|
|
326
|
+
newVersion:
|
|
327
|
+
'Denne læringsressursen er ikke oppdatert etter gjeldende læreplan. Du finner en oppdatert versjon her: ',
|
|
328
|
+
},
|
|
315
329
|
article: {
|
|
316
330
|
lastUpdated: 'Sist oppdatert',
|
|
317
331
|
edition: 'Utgave',
|
|
@@ -313,6 +313,20 @@ const messages = {
|
|
|
313
313
|
h5p: 'Interaktiv',
|
|
314
314
|
},
|
|
315
315
|
},
|
|
316
|
+
messageBoxInfo: {
|
|
317
|
+
outdatedCoursePlan:
|
|
318
|
+
'Dette faget følgjer ein utgått læreplan. Gå til faget som er oppdatert etter gjeldande læreplan: ',
|
|
319
|
+
updateBrowser:
|
|
320
|
+
'Nettlesaren din er utdatert. Oppdater han, eller finn ein trygg og oppdatert nettlesar på https://browsehappy.com. ',
|
|
321
|
+
noContent: 'Vi har dessverre ikkje nokon programfag enno.',
|
|
322
|
+
feide: 'Denne ressursen er berre tilgjengeleg for lærarar som er pålogga med Feide.',
|
|
323
|
+
resources:
|
|
324
|
+
'Dette er ikkje eit komplett læremiddel produsert av NDLA, men ei ressurssamling som vi håper kan vere nyttig for deg.',
|
|
325
|
+
beta: 'Dette faget er i betaversjon.',
|
|
326
|
+
outdatedSubject: 'Dette emnet høyrer til eit fag som ikkje er oppdatert etter gjeldande læreplan.',
|
|
327
|
+
newVersion:
|
|
328
|
+
'Denne læringsressursen er ikkje oppdatert etter gjeldande læreplan. Du finn ein oppdatert versjon her: ',
|
|
329
|
+
},
|
|
316
330
|
article: {
|
|
317
331
|
lastUpdated: 'Sist oppdatert',
|
|
318
332
|
edition: 'Utgåve',
|
package/src/shapes.js
CHANGED
|
@@ -69,13 +69,6 @@ export const ResourceShape = PropTypes.shape({
|
|
|
69
69
|
type: PropTypes.string,
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
export const ShortcutShape = PropTypes.shape({
|
|
73
|
-
tooltip: PropTypes.string.isRequired,
|
|
74
|
-
contentType: PropTypes.string.isRequired,
|
|
75
|
-
url: PropTypes.string.isRequired,
|
|
76
|
-
count: PropTypes.number.isRequired,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
72
|
export const ContentTypeShape = PropTypes.oneOf([
|
|
80
73
|
contentTypes.SUBJECT_MATERIAL,
|
|
81
74
|
contentTypes.TASKS_AND_ACTIVITIES,
|
package/src/types.ts
CHANGED
|
File without changes
|
package/es/NDLAFilm/shapes.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
export var movieShape = PropTypes.shape({
|
|
3
|
-
id: PropTypes.string.isRequired,
|
|
4
|
-
metaDescription: PropTypes.string.isRequired,
|
|
5
|
-
title: PropTypes.string.isRequired,
|
|
6
|
-
metaImage: PropTypes.shape({
|
|
7
|
-
url: PropTypes.string.isRequired,
|
|
8
|
-
alt: PropTypes.string.isRequired
|
|
9
|
-
}),
|
|
10
|
-
path: PropTypes.string.isRequired
|
|
11
|
-
});
|
|
12
|
-
export var topicShape = PropTypes.shape({
|
|
13
|
-
id: PropTypes.string,
|
|
14
|
-
name: PropTypes.string
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/lib/NDLAFilm/shapes.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
export declare const movieShape: PropTypes.Requireable<PropTypes.InferProps<{
|
|
3
|
-
id: PropTypes.Validator<string>;
|
|
4
|
-
metaDescription: PropTypes.Validator<string>;
|
|
5
|
-
title: PropTypes.Validator<string>;
|
|
6
|
-
metaImage: PropTypes.Requireable<PropTypes.InferProps<{
|
|
7
|
-
url: PropTypes.Validator<string>;
|
|
8
|
-
alt: PropTypes.Validator<string>;
|
|
9
|
-
}>>;
|
|
10
|
-
path: PropTypes.Validator<string>;
|
|
11
|
-
}>>;
|
|
12
|
-
export declare const topicShape: PropTypes.Requireable<PropTypes.InferProps<{
|
|
13
|
-
id: PropTypes.Requireable<string>;
|
|
14
|
-
name: PropTypes.Requireable<string>;
|
|
15
|
-
}>>;
|
package/lib/NDLAFilm/shapes.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.topicShape = exports.movieShape = void 0;
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
var movieShape = _propTypes["default"].shape({
|
|
13
|
-
id: _propTypes["default"].string.isRequired,
|
|
14
|
-
metaDescription: _propTypes["default"].string.isRequired,
|
|
15
|
-
title: _propTypes["default"].string.isRequired,
|
|
16
|
-
metaImage: _propTypes["default"].shape({
|
|
17
|
-
url: _propTypes["default"].string.isRequired,
|
|
18
|
-
alt: _propTypes["default"].string.isRequired
|
|
19
|
-
}),
|
|
20
|
-
path: _propTypes["default"].string.isRequired
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
exports.movieShape = movieShape;
|
|
24
|
-
|
|
25
|
-
var topicShape = _propTypes["default"].shape({
|
|
26
|
-
id: _propTypes["default"].string,
|
|
27
|
-
name: _propTypes["default"].string
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
exports.topicShape = topicShape;
|
|
@@ -1,182 +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 {
|
|
12
|
-
LicenseDescription,
|
|
13
|
-
getLicenseByAbbreviation,
|
|
14
|
-
resourceTypes,
|
|
15
|
-
getResourceTypeNamespace,
|
|
16
|
-
isCreativeCommonsLicense,
|
|
17
|
-
metaTypes,
|
|
18
|
-
} from '@ndla/licenses';
|
|
19
|
-
import BEMHelper from 'react-bem-helper';
|
|
20
|
-
import { uuid } from '@ndla/util';
|
|
21
|
-
|
|
22
|
-
const oClasses = new BEMHelper({
|
|
23
|
-
name: 'media',
|
|
24
|
-
prefix: 'o-',
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const cClasses = new BEMHelper({
|
|
28
|
-
name: 'medialist',
|
|
29
|
-
prefix: 'c-',
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export const MediaList = ({ children }) => <ul {...cClasses()}>{children}</ul>;
|
|
33
|
-
|
|
34
|
-
MediaList.propTypes = {
|
|
35
|
-
children: PropTypes.node.isRequired,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const MediaListItem = ({ children }) => (
|
|
39
|
-
<li {...oClasses(null, null, cClasses('item').className)}>{children}</li>
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
MediaListItem.propTypes = {
|
|
43
|
-
children: PropTypes.node.isRequired,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const MediaListItemImage = ({ children }) => (
|
|
47
|
-
<div {...oClasses('img', null, cClasses('img').className)}>
|
|
48
|
-
<div>{children}</div>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
MediaListItemImage.propTypes = {
|
|
53
|
-
children: PropTypes.node.isRequired,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const MediaListCCLink = ({ children, url }) => (
|
|
57
|
-
<a className="c-figure-license__link" target="_blank" rel="noopener noreferrer license" href={url}>
|
|
58
|
-
{children}
|
|
59
|
-
</a>
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
MediaListCCLink.propTypes = {
|
|
63
|
-
children: PropTypes.node.isRequired,
|
|
64
|
-
url: PropTypes.string.isRequired,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
MediaListCCLink.defaultProps = {
|
|
68
|
-
language: 'no',
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const MediaListItemBody = ({
|
|
72
|
-
children,
|
|
73
|
-
license: licenseAbbreviation,
|
|
74
|
-
messages,
|
|
75
|
-
title,
|
|
76
|
-
locale,
|
|
77
|
-
resourceUrl,
|
|
78
|
-
resourceType,
|
|
79
|
-
}) => {
|
|
80
|
-
const license = getLicenseByAbbreviation(licenseAbbreviation, locale);
|
|
81
|
-
const containerProps = isCreativeCommonsLicense(license.rights)
|
|
82
|
-
? {
|
|
83
|
-
...oClasses('body', null, cClasses('body').className),
|
|
84
|
-
'xmlns:cc': 'https://creativecommons.org/ns#',
|
|
85
|
-
'xmlns:dct': 'http://purl.org/dc/terms/',
|
|
86
|
-
about: resourceUrl,
|
|
87
|
-
}
|
|
88
|
-
: {
|
|
89
|
-
...oClasses('body', null, cClasses('body').className),
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const metaResourceType = getResourceTypeNamespace(resourceType);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<div {...containerProps}>
|
|
96
|
-
{metaResourceType && <span rel="dct:type" href={metaResourceType} style={{ display: 'none' }} />}
|
|
97
|
-
{title ? <h3 className="c-medialist__title">{title} </h3> : null}
|
|
98
|
-
<LicenseDescription
|
|
99
|
-
withDescription
|
|
100
|
-
locale={locale}
|
|
101
|
-
messages={messages}
|
|
102
|
-
licenseRights={license.rights}
|
|
103
|
-
highlightCC
|
|
104
|
-
/>
|
|
105
|
-
<MediaListCCLink url={license.url}>{license.linkText}</MediaListCCLink>
|
|
106
|
-
{children}
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
MediaListItemBody.propTypes = {
|
|
112
|
-
children: PropTypes.node.isRequired,
|
|
113
|
-
license: PropTypes.string.isRequired,
|
|
114
|
-
locale: PropTypes.string.isRequired,
|
|
115
|
-
resourceUrl: PropTypes.string,
|
|
116
|
-
resourceType: PropTypes.oneOf(Object.keys(resourceTypes).map((key) => resourceTypes[key])),
|
|
117
|
-
messages: PropTypes.shape({
|
|
118
|
-
modelPremission: PropTypes.string,
|
|
119
|
-
}),
|
|
120
|
-
title: PropTypes.string,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
MediaListItemBody.defaultProps = {
|
|
124
|
-
resourceUrl: '', // defaults to current page
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export const MediaListItemActions = ({ children }) => <div {...cClasses('actions')}>{children}</div>;
|
|
128
|
-
|
|
129
|
-
MediaListItemActions.propTypes = {
|
|
130
|
-
children: PropTypes.node.isRequired,
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const isLink = (text) => text.startsWith('http') || text.startsWith('https');
|
|
134
|
-
|
|
135
|
-
export const HandleLink = ({ text, children }) => {
|
|
136
|
-
if (isLink(text)) {
|
|
137
|
-
return (
|
|
138
|
-
<a href={text} target="_blank" rel="noopener noreferrer">
|
|
139
|
-
{children}
|
|
140
|
-
</a>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
return <span>{children}</span>;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
HandleLink.propTypes = {
|
|
147
|
-
text: PropTypes.string.isRequired,
|
|
148
|
-
children: PropTypes.node.isRequired,
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const attributionTypes = [metaTypes.author, metaTypes.copyrightHolder, metaTypes.contributor];
|
|
152
|
-
|
|
153
|
-
export const MediaListItemMeta = ({ items }) => {
|
|
154
|
-
const attributionItems = items.filter((item) => attributionTypes.some((type) => type === item.metaType));
|
|
155
|
-
const attributionMeta = attributionItems.map((item) => `${item.label}: ${item.description}`).join(', ');
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
<ul {...cClasses('actions')} property="cc:attributionName" content={attributionMeta}>
|
|
159
|
-
{items.map((item) => (
|
|
160
|
-
<li key={uuid()} className="c-medialist__meta-item">
|
|
161
|
-
{item.label}: <HandleLink text={item.description}>{item.description}</HandleLink>
|
|
162
|
-
</li>
|
|
163
|
-
))}
|
|
164
|
-
</ul>
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const mediaListItemShape = PropTypes.arrayOf(
|
|
169
|
-
PropTypes.shape({
|
|
170
|
-
label: PropTypes.string.isRequired,
|
|
171
|
-
description: PropTypes.string.isRequired,
|
|
172
|
-
metaType: PropTypes.oneOf(Object.keys(metaTypes).map((key) => metaTypes[key])).isRequired,
|
|
173
|
-
}),
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
MediaListItemMeta.propTypes = {
|
|
177
|
-
items: mediaListItemShape,
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
MediaListItemMeta.defaultProps = {
|
|
181
|
-
items: [],
|
|
182
|
-
};
|