@ndla/ui 6.2.1 → 8.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/Masthead/Masthead.js +7 -2
- package/es/MessageBox/MessageBox.js +26 -12
- package/es/Notion/FigureNotion.js +0 -1
- package/es/Notion/Notion.js +13 -14
- package/es/Notion/NotionVisualElement.js +1 -1
- package/es/SearchTypeResult/SearchItem.js +9 -9
- package/es/locale/messages-en.js +2 -2
- package/es/locale/messages-nb.js +2 -2
- package/es/locale/messages-nn.js +2 -2
- package/lib/Masthead/Masthead.d.ts +9 -3
- package/lib/Masthead/Masthead.js +7 -2
- package/lib/MessageBox/MessageBox.d.ts +3 -2
- package/lib/MessageBox/MessageBox.js +25 -11
- package/lib/Notion/FigureNotion.js +0 -1
- package/lib/Notion/Notion.d.ts +1 -2
- package/lib/Notion/Notion.js +13 -14
- package/lib/Notion/NotionVisualElement.js +1 -1
- package/lib/SearchTypeResult/SearchItem.js +9 -9
- package/lib/locale/messages-en.d.ts +2 -2
- package/lib/locale/messages-en.js +2 -2
- package/lib/locale/messages-nb.d.ts +2 -2
- package/lib/locale/messages-nb.js +2 -2
- package/lib/locale/messages-nn.d.ts +2 -2
- package/lib/locale/messages-nn.js +2 -2
- package/package.json +3 -2
- package/src/Masthead/Masthead.tsx +15 -2
- package/src/MessageBox/MessageBox.tsx +22 -2
- package/src/Notion/FigureNotion.tsx +0 -1
- package/src/Notion/Notion.tsx +3 -15
- package/src/Notion/NotionVisualElement.tsx +1 -1
- package/src/SearchTypeResult/SearchItem.tsx +1 -8
- package/src/locale/messages-en.ts +2 -2
- package/src/locale/messages-nb.ts +2 -2
- package/src/locale/messages-nn.ts +2 -2
package/src/Notion/Notion.tsx
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import
|
|
11
|
+
import { parseMarkdown } from '@ndla/util';
|
|
12
12
|
import React, { Fragment, ReactNode } from 'react';
|
|
13
13
|
import { keyframes } from '@emotion/core';
|
|
14
14
|
import Button from '@ndla/button';
|
|
@@ -174,7 +174,6 @@ type VisualElementProps = {
|
|
|
174
174
|
export type NotionProps = {
|
|
175
175
|
id: string | number;
|
|
176
176
|
labels?: string[];
|
|
177
|
-
renderMarkdown?: (text: string) => string;
|
|
178
177
|
text: ReactNode;
|
|
179
178
|
title: string;
|
|
180
179
|
visualElement?: VisualElementProps;
|
|
@@ -182,16 +181,7 @@ export type NotionProps = {
|
|
|
182
181
|
children?: ReactNode;
|
|
183
182
|
};
|
|
184
183
|
|
|
185
|
-
const Notion = ({
|
|
186
|
-
id,
|
|
187
|
-
labels = [],
|
|
188
|
-
renderMarkdown,
|
|
189
|
-
text,
|
|
190
|
-
title,
|
|
191
|
-
visualElement,
|
|
192
|
-
imageElement,
|
|
193
|
-
children,
|
|
194
|
-
}: NotionProps) => {
|
|
184
|
+
const Notion = ({ id, labels = [], text, title, visualElement, imageElement, children }: NotionProps) => {
|
|
195
185
|
const { t } = useTranslation();
|
|
196
186
|
|
|
197
187
|
return (
|
|
@@ -224,9 +214,7 @@ const Notion = ({
|
|
|
224
214
|
</ImageWrapper>
|
|
225
215
|
)}
|
|
226
216
|
<TextWrapper hasVisualElement={!!(imageElement || visualElement?.metaImage)}>
|
|
227
|
-
{
|
|
228
|
-
renderMarkdown ? renderMarkdown(`**${title}** \u2013 ${text}`) : `<b>${title}</b> \u2013 ${text}`,
|
|
229
|
-
)}
|
|
217
|
+
{parseMarkdown(`**${title}** \u2013 ${text}`)}
|
|
230
218
|
{!!labels.length && (
|
|
231
219
|
<LabelsContainer>
|
|
232
220
|
{t('searchPage.resultType.notionLabels')}
|
|
@@ -24,7 +24,7 @@ interface Props {
|
|
|
24
24
|
visualElement: NotionVisualElementType;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const supportedEmbedTypes = ['brightcove', 'h5p'];
|
|
27
|
+
const supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external'];
|
|
28
28
|
const NotionVisualElement = ({ visualElement }: Props) => {
|
|
29
29
|
const id = '1';
|
|
30
30
|
const figureId = 'figure-1';
|
|
@@ -115,10 +115,6 @@ const ItemLink = styled(SafeLink)`
|
|
|
115
115
|
const TextWrapper = styled.div`
|
|
116
116
|
padding: 0 ${spacing.normal} ${spacing.small};
|
|
117
117
|
transition: all ${animations.durations.fast} ease-in-out;
|
|
118
|
-
${ItemWrapper}:hover & {
|
|
119
|
-
padding-left: calc(${spacing.normal} + 2px);
|
|
120
|
-
padding-right: calc(${spacing.normal} + 2px);
|
|
121
|
-
}
|
|
122
118
|
`;
|
|
123
119
|
|
|
124
120
|
const ItemTitleWrapper = styled.div<ItemTypeProps>`
|
|
@@ -153,10 +149,7 @@ const ItemText = styled.div<ItemTypeProps>`
|
|
|
153
149
|
props.isTopic &&
|
|
154
150
|
`
|
|
155
151
|
${fonts.sizes('18px', '28px')};
|
|
156
|
-
|
|
157
|
-
padding-left: 2px;
|
|
158
|
-
padding-right: 2px;
|
|
159
|
-
}`};
|
|
152
|
+
`};
|
|
160
153
|
`;
|
|
161
154
|
|
|
162
155
|
const ContextWrapper = styled.div`
|
|
@@ -329,8 +329,8 @@ const messages = {
|
|
|
329
329
|
feide: 'This resource is accessible only to teachers who are logged in with Feide.',
|
|
330
330
|
resources:
|
|
331
331
|
'This is not a complete course produced by NDLA, but a collection of resources we hope you will find useful.',
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
subjectOutdated: 'This course is not updated to the current curriculum.',
|
|
333
|
+
subjectBeta: 'This course is in beta.',
|
|
334
334
|
newVersion:
|
|
335
335
|
'This learning resource is not updated to the current curriculum. You can find an updated version here: ',
|
|
336
336
|
frontPageBeta:
|
|
@@ -328,8 +328,8 @@ const messages = {
|
|
|
328
328
|
feide: 'Denne ressursen er bare tilgjengelig for lærere som er pålogget med Feide.',
|
|
329
329
|
resources:
|
|
330
330
|
'Dette er ikke et komplett læremiddel produsert av NDLA, men ei ressurssamling som vi håper kan være nyttig for deg.',
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
subjectOutdated: 'Dette faget følger en utgått læreplan.',
|
|
332
|
+
subjectBeta: 'Dette faget er i betaversjon.',
|
|
333
333
|
newVersion:
|
|
334
334
|
'Denne læringsressursen er ikke oppdatert etter gjeldende læreplan. Du finner en oppdatert versjon her: ',
|
|
335
335
|
frontPageBeta:
|
|
@@ -329,8 +329,8 @@ const messages = {
|
|
|
329
329
|
feide: 'Denne ressursen er berre tilgjengeleg for lærarar som er pålogga med Feide.',
|
|
330
330
|
resources:
|
|
331
331
|
'Dette er ikkje eit komplett læremiddel produsert av NDLA, men ei ressurssamling som vi håper kan vere nyttig for deg.',
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
subjectOutdated: 'Dette faget følgjer ein utgått læreplan.',
|
|
333
|
+
subjectBeta: 'Dette faget er i betaversjon.',
|
|
334
334
|
newVersion:
|
|
335
335
|
'Denne læringsressursen er ikkje oppdatert etter gjeldande læreplan. Du finn ein oppdatert versjon her: ',
|
|
336
336
|
frontPageBeta:
|