@ndla/ui 9.0.0 → 10.0.0
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/LearningPaths/LearningPathMobileHeader.js +3 -3
- package/es/MyNdla/ResourceDash/Breadcrumbs.js +22 -0
- package/es/MyNdla/ResourceDash/ResourceElement.js +27 -0
- package/es/MyNdla/ResourceDash/ResourcesView.js +43 -0
- package/es/MyNdla/ResourceDash/index.js +4 -0
- package/es/MyNdla/index.js +4 -0
- package/es/Notion/ConceptNotion.js +5 -19
- package/es/Notion/FigureNotion.js +10 -9
- package/es/Notion/Notion.js +7 -5
- package/es/Notion/NotionImage.js +4 -3
- package/es/index.js +3 -3
- package/es/locale/messages-en.js +11 -0
- package/es/locale/messages-nb.js +11 -0
- package/es/locale/messages-nn.js +11 -0
- package/es/locale/messages-se.js +11 -0
- package/es/locale/messages-sma.js +11 -0
- package/lib/LearningPaths/LearningPathMobileHeader.js +4 -4
- package/lib/MyNdla/ResourceDash/Breadcrumbs.d.ts +15 -0
- package/lib/MyNdla/ResourceDash/Breadcrumbs.js +35 -0
- package/lib/MyNdla/ResourceDash/ResourceElement.d.ts +18 -0
- package/lib/MyNdla/ResourceDash/ResourceElement.js +38 -0
- package/lib/MyNdla/ResourceDash/ResourcesView.d.ts +9 -0
- package/lib/MyNdla/ResourceDash/ResourcesView.js +57 -0
- package/lib/MyNdla/ResourceDash/index.d.ts +4 -0
- package/lib/MyNdla/ResourceDash/index.js +31 -0
- package/lib/MyNdla/index.d.ts +4 -0
- package/lib/MyNdla/index.js +25 -0
- package/lib/Notion/ConceptNotion.d.ts +1 -4
- package/lib/Notion/ConceptNotion.js +5 -18
- package/lib/Notion/FigureNotion.js +16 -13
- package/lib/Notion/Notion.js +7 -5
- package/lib/Notion/NotionImage.js +7 -5
- package/lib/index.d.ts +2 -2
- package/lib/index.js +24 -1
- package/lib/locale/messages-en.d.ts +11 -0
- package/lib/locale/messages-en.js +11 -0
- package/lib/locale/messages-nb.d.ts +11 -0
- package/lib/locale/messages-nb.js +11 -0
- package/lib/locale/messages-nn.d.ts +11 -0
- package/lib/locale/messages-nn.js +11 -0
- package/lib/locale/messages-se.d.ts +11 -0
- package/lib/locale/messages-se.js +11 -0
- package/lib/locale/messages-sma.d.ts +11 -0
- package/lib/locale/messages-sma.js +11 -0
- package/package.json +6 -5
- package/src/LearningPaths/LearningPathMobileHeader.tsx +1 -1
- package/src/MyNdla/ResourceDash/Breadcrumbs.tsx +31 -0
- package/src/MyNdla/ResourceDash/ResourceElement.tsx +50 -0
- package/src/MyNdla/ResourceDash/ResourcesView.tsx +42 -0
- package/src/MyNdla/ResourceDash/index.ts +5 -0
- package/src/MyNdla/index.ts +5 -0
- package/src/Notion/ConceptNotion.tsx +82 -115
- package/src/Notion/FigureNotion.tsx +11 -2
- package/src/Notion/Notion.tsx +10 -0
- package/src/Notion/NotionImage.tsx +2 -1
- package/src/index.ts +3 -2
- package/src/locale/messages-en.ts +11 -0
- package/src/locale/messages-nb.ts +11 -0
- package/src/locale/messages-nn.ts +11 -0
- package/src/locale/messages-se.ts +11 -0
- package/src/locale/messages-sma.ts +11 -0
|
@@ -18,20 +18,6 @@ import NotionVisualElement, { NotionVisualElementType } from './NotionVisualElem
|
|
|
18
18
|
import FigureNotion from './FigureNotion';
|
|
19
19
|
import { Copyright } from '../types';
|
|
20
20
|
|
|
21
|
-
const ContentWrapper = styled.div<{ adjustSizeToFitWiderPage?: boolean }>`
|
|
22
|
-
position: relative;
|
|
23
|
-
right: auto;
|
|
24
|
-
left: ${(props) => (props.adjustSizeToFitWiderPage ? '0%' : '-16.6666666667%')};
|
|
25
|
-
width: ${(props) => (props.adjustSizeToFitWiderPage ? '100%' : '133.3333333333%')};
|
|
26
|
-
padding-left: 24px;
|
|
27
|
-
padding-right: 24px;
|
|
28
|
-
|
|
29
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
30
|
-
width: 100%;
|
|
31
|
-
left: 0;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
21
|
const ImageWrapper = styled.div`
|
|
36
22
|
float: right;
|
|
37
23
|
padding-left: ${spacing.normal};
|
|
@@ -48,9 +34,7 @@ export interface ConceptNotionType {
|
|
|
48
34
|
copyright?: Partial<Copyright>;
|
|
49
35
|
title: string;
|
|
50
36
|
text: string;
|
|
51
|
-
subjectNames?: string[];
|
|
52
37
|
visualElement?: NotionVisualElementType;
|
|
53
|
-
authors: string[];
|
|
54
38
|
source?: string;
|
|
55
39
|
image?: {
|
|
56
40
|
src: string;
|
|
@@ -62,10 +46,9 @@ interface Props {
|
|
|
62
46
|
concept: ConceptNotionType;
|
|
63
47
|
disableScripts?: boolean;
|
|
64
48
|
hideIconsAndAuthors?: boolean;
|
|
65
|
-
adjustSizeToFitWiderPage?: boolean;
|
|
66
49
|
}
|
|
67
50
|
|
|
68
|
-
const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors
|
|
51
|
+
const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors }: Props) => {
|
|
69
52
|
const notionId = `notion-${concept.id}`;
|
|
70
53
|
const figureId = `notion-figure-${concept.id}`;
|
|
71
54
|
const visualElementId = `visual-element-${concept.id}`;
|
|
@@ -78,104 +61,88 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, adj
|
|
|
78
61
|
}, [disableScripts]);
|
|
79
62
|
|
|
80
63
|
return (
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{concept.visualElement
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
content={
|
|
144
|
-
<>
|
|
145
|
-
<NotionDialogContent>
|
|
146
|
-
{concept.visualElement &&
|
|
147
|
-
concept.visualElement?.resource !== 'image' &&
|
|
148
|
-
concept.visualElement.url ? (
|
|
149
|
-
<NotionVisualElement
|
|
150
|
-
visualElement={concept.visualElement}
|
|
151
|
-
id={notionId}
|
|
152
|
-
figureId={figureId}
|
|
153
|
-
/>
|
|
154
|
-
) : undefined}
|
|
64
|
+
<FigureNotion
|
|
65
|
+
resizeIframe
|
|
66
|
+
id={figureId}
|
|
67
|
+
figureId={visualElementId}
|
|
68
|
+
copyright={concept.copyright}
|
|
69
|
+
licenseString={concept.copyright?.license?.license ?? ''}
|
|
70
|
+
type="concept"
|
|
71
|
+
hideIconsAndAuthors={hideIconsAndAuthors}>
|
|
72
|
+
<UINotion
|
|
73
|
+
id={notionId}
|
|
74
|
+
title={concept.title}
|
|
75
|
+
text={concept.text}
|
|
76
|
+
imageElement={
|
|
77
|
+
concept.visualElement?.resource === 'image' && concept.visualElement.image ? (
|
|
78
|
+
<ImageWrapper>
|
|
79
|
+
<Notion
|
|
80
|
+
id={notionId}
|
|
81
|
+
ariaLabel={t('factbox.open')}
|
|
82
|
+
title={concept.title}
|
|
83
|
+
subTitle={t('searchPage.resultType.notionsHeading')}
|
|
84
|
+
hideBaselineIcon
|
|
85
|
+
content={
|
|
86
|
+
<>
|
|
87
|
+
<NotionDialogContent>
|
|
88
|
+
{concept.visualElement?.resource === 'image' && concept.visualElement.image ? (
|
|
89
|
+
<NotionVisualElement visualElement={concept.visualElement} id={notionId} figureId={figureId} />
|
|
90
|
+
) : undefined}
|
|
91
|
+
<NotionDialogText>{concept.text}</NotionDialogText>
|
|
92
|
+
</NotionDialogContent>
|
|
93
|
+
<NotionDialogLicenses license={concept.copyright?.license?.license ?? ''} source={concept.source} />
|
|
94
|
+
</>
|
|
95
|
+
}>
|
|
96
|
+
{concept.visualElement.image && (
|
|
97
|
+
<NotionImage
|
|
98
|
+
type={type}
|
|
99
|
+
id={visualElementId}
|
|
100
|
+
src={concept.visualElement.image.src}
|
|
101
|
+
alt={concept.visualElement.image.alt ?? ''}
|
|
102
|
+
imageCopyright={concept.visualElement.copyright}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
</Notion>
|
|
106
|
+
</ImageWrapper>
|
|
107
|
+
) : undefined
|
|
108
|
+
}
|
|
109
|
+
visualElement={
|
|
110
|
+
concept.visualElement && concept.visualElement.resource !== 'image' && concept.visualElement.url ? (
|
|
111
|
+
<ImageWrapper>
|
|
112
|
+
<Notion
|
|
113
|
+
id={notionId}
|
|
114
|
+
ariaLabel={t('factbox.open')}
|
|
115
|
+
title={concept.title}
|
|
116
|
+
hideBaselineIcon
|
|
117
|
+
subTitle={t('searchPage.resultType.notionsHeading')}
|
|
118
|
+
content={
|
|
119
|
+
<>
|
|
120
|
+
<NotionDialogContent>
|
|
121
|
+
{concept.visualElement &&
|
|
122
|
+
concept.visualElement?.resource !== 'image' &&
|
|
123
|
+
concept.visualElement.url ? (
|
|
124
|
+
<NotionVisualElement visualElement={concept.visualElement} id={notionId} figureId={figureId} />
|
|
125
|
+
) : undefined}
|
|
155
126
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
) : undefined
|
|
176
|
-
}></UINotion>
|
|
177
|
-
</FigureNotion>
|
|
178
|
-
</ContentWrapper>
|
|
127
|
+
<NotionDialogText>{concept.text}</NotionDialogText>
|
|
128
|
+
</NotionDialogContent>
|
|
129
|
+
<NotionDialogLicenses license={concept.copyright?.license?.license ?? ''} source={concept.source} />
|
|
130
|
+
</>
|
|
131
|
+
}>
|
|
132
|
+
{concept.image && (
|
|
133
|
+
<NotionImage
|
|
134
|
+
type={type}
|
|
135
|
+
id={visualElementId}
|
|
136
|
+
src={concept.image?.src}
|
|
137
|
+
alt={concept.image?.alt ?? ''}
|
|
138
|
+
imageCopyright={concept.visualElement.copyright}
|
|
139
|
+
/>
|
|
140
|
+
)}
|
|
141
|
+
</Notion>
|
|
142
|
+
</ImageWrapper>
|
|
143
|
+
) : undefined
|
|
144
|
+
}></UINotion>
|
|
145
|
+
</FigureNotion>
|
|
179
146
|
);
|
|
180
147
|
};
|
|
181
148
|
|
|
@@ -5,12 +5,19 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree. *
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import styled from '@emotion/styled';
|
|
9
|
+
import { colors, spacing } from '@ndla/core';
|
|
8
10
|
import { getGroupedContributorDescriptionList, getLicenseByAbbreviation } from '@ndla/licenses';
|
|
9
11
|
import React, { ReactNode } from 'react';
|
|
10
12
|
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import { Figure, FigureCaption, FigureLicenseDialog } from '
|
|
13
|
+
import { Figure, FigureCaption, FigureLicenseDialog } from '../Figure';
|
|
12
14
|
import { Copyright } from '../types';
|
|
13
15
|
|
|
16
|
+
const BottomBorder = styled.div`
|
|
17
|
+
margin-top: ${spacing.normal};
|
|
18
|
+
border-bottom: 1px solid ${colors.brand.greyLight};
|
|
19
|
+
`;
|
|
20
|
+
|
|
14
21
|
interface Props {
|
|
15
22
|
resizeIframe?: boolean;
|
|
16
23
|
figureId: string;
|
|
@@ -53,7 +60,7 @@ const FigureNotion = ({
|
|
|
53
60
|
{({ typeClass }) => (
|
|
54
61
|
<>
|
|
55
62
|
{typeof children === 'function' ? children({ typeClass }) : children}
|
|
56
|
-
{copyright?.license?.license
|
|
63
|
+
{copyright?.license?.license ? (
|
|
57
64
|
<FigureCaption
|
|
58
65
|
hideFigcaption={hideFigCaption}
|
|
59
66
|
figureId={figureId}
|
|
@@ -77,6 +84,8 @@ const FigureNotion = ({
|
|
|
77
84
|
title: t('title'),
|
|
78
85
|
}}></FigureLicenseDialog>
|
|
79
86
|
</FigureCaption>
|
|
87
|
+
) : (
|
|
88
|
+
<BottomBorder />
|
|
80
89
|
)}
|
|
81
90
|
</>
|
|
82
91
|
)}
|
package/src/Notion/Notion.tsx
CHANGED
|
@@ -43,6 +43,16 @@ const TextWrapper = styled.div<{ hasVisualElement: boolean }>`
|
|
|
43
43
|
${ContentWrapper} .c-figure.expanded + & {
|
|
44
44
|
width: 100%;
|
|
45
45
|
}
|
|
46
|
+
${mq.range({ from: breakpoints.desktop })} {
|
|
47
|
+
ul,
|
|
48
|
+
ol {
|
|
49
|
+
margin: 12px 0;
|
|
50
|
+
padding: 0 1rem 0 2rem;
|
|
51
|
+
}
|
|
52
|
+
ol > li {
|
|
53
|
+
margin-left: 24px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
46
56
|
`;
|
|
47
57
|
|
|
48
58
|
const ClearWrapper = styled.div`
|
|
@@ -9,7 +9,8 @@ import React from 'react';
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { animations, breakpoints, mq, spacing } from '@ndla/core';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
|
-
import
|
|
12
|
+
import Image from '../Image';
|
|
13
|
+
import { FigureOpenDialogButton } from '../Figure';
|
|
13
14
|
import { Copyright } from '../types';
|
|
14
15
|
import FigureNotion from './FigureNotion';
|
|
15
16
|
|
package/src/index.ts
CHANGED
|
@@ -65,8 +65,7 @@ export {
|
|
|
65
65
|
|
|
66
66
|
export { default as FactBox } from './FactBox';
|
|
67
67
|
|
|
68
|
-
export { default as Image, ImageLink } from './Image';
|
|
69
|
-
export { makeSrcQueryString } from './Image';
|
|
68
|
+
export { default as Image, ImageLink, makeSrcQueryString } from './Image';
|
|
70
69
|
|
|
71
70
|
export {
|
|
72
71
|
SubjectMaterialHero,
|
|
@@ -221,3 +220,5 @@ export { default as ContentPlaceholder } from './ContentPlaceholder';
|
|
|
221
220
|
export { Notion, ConceptNotion } from './Notion';
|
|
222
221
|
|
|
223
222
|
export { BannerCard } from './BannerCard';
|
|
223
|
+
|
|
224
|
+
export { ResourcesView, ResourceElement, Breadcrumbs } from './MyNdla';
|
|
@@ -915,6 +915,17 @@ const messages = {
|
|
|
915
915
|
open: 'Open fact box',
|
|
916
916
|
close: 'Close fact box',
|
|
917
917
|
},
|
|
918
|
+
myNdla: {
|
|
919
|
+
resources: 'resources',
|
|
920
|
+
folders: 'folders',
|
|
921
|
+
folder: 'folder',
|
|
922
|
+
myFolders: 'My folders',
|
|
923
|
+
myTags: 'My tags',
|
|
924
|
+
newFolder: 'New folder',
|
|
925
|
+
myAccount: 'My account',
|
|
926
|
+
favourites: 'Favourites',
|
|
927
|
+
help: 'Help',
|
|
928
|
+
},
|
|
918
929
|
};
|
|
919
930
|
|
|
920
931
|
export default messages;
|
|
@@ -913,6 +913,17 @@ const messages = {
|
|
|
913
913
|
open: 'Åpne faktaboks',
|
|
914
914
|
close: 'Lukk faktaboks',
|
|
915
915
|
},
|
|
916
|
+
myNdla: {
|
|
917
|
+
resources: 'Ressurser',
|
|
918
|
+
folders: 'Mapper',
|
|
919
|
+
folder: 'Mappe',
|
|
920
|
+
myFolders: 'Mine mapper',
|
|
921
|
+
myTags: 'Mine tags',
|
|
922
|
+
newFolder: 'Ny mappe',
|
|
923
|
+
myAccount: 'Min konto',
|
|
924
|
+
favourites: 'Favoritter',
|
|
925
|
+
help: 'Hjelp',
|
|
926
|
+
},
|
|
916
927
|
};
|
|
917
928
|
|
|
918
929
|
export default messages;
|
|
@@ -914,6 +914,17 @@ const messages = {
|
|
|
914
914
|
open: 'Åpne faktaboks',
|
|
915
915
|
close: 'Lukk faktaboks',
|
|
916
916
|
},
|
|
917
|
+
myNdla: {
|
|
918
|
+
resources: 'Ressursar',
|
|
919
|
+
folders: 'Mapper',
|
|
920
|
+
folder: 'Mappe',
|
|
921
|
+
myFolders: 'Mine mapper',
|
|
922
|
+
myTags: 'Mine tags',
|
|
923
|
+
newFolder: 'Ny mappe',
|
|
924
|
+
myAccount: 'Min konto',
|
|
925
|
+
favourites: 'Favorittar',
|
|
926
|
+
help: 'Hjelp',
|
|
927
|
+
},
|
|
917
928
|
};
|
|
918
929
|
|
|
919
930
|
export default messages;
|
|
@@ -913,6 +913,17 @@ const messages = {
|
|
|
913
913
|
open: 'Åpne faktaboks',
|
|
914
914
|
close: 'Lukk faktaboks',
|
|
915
915
|
},
|
|
916
|
+
myNdla: {
|
|
917
|
+
resources: 'Ressurser',
|
|
918
|
+
folders: 'Mapper',
|
|
919
|
+
folder: 'Mappe',
|
|
920
|
+
myFolders: 'Mine mapper',
|
|
921
|
+
myTags: 'Mine tags',
|
|
922
|
+
newFolder: 'Ny mappe',
|
|
923
|
+
myAccount: 'Min konto',
|
|
924
|
+
favourites: 'Favoritter',
|
|
925
|
+
help: 'Hjelp',
|
|
926
|
+
},
|
|
916
927
|
};
|
|
917
928
|
|
|
918
929
|
export default messages;
|
|
@@ -913,6 +913,17 @@ const messages = {
|
|
|
913
913
|
open: 'Åpne faktaboks',
|
|
914
914
|
close: 'Lukk faktaboks',
|
|
915
915
|
},
|
|
916
|
+
myNdla: {
|
|
917
|
+
resources: 'Ressurser',
|
|
918
|
+
folders: 'Mapper',
|
|
919
|
+
folder: 'Mappe',
|
|
920
|
+
myFolders: 'Mine mapper',
|
|
921
|
+
myTags: 'Mine tags',
|
|
922
|
+
newFolder: 'Ny mappe',
|
|
923
|
+
myAccount: 'Min konto',
|
|
924
|
+
favourites: 'Favoritter',
|
|
925
|
+
help: 'Hjelp',
|
|
926
|
+
},
|
|
916
927
|
};
|
|
917
928
|
|
|
918
929
|
export default messages;
|