@ndla/ui 3.3.11 → 3.3.15
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/Figure/Figure.js +3 -1
- package/es/Filter/FilterButtons.js +11 -13
- package/es/Frontpage/FrontpageAllSubjects.js +7 -7
- package/es/Frontpage/FrontpageSearch.js +2 -4
- package/es/LearningPaths/LearningPathMenu.js +4 -5
- package/es/LearningPaths/LearningPathMobileHeader.js +4 -5
- 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/MovieGrid.js +10 -19
- package/es/NDLAFilm/VisualElement.js +22 -29
- 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/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 +4 -0
- package/es/shapes.js +0 -6
- package/lib/Figure/Figure.js +3 -1
- package/lib/Filter/FilterButtons.js +9 -9
- package/lib/Frontpage/FrontpageAllSubjects.d.ts +1 -1
- package/lib/Frontpage/FrontpageAllSubjects.js +7 -7
- package/lib/Frontpage/FrontpageSearch.d.ts +3 -5
- package/lib/Frontpage/FrontpageSearch.js +2 -4
- package/lib/LearningPaths/LearningPathMenu.js +3 -3
- package/lib/LearningPaths/LearningPathMobileHeader.js +4 -5
- 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/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/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 +4 -0
- package/lib/index.js +155 -0
- package/lib/shapes.js +1 -10
- package/lib/types.d.ts +2 -2
- package/package.json +10 -10
- package/src/Figure/Figure.tsx +2 -1
- package/src/Figure/component.figure.scss +37 -3
- package/src/Filter/FilterButtons.tsx +0 -2
- package/src/Frontpage/FrontpageAllSubjects.tsx +2 -2
- package/src/Frontpage/FrontpageSearch.tsx +3 -7
- package/src/LearningPaths/LearningPathMenu.tsx +0 -1
- package/src/LearningPaths/LearningPathMobileHeader.tsx +1 -2
- 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 +6 -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/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 -1
- 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 +31 -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/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
|
@@ -203,12 +203,11 @@ type context = {
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
export type SearchItemType = {
|
|
206
|
-
id: string;
|
|
206
|
+
id: string | number;
|
|
207
207
|
title: string;
|
|
208
208
|
url: string;
|
|
209
209
|
ingress: string;
|
|
210
|
-
contexts
|
|
211
|
-
image: React.ReactNode | null;
|
|
210
|
+
contexts?: context[];
|
|
212
211
|
img?: { url: string; alt: string };
|
|
213
212
|
labels?: string[];
|
|
214
213
|
children?: React.ReactNode;
|
|
@@ -220,7 +219,7 @@ type Props = {
|
|
|
220
219
|
const SearchItem = ({ item, type }: Props) => {
|
|
221
220
|
const { t } = useTranslation();
|
|
222
221
|
const { title, url, ingress, contexts, img = null, labels = [] } = item;
|
|
223
|
-
const mainContext = contexts[0];
|
|
222
|
+
const mainContext = contexts?.[0];
|
|
224
223
|
|
|
225
224
|
const Breadcrumb = ({ breadcrumb, children }: { breadcrumb: string[]; children?: React.ReactNode }) => (
|
|
226
225
|
<BreadcrumbPath>
|
|
@@ -268,7 +267,7 @@ const SearchItem = ({ item, type }: Props) => {
|
|
|
268
267
|
{item.children}
|
|
269
268
|
<ItemText>{parse(ingress)}</ItemText>
|
|
270
269
|
{mainContext && <Breadcrumb breadcrumb={mainContext.breadcrumb} />}
|
|
271
|
-
{contexts.length > 1 && (
|
|
270
|
+
{contexts && contexts.length > 1 && (
|
|
272
271
|
<ContextsWrapper>
|
|
273
272
|
<Modal
|
|
274
273
|
activateButton={
|
|
@@ -12,4 +12,6 @@ import SearchFieldHeader from './SearchFieldHeader';
|
|
|
12
12
|
import SearchNotionsResult from './SearchNotionsResult';
|
|
13
13
|
import SearchSubjectResult from './SearchSubjectResult';
|
|
14
14
|
|
|
15
|
+
export type { ContentType } from './SearchTypeResult';
|
|
16
|
+
|
|
15
17
|
export { SearchTypeResult, SearchHeader, SearchFieldHeader, SearchNotionsResult, SearchSubjectResult };
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
12
|
import { Additional, Core } from '@ndla/icons/common';
|
|
13
13
|
import Tooltip from '@ndla/tooltip';
|
|
14
14
|
import SafeLink from '@ndla/safelink';
|
|
15
|
-
import { TopicShape, ShortcutShape } from '../shapes';
|
|
16
15
|
import TopicIntroductionShortcuts from './TopicIntroductionShortcuts';
|
|
16
|
+
import { Shortcut, Topic } from './TopicIntroductionList';
|
|
17
17
|
|
|
18
18
|
const topicClasses = new BEMHelper({
|
|
19
19
|
prefix: 'c-',
|
|
@@ -21,23 +21,35 @@ const topicClasses = new BEMHelper({
|
|
|
21
21
|
outputIsString: true,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
interface Props {
|
|
25
|
+
additional?: boolean;
|
|
26
|
+
showAdditionalCores?: boolean;
|
|
27
|
+
topic: Topic;
|
|
28
|
+
toTopic: (id: string) => string;
|
|
29
|
+
subjectPage?: boolean;
|
|
30
|
+
shortcuts?: Shortcut[];
|
|
31
|
+
twoColumns?: boolean;
|
|
32
|
+
shortcutAlwaysExpanded?: boolean;
|
|
33
|
+
id: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
export const TopicIntroduction = ({
|
|
25
37
|
toTopic,
|
|
26
38
|
topic,
|
|
27
39
|
subjectPage,
|
|
28
40
|
shortcuts,
|
|
29
|
-
messages,
|
|
30
41
|
shortcutAlwaysExpanded,
|
|
31
|
-
additional,
|
|
32
|
-
showAdditionalCores,
|
|
42
|
+
additional = false,
|
|
43
|
+
showAdditionalCores = false,
|
|
33
44
|
id,
|
|
34
|
-
}) => {
|
|
35
|
-
const
|
|
45
|
+
}: Props) => {
|
|
46
|
+
const { t } = useTranslation();
|
|
47
|
+
const contentTypeDescription = t(additional ? 'resource.tooltipAdditionalTopic' : 'resource.tooltipCoreTopic');
|
|
36
48
|
|
|
37
49
|
return (
|
|
38
50
|
<li
|
|
39
51
|
className={topicClasses('item', {
|
|
40
|
-
subjectPage,
|
|
52
|
+
subjectPage: !!subjectPage,
|
|
41
53
|
additional,
|
|
42
54
|
showAdditionalCores,
|
|
43
55
|
})}>
|
|
@@ -52,12 +64,12 @@ export const TopicIntroduction = ({
|
|
|
52
64
|
{contentTypeDescription}
|
|
53
65
|
</span>
|
|
54
66
|
{additional && (
|
|
55
|
-
<Tooltip tooltip={
|
|
67
|
+
<Tooltip tooltip={t('resource.tooltipAdditionalTopic')} align="left">
|
|
56
68
|
<Additional className="c-icon--20 u-margin-left-tiny" />
|
|
57
69
|
</Tooltip>
|
|
58
70
|
)}
|
|
59
71
|
{!additional && showAdditionalCores && (
|
|
60
|
-
<Tooltip tooltip={
|
|
72
|
+
<Tooltip tooltip={t('resource.tooltipCoreTopic')} align="left">
|
|
61
73
|
<Core className="c-icon--20 u-margin-left-tiny" />
|
|
62
74
|
</Tooltip>
|
|
63
75
|
)}
|
|
@@ -73,9 +85,6 @@ export const TopicIntroduction = ({
|
|
|
73
85
|
alwaysExpanded={shortcutAlwaysExpanded}
|
|
74
86
|
id={`${topic.id}_shortcuts`}
|
|
75
87
|
shortcuts={shortcuts}
|
|
76
|
-
messages={{
|
|
77
|
-
toggleButtonText: messages.shortcutButtonText,
|
|
78
|
-
}}
|
|
79
88
|
/>
|
|
80
89
|
)}
|
|
81
90
|
</div>
|
|
@@ -89,25 +98,3 @@ export const TopicIntroduction = ({
|
|
|
89
98
|
</li>
|
|
90
99
|
);
|
|
91
100
|
};
|
|
92
|
-
|
|
93
|
-
TopicIntroduction.propTypes = {
|
|
94
|
-
additional: PropTypes.bool,
|
|
95
|
-
showAdditionalCores: PropTypes.bool,
|
|
96
|
-
messages: PropTypes.shape({
|
|
97
|
-
shortcutButtonText: PropTypes.string.isRequired,
|
|
98
|
-
tooltipAdditionalTopic: PropTypes.string,
|
|
99
|
-
tooltipCoreTopic: PropTypes.string,
|
|
100
|
-
}),
|
|
101
|
-
topic: TopicShape.isRequired,
|
|
102
|
-
toTopic: PropTypes.func.isRequired,
|
|
103
|
-
subjectPage: PropTypes.bool,
|
|
104
|
-
shortcuts: PropTypes.arrayOf(ShortcutShape),
|
|
105
|
-
twoColumns: PropTypes.bool,
|
|
106
|
-
shortcutAlwaysExpanded: PropTypes.bool,
|
|
107
|
-
id: PropTypes.string.isRequired,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
TopicIntroduction.defaultProps = {
|
|
111
|
-
showAdditionalCores: false,
|
|
112
|
-
additional: false,
|
|
113
|
-
};
|
|
@@ -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
|
@@ -158,6 +158,37 @@ export { default as ResourceGroup } from './ResourceGroup';
|
|
|
158
158
|
|
|
159
159
|
export { default as LayoutItem, OneColumn, PageContainer, Content } from './Layout';
|
|
160
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
|
+
|
|
161
192
|
export {
|
|
162
193
|
SubjectAbout,
|
|
163
194
|
SubjectArchive,
|
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,66 +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 { OneColumn } from '@ndla/ui';
|
|
13
|
-
import SafeLink from '@ndla/safelink';
|
|
14
|
-
import { withTranslation } from 'react-i18next';
|
|
15
|
-
import CategorySelect from './CategorySelect';
|
|
16
|
-
|
|
17
|
-
import { topicShape } from './shapes';
|
|
18
|
-
|
|
19
|
-
const classes = new BEMHelper({
|
|
20
|
-
name: 'film-moviesearch',
|
|
21
|
-
prefix: 'c-',
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const classesMovieList = new BEMHelper({
|
|
25
|
-
name: 'film-movielist',
|
|
26
|
-
prefix: 'c-',
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const FilmMovieSearch = ({ topics, t, ...props }) => (
|
|
30
|
-
<div {...classes('')}>
|
|
31
|
-
<OneColumn>
|
|
32
|
-
<div {...classes('topic-navigation')}>
|
|
33
|
-
<h2 {...classesMovieList('heading', '', 'u-12/12 u-4/12@tablet')}>{t('ndlaFilm.subjectsInMovies')}:</h2>
|
|
34
|
-
<nav className="u-12/12 u-8/12@tablet">
|
|
35
|
-
<ul>
|
|
36
|
-
{topics.map((topic) => (
|
|
37
|
-
<li key={topic.id}>
|
|
38
|
-
<SafeLink to={topic.path} key={topic.id}>
|
|
39
|
-
<span>{topic.name}</span>
|
|
40
|
-
</SafeLink>
|
|
41
|
-
</li>
|
|
42
|
-
))}
|
|
43
|
-
</ul>
|
|
44
|
-
</nav>
|
|
45
|
-
</div>
|
|
46
|
-
<CategorySelect {...props} />
|
|
47
|
-
</OneColumn>
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
FilmMovieSearch.propTypes = {
|
|
52
|
-
topics: PropTypes.arrayOf(topicShape),
|
|
53
|
-
onChangeResourceType: PropTypes.func.isRequired,
|
|
54
|
-
resourceTypeSelected: PropTypes.shape({
|
|
55
|
-
name: PropTypes.string,
|
|
56
|
-
id: PropTypes.string,
|
|
57
|
-
}),
|
|
58
|
-
ariaControlId: PropTypes.string.isRequired,
|
|
59
|
-
t: PropTypes.func.isRequired,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
FilmMovieSearch.defaultProps = {
|
|
63
|
-
topics: [],
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export default withTranslation()(FilmMovieSearch);
|