@ndla/ui 8.1.0 → 8.2.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/Article/Article.js +2 -3
- package/es/MessageBox/MessageBox.js +38 -50
- package/es/Programme/ProgrammeSubjects.js +8 -2
- package/es/Topic/Topic.js +25 -21
- package/es/locale/messages-en.js +2 -1
- package/es/locale/messages-nb.js +2 -1
- package/es/locale/messages-nn.js +2 -1
- package/lib/Article/Article.js +2 -3
- package/lib/MessageBox/MessageBox.d.ts +2 -3
- package/lib/MessageBox/MessageBox.js +38 -51
- package/lib/Programme/ProgrammeSubjects.d.ts +1 -0
- package/lib/Programme/ProgrammeSubjects.js +10 -2
- package/lib/Topic/Topic.d.ts +2 -1
- package/lib/Topic/Topic.js +26 -21
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +2 -1
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +2 -1
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +2 -1
- package/package.json +2 -4
- package/src/Article/Article.tsx +1 -3
- package/src/MessageBox/MessageBox.tsx +3 -14
- package/src/Programme/ProgrammeSubjects.tsx +5 -0
- package/src/Topic/Topic.tsx +4 -0
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
|
@@ -333,7 +333,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
333
333
|
printPage: 'Print',
|
|
334
334
|
access: {
|
|
335
335
|
onlyTeacher: 'This resource is accessible only to teachers who are logged in with Feide.'
|
|
336
|
-
}
|
|
336
|
+
},
|
|
337
|
+
possiblyOutdated: 'The article is outdated'
|
|
337
338
|
},
|
|
338
339
|
competenceGoals: {
|
|
339
340
|
competenceGoal: 'competence-goal',
|
|
@@ -333,7 +333,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
333
333
|
printPage: 'Skriv ut',
|
|
334
334
|
access: {
|
|
335
335
|
onlyTeacher: 'Denne ressursen er bare tilgjengelig for lærere som er pålogget med Feide.'
|
|
336
|
-
}
|
|
336
|
+
},
|
|
337
|
+
possiblyOutdated: 'Artikkelen er foreldet.'
|
|
337
338
|
},
|
|
338
339
|
competenceGoals: {
|
|
339
340
|
competenceGoal: 'kompetansemål',
|
|
@@ -333,7 +333,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
333
333
|
printPage: 'Skriv ut',
|
|
334
334
|
access: {
|
|
335
335
|
onlyTeacher: 'Denne ressursen er berre tilgjengeleg for lærarar som er pålogga med Feide.'
|
|
336
|
-
}
|
|
336
|
+
},
|
|
337
|
+
possiblyOutdated: 'Artikkelen er foreldet.'
|
|
337
338
|
},
|
|
338
339
|
competenceGoals: {
|
|
339
340
|
competenceGoal: 'kompetansemål',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"lodash": "^4.17.20",
|
|
55
55
|
"react-bem-helper": "1.4.1",
|
|
56
56
|
"react-device-detect": "^2.1.2",
|
|
57
|
-
"react-sticky-el": "^2.0.6",
|
|
58
57
|
"react-swipeable": "^6.2.0",
|
|
59
58
|
"react-transition-group": "^2.5.3",
|
|
60
59
|
"remarkable": "^2.0.1",
|
|
@@ -71,7 +70,6 @@
|
|
|
71
70
|
"devDependencies": {
|
|
72
71
|
"@babel/plugin-proposal-optional-chaining": "^7.11.0",
|
|
73
72
|
"@types/reach__dialog": "^0.1.0",
|
|
74
|
-
"@types/react-sticky-el": "^1.0.2",
|
|
75
73
|
"@types/react-transition-group": "^4.4.2",
|
|
76
74
|
"css-loader": "^2.1.0",
|
|
77
75
|
"mini-css-extract-plugin": "^0.5.0",
|
|
@@ -82,5 +80,5 @@
|
|
|
82
80
|
"publishConfig": {
|
|
83
81
|
"access": "public"
|
|
84
82
|
},
|
|
85
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "76d43c9fc110d7dcd1ab0f46e0f3c7ddd3d313b2"
|
|
86
84
|
}
|
package/src/Article/Article.tsx
CHANGED
|
@@ -191,9 +191,7 @@ export const Article = ({
|
|
|
191
191
|
|
|
192
192
|
{messages.messageBox && (
|
|
193
193
|
<MSGboxWrapper>
|
|
194
|
-
<MessageBox links={messageBoxLinks}
|
|
195
|
-
{messages.messageBox}
|
|
196
|
-
</MessageBox>
|
|
194
|
+
<MessageBox links={messageBoxLinks}>{messages.messageBox}</MessageBox>
|
|
197
195
|
</MSGboxWrapper>
|
|
198
196
|
)}
|
|
199
197
|
<ArticleHeaderWrapper competenceGoals={competenceGoals} competenceGoalTypes={competenceGoalTypes}>
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import React, { HTMLAttributes, useState } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
|
-
import Sticky from 'react-sticky-el';
|
|
12
11
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
13
12
|
import { InformationOutline, HumanMaleBoard } from '@ndla/icons/common';
|
|
14
13
|
import { WithTranslation, withTranslation } from 'react-i18next';
|
|
@@ -82,7 +81,6 @@ const Wrapper = styled.div<WrapperProps>`
|
|
|
82
81
|
border-radius: ${(props) => StyleByType(props.boxType).borderRadius};
|
|
83
82
|
transform: ${(props) => StyleByType(props.boxType).transform};
|
|
84
83
|
left: ${(props) => StyleByType(props.boxType).left};
|
|
85
|
-
z-index: 10;
|
|
86
84
|
width: ${(props) => StyleByType(props.boxType).width};
|
|
87
85
|
`;
|
|
88
86
|
|
|
@@ -155,7 +153,6 @@ type LinkProps = {
|
|
|
155
153
|
};
|
|
156
154
|
type Props = {
|
|
157
155
|
type?: WrapperProps['boxType'];
|
|
158
|
-
sticky?: boolean;
|
|
159
156
|
children?: string;
|
|
160
157
|
links?: LinkProps[];
|
|
161
158
|
showCloseButton?: boolean;
|
|
@@ -166,14 +163,7 @@ const markdown = new Remarkable({ breaks: true });
|
|
|
166
163
|
markdown.inline.ruler.enable(['sub', 'sup']);
|
|
167
164
|
markdown.block.ruler.disable(['list', 'table']);
|
|
168
165
|
|
|
169
|
-
export const MessageBox = ({
|
|
170
|
-
type,
|
|
171
|
-
sticky = false,
|
|
172
|
-
children = '',
|
|
173
|
-
links,
|
|
174
|
-
showCloseButton,
|
|
175
|
-
onClose,
|
|
176
|
-
}: Props & WithTranslation) => {
|
|
166
|
+
export const MessageBox = ({ type, children = '', links, showCloseButton, onClose }: Props & WithTranslation) => {
|
|
177
167
|
const [hideMessageBox, setHideMessageBox] = useState(false);
|
|
178
168
|
const onCloseMessageBox = () => {
|
|
179
169
|
setHideMessageBox(true);
|
|
@@ -181,8 +171,7 @@ export const MessageBox = ({
|
|
|
181
171
|
};
|
|
182
172
|
const Icon = type === 'ghost' ? HumanMaleBoard : InformationOutline;
|
|
183
173
|
return (
|
|
184
|
-
|
|
185
|
-
<Sticky disabled={!sticky} stickyStyle={{ zIndex: 9998, top: 84 }} topOffset={-84}>
|
|
174
|
+
<>
|
|
186
175
|
<Wrapper boxType={type} style={{ display: hideMessageBox ? 'none' : 'flex' }}>
|
|
187
176
|
<InfoWrapper boxType={type}>
|
|
188
177
|
<IconWrapper boxType={type}>
|
|
@@ -205,7 +194,7 @@ export const MessageBox = ({
|
|
|
205
194
|
))}
|
|
206
195
|
</LinkWrapper>
|
|
207
196
|
)}
|
|
208
|
-
|
|
197
|
+
</>
|
|
209
198
|
);
|
|
210
199
|
};
|
|
211
200
|
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
10
11
|
import styled from '@emotion/styled';
|
|
11
12
|
import Button from '@ndla/button';
|
|
12
13
|
import { breakpoints, mq } from '@ndla/core';
|
|
13
14
|
import { NavigationBox } from '../Navigation';
|
|
15
|
+
import { MessageBox } from '../MessageBox';
|
|
14
16
|
|
|
15
17
|
const GradesMenu = styled.div`
|
|
16
18
|
margin-bottom: 28px;
|
|
@@ -29,6 +31,7 @@ export type GradesProps = {
|
|
|
29
31
|
selectedGrade?: string;
|
|
30
32
|
onChangeGrade: (newGrade: string) => void;
|
|
31
33
|
grades: {
|
|
34
|
+
missingProgrammeSubjects?: boolean;
|
|
32
35
|
name: string;
|
|
33
36
|
categories: {
|
|
34
37
|
name: string;
|
|
@@ -45,6 +48,7 @@ type Props = GradesProps & {
|
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
const ProgrammeSubjects = ({ grades, onNavigate, onChangeGrade, selectedGrade = 'vg1' }: Props) => {
|
|
51
|
+
const { t } = useTranslation();
|
|
48
52
|
const grade = grades.find((grade) => grade.name.toLowerCase() === selectedGrade) ?? grades[0];
|
|
49
53
|
return (
|
|
50
54
|
<>
|
|
@@ -60,6 +64,7 @@ const ProgrammeSubjects = ({ grades, onNavigate, onChangeGrade, selectedGrade =
|
|
|
60
64
|
</Button>
|
|
61
65
|
))}
|
|
62
66
|
</GradesMenu>
|
|
67
|
+
{grade.missingProgrammeSubjects && <MessageBox>{t('messageBoxInfo.noContent')}</MessageBox>}
|
|
63
68
|
{grade.categories.map((category) => (
|
|
64
69
|
<NavigationBox key={category.name} heading={category.name} items={category.subjects} onClick={onNavigate} />
|
|
65
70
|
))}
|
package/src/Topic/Topic.tsx
CHANGED
|
@@ -21,6 +21,7 @@ import Loader from './Loader';
|
|
|
21
21
|
import { ItemProps } from '../Navigation/NavigationBox';
|
|
22
22
|
import { NavigationBox } from '../Navigation';
|
|
23
23
|
import { makeSrcQueryString, ImageCrop, ImageFocalPoint } from '../Image';
|
|
24
|
+
import { MessageBox, MessageBoxType } from '../MessageBox';
|
|
24
25
|
|
|
25
26
|
type InvertItProps = {
|
|
26
27
|
invertedStyle?: boolean;
|
|
@@ -235,6 +236,7 @@ export type TopicProps = {
|
|
|
235
236
|
showContent?: boolean;
|
|
236
237
|
isAdditionalTopic?: boolean;
|
|
237
238
|
frame?: boolean;
|
|
239
|
+
messageBox?: string;
|
|
238
240
|
children?: ReactNode;
|
|
239
241
|
};
|
|
240
242
|
|
|
@@ -249,6 +251,7 @@ const Topic = ({
|
|
|
249
251
|
showContent,
|
|
250
252
|
isAdditionalTopic,
|
|
251
253
|
frame,
|
|
254
|
+
messageBox,
|
|
252
255
|
children,
|
|
253
256
|
}: TopicProps) => {
|
|
254
257
|
const { t } = useTranslation();
|
|
@@ -328,6 +331,7 @@ const Topic = ({
|
|
|
328
331
|
</StyledAdditionalResource>
|
|
329
332
|
)}
|
|
330
333
|
</TopicHeading>
|
|
334
|
+
{messageBox && <MessageBox type={MessageBoxType.medium}>{messageBox}</MessageBox>}
|
|
331
335
|
<TopicIntroduction invertedStyle={invertedStyle}>
|
|
332
336
|
{renderMarkdown ? parse(renderMarkdown(topic.introduction)) : topic.introduction}
|
|
333
337
|
</TopicIntroduction>
|