@ndla/ui 9.0.2 → 10.1.1
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/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 +10 -25
- package/es/Notion/FigureNotion.js +9 -8
- package/es/Notion/Notion.js +11 -14
- package/es/Notion/NotionImage.js +18 -30
- package/es/Notion/NotionVisualElement.js +5 -5
- package/es/index.js +2 -1
- 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/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 +11 -24
- package/lib/Notion/FigureNotion.d.ts +1 -1
- package/lib/Notion/FigureNotion.js +15 -12
- package/lib/Notion/Notion.js +11 -13
- package/lib/Notion/NotionImage.d.ts +2 -4
- package/lib/Notion/NotionImage.js +17 -30
- package/lib/Notion/NotionVisualElement.js +5 -5
- package/lib/index.d.ts +1 -0
- 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 -6
- 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 +81 -115
- package/src/Notion/FigureNotion.tsx +11 -2
- package/src/Notion/Notion.tsx +12 -4
- package/src/Notion/NotionImage.tsx +20 -33
- package/src/Notion/NotionVisualElement.tsx +3 -3
- package/src/index.ts +2 -0
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"@ndla/button": "^2.2.0",
|
|
35
35
|
"@ndla/carousel": "^1.2.6",
|
|
36
36
|
"@ndla/core": "^2.1.1",
|
|
37
|
-
"@ndla/hooks": "^1.1.
|
|
37
|
+
"@ndla/hooks": "^1.1.4",
|
|
38
38
|
"@ndla/icons": "^1.7.0",
|
|
39
39
|
"@ndla/licenses": "^4.1.0",
|
|
40
40
|
"@ndla/modal": "^1.2.6",
|
|
41
|
-
"@ndla/notion": "^3.0
|
|
41
|
+
"@ndla/notion": "^3.1.0",
|
|
42
42
|
"@ndla/safelink": "^1.1.7",
|
|
43
43
|
"@ndla/switch": "^0.1.5",
|
|
44
|
-
"@ndla/tabs": "^1.1.
|
|
44
|
+
"@ndla/tabs": "^1.1.5",
|
|
45
45
|
"@ndla/tooltip": "^0.3.5",
|
|
46
|
-
"@ndla/util": "^
|
|
46
|
+
"@ndla/util": "^3.0.0",
|
|
47
47
|
"@reach/menu-button": "^0.16.2",
|
|
48
48
|
"@reach/slider": "^0.16.0",
|
|
49
49
|
"focus-trap-react": "^8.9.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "6c43d6775f6e357cc738d2fac813e6841fe84f10"
|
|
85
85
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022-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 styled from '@emotion/styled';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
|
|
12
|
+
const BreadcrumbsWrapper = styled.div``;
|
|
13
|
+
|
|
14
|
+
type BreadcrumbsProps = {
|
|
15
|
+
items: {
|
|
16
|
+
title: string;
|
|
17
|
+
url: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Breadcrumbs = ({ items }: BreadcrumbsProps) => {
|
|
22
|
+
<BreadcrumbsWrapper>
|
|
23
|
+
{items.map(({ title, url }) => (
|
|
24
|
+
<a key={url} href={url}>
|
|
25
|
+
{title}
|
|
26
|
+
</a>
|
|
27
|
+
))}
|
|
28
|
+
</BreadcrumbsWrapper>;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022-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 styled from '@emotion/styled';
|
|
10
|
+
import React, { ReactElement } from 'react';
|
|
11
|
+
// import { useTranslation } from 'react-i18next';
|
|
12
|
+
|
|
13
|
+
type ResourceElementWrapperProp = {
|
|
14
|
+
type: 'folder' | 'resource';
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const ResourceElementWrapper = styled.div<ResourceElementWrapperProp>`
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 0.5rem;
|
|
21
|
+
border: 1px solid rgba(209, 214, 219, 1);
|
|
22
|
+
border-radius: 2px;
|
|
23
|
+
background: ${({ type }) => (type === 'folder' ? '#fafaf9' : '#fff')};
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
type ResourceElementProps = {
|
|
27
|
+
type: 'folder' | 'resource';
|
|
28
|
+
title: string;
|
|
29
|
+
rightSide?: ReactElement;
|
|
30
|
+
leftSide?: ReactElement;
|
|
31
|
+
description?: string;
|
|
32
|
+
children?: ReactElement;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const ResourceElement = ({ type, title, description, leftSide, rightSide, children }: ResourceElementProps) => {
|
|
36
|
+
// const { t } = useTranslation();
|
|
37
|
+
return (
|
|
38
|
+
<ResourceElementWrapper type={type}>
|
|
39
|
+
<div>{leftSide}</div>
|
|
40
|
+
<div>
|
|
41
|
+
<h1>{title}</h1>
|
|
42
|
+
<p>{description}</p>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
<div>{rightSide}</div>
|
|
46
|
+
</ResourceElementWrapper>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default ResourceElement;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022-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 styled from '@emotion/styled';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import ResourceElement from './ResourceElement';
|
|
12
|
+
|
|
13
|
+
const ResourcesWrapper = styled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 1rem; 0;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export const ResourcesView = () => {
|
|
20
|
+
return (
|
|
21
|
+
<ResourcesWrapper>
|
|
22
|
+
<ResourceElement
|
|
23
|
+
type="folder"
|
|
24
|
+
title="Example folder"
|
|
25
|
+
leftSide={<img src="http://placekitten.com/200/200" alt="Mjaoo" />}
|
|
26
|
+
rightSide={<span>#tag</span>}
|
|
27
|
+
description="some description">
|
|
28
|
+
<p>Im a child.. insert content</p>
|
|
29
|
+
</ResourceElement>
|
|
30
|
+
<ResourceElement
|
|
31
|
+
type="resource"
|
|
32
|
+
title="Example Resource"
|
|
33
|
+
leftSide={<img src="http://placekitten.com/200/200" alt="Brrr" />}
|
|
34
|
+
rightSide={<span>#tag</span>}
|
|
35
|
+
description="some description">
|
|
36
|
+
<p>Im a child.. insert content</p>
|
|
37
|
+
</ResourceElement>
|
|
38
|
+
</ResourcesWrapper>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default ResourcesView;
|
|
@@ -11,6 +11,7 @@ import React, { useEffect } from 'react';
|
|
|
11
11
|
import { initArticleScripts } from '@ndla/article-scripts';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { breakpoints, mq, spacing } from '@ndla/core';
|
|
14
|
+
import { parseMarkdown } from '@ndla/util';
|
|
14
15
|
import Notion, { NotionDialogContent, NotionDialogText, NotionDialogLicenses } from '@ndla/notion';
|
|
15
16
|
import { Notion as UINotion } from '.';
|
|
16
17
|
import { NotionImage } from './NotionImage';
|
|
@@ -18,20 +19,6 @@ import NotionVisualElement, { NotionVisualElementType } from './NotionVisualElem
|
|
|
18
19
|
import FigureNotion from './FigureNotion';
|
|
19
20
|
import { Copyright } from '../types';
|
|
20
21
|
|
|
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
22
|
const ImageWrapper = styled.div`
|
|
36
23
|
float: right;
|
|
37
24
|
padding-left: ${spacing.normal};
|
|
@@ -48,9 +35,7 @@ export interface ConceptNotionType {
|
|
|
48
35
|
copyright?: Partial<Copyright>;
|
|
49
36
|
title: string;
|
|
50
37
|
text: string;
|
|
51
|
-
subjectNames?: string[];
|
|
52
38
|
visualElement?: NotionVisualElementType;
|
|
53
|
-
authors: string[];
|
|
54
39
|
source?: string;
|
|
55
40
|
image?: {
|
|
56
41
|
src: string;
|
|
@@ -62,10 +47,9 @@ interface Props {
|
|
|
62
47
|
concept: ConceptNotionType;
|
|
63
48
|
disableScripts?: boolean;
|
|
64
49
|
hideIconsAndAuthors?: boolean;
|
|
65
|
-
adjustSizeToFitWiderPage?: boolean;
|
|
66
50
|
}
|
|
67
51
|
|
|
68
|
-
const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors
|
|
52
|
+
const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors }: Props) => {
|
|
69
53
|
const notionId = `notion-${concept.id}`;
|
|
70
54
|
const figureId = `notion-figure-${concept.id}`;
|
|
71
55
|
const visualElementId = `visual-element-${concept.id}`;
|
|
@@ -78,104 +62,86 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, adj
|
|
|
78
62
|
}, [disableScripts]);
|
|
79
63
|
|
|
80
64
|
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
|
-
subTitle={t('searchPage.resultType.notionsHeading')}
|
|
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}
|
|
65
|
+
<FigureNotion
|
|
66
|
+
resizeIframe
|
|
67
|
+
id={figureId}
|
|
68
|
+
figureId={visualElementId}
|
|
69
|
+
copyright={concept.copyright}
|
|
70
|
+
licenseString={concept.copyright?.license?.license ?? ''}
|
|
71
|
+
type="concept"
|
|
72
|
+
hideIconsAndAuthors={hideIconsAndAuthors}>
|
|
73
|
+
<UINotion
|
|
74
|
+
id={notionId}
|
|
75
|
+
title={concept.title}
|
|
76
|
+
text={concept.text}
|
|
77
|
+
imageElement={
|
|
78
|
+
concept.visualElement?.resource === 'image' && concept.visualElement.image ? (
|
|
79
|
+
<ImageWrapper>
|
|
80
|
+
<Notion
|
|
81
|
+
id={notionId}
|
|
82
|
+
ariaLabel={t('factbox.open')}
|
|
83
|
+
title={concept.title}
|
|
84
|
+
subTitle={t('searchPage.resultType.notionsHeading')}
|
|
85
|
+
hideBaselineIcon
|
|
86
|
+
content={
|
|
87
|
+
<>
|
|
88
|
+
<NotionDialogContent>
|
|
89
|
+
{concept.visualElement?.resource === 'image' && concept.visualElement.image ? (
|
|
90
|
+
<NotionVisualElement visualElement={concept.visualElement} id={notionId} figureId={figureId} />
|
|
91
|
+
) : undefined}
|
|
92
|
+
<NotionDialogText>{parseMarkdown(concept.text, 'body')}</NotionDialogText>
|
|
93
|
+
</NotionDialogContent>
|
|
94
|
+
<NotionDialogLicenses license={concept.copyright?.license?.license ?? ''} source={concept.source} />
|
|
95
|
+
</>
|
|
96
|
+
}>
|
|
97
|
+
{concept.visualElement.image && (
|
|
98
|
+
<NotionImage
|
|
99
|
+
type={type}
|
|
100
|
+
id={visualElementId}
|
|
101
|
+
src={concept.visualElement.image.src}
|
|
102
|
+
alt={concept.visualElement.image.alt ?? ''}
|
|
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
|
-
</ImageWrapper>
|
|
175
|
-
) : undefined
|
|
176
|
-
}></UINotion>
|
|
177
|
-
</FigureNotion>
|
|
178
|
-
</ContentWrapper>
|
|
127
|
+
<NotionDialogText>{parseMarkdown(concept.text, 'body')}</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
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
</Notion>
|
|
141
|
+
</ImageWrapper>
|
|
142
|
+
) : undefined
|
|
143
|
+
}></UINotion>
|
|
144
|
+
</FigureNotion>
|
|
179
145
|
);
|
|
180
146
|
};
|
|
181
147
|
|
|
@@ -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
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;
|
|
@@ -19,7 +26,7 @@ interface Props {
|
|
|
19
26
|
title?: string;
|
|
20
27
|
copyright?: Partial<Copyright>;
|
|
21
28
|
licenseString: string;
|
|
22
|
-
type: 'video' | 'h5p' | 'image' | 'concept';
|
|
29
|
+
type: 'video' | 'h5p' | 'image' | 'concept' | 'other';
|
|
23
30
|
hideFigCaption?: boolean;
|
|
24
31
|
hideIconsAndAuthors?: boolean;
|
|
25
32
|
}
|
|
@@ -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
|
@@ -11,8 +11,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
11
11
|
import { parseMarkdown } from '@ndla/util';
|
|
12
12
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
13
13
|
|
|
14
|
-
const NotionContainer = styled.div``;
|
|
15
|
-
|
|
16
14
|
const ContentWrapper = styled.div`
|
|
17
15
|
${mq.range({ until: breakpoints.tabletWide })} {
|
|
18
16
|
display: flex;
|
|
@@ -43,6 +41,16 @@ const TextWrapper = styled.div<{ hasVisualElement: boolean }>`
|
|
|
43
41
|
${ContentWrapper} .c-figure.expanded + & {
|
|
44
42
|
width: 100%;
|
|
45
43
|
}
|
|
44
|
+
${mq.range({ from: breakpoints.desktop })} {
|
|
45
|
+
ul,
|
|
46
|
+
ol {
|
|
47
|
+
margin: 12px 0;
|
|
48
|
+
padding: 0 1rem 0 2rem;
|
|
49
|
+
}
|
|
50
|
+
ol > li {
|
|
51
|
+
margin-left: 24px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
46
54
|
`;
|
|
47
55
|
|
|
48
56
|
const ClearWrapper = styled.div`
|
|
@@ -71,7 +79,7 @@ const Notion = ({ id, labels = [], text, title, visualElement, imageElement, chi
|
|
|
71
79
|
const { t } = useTranslation();
|
|
72
80
|
|
|
73
81
|
return (
|
|
74
|
-
<
|
|
82
|
+
<div>
|
|
75
83
|
<ContentWrapper>
|
|
76
84
|
{imageElement}
|
|
77
85
|
{visualElement}
|
|
@@ -93,7 +101,7 @@ const Notion = ({ id, labels = [], text, title, visualElement, imageElement, chi
|
|
|
93
101
|
<ClearWrapper />
|
|
94
102
|
</ContentWrapper>
|
|
95
103
|
{children}
|
|
96
|
-
</
|
|
104
|
+
</div>
|
|
97
105
|
);
|
|
98
106
|
};
|
|
99
107
|
|
|
@@ -10,9 +10,7 @@ import styled from '@emotion/styled';
|
|
|
10
10
|
import { animations, breakpoints, mq, spacing } from '@ndla/core';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
12
|
import Image from '../Image';
|
|
13
|
-
import { FigureOpenDialogButton } from '../Figure';
|
|
14
|
-
import { Copyright } from '../types';
|
|
15
|
-
import FigureNotion from './FigureNotion';
|
|
13
|
+
import { Figure, FigureOpenDialogButton } from '../Figure';
|
|
16
14
|
|
|
17
15
|
const StyledImageWrapper = styled.div`
|
|
18
16
|
overflow: hidden;
|
|
@@ -38,44 +36,33 @@ const StyledImage = styled(Image)`
|
|
|
38
36
|
`;
|
|
39
37
|
|
|
40
38
|
interface Props {
|
|
41
|
-
type
|
|
39
|
+
type: 'image' | 'video' | 'h5p' | 'iframe' | 'external' | undefined;
|
|
42
40
|
id: string;
|
|
43
41
|
src: string;
|
|
44
42
|
alt: string;
|
|
45
|
-
imageCopyright?: Partial<Copyright>;
|
|
46
43
|
}
|
|
47
|
-
export const NotionImage = ({ id, src, alt,
|
|
44
|
+
export const NotionImage = ({ id, src, alt, type }: Props) => {
|
|
48
45
|
const { t } = useTranslation();
|
|
49
46
|
|
|
50
|
-
const imageId = `image-${id}`;
|
|
51
47
|
const imageFigureId = `image-figure-${id}`;
|
|
52
48
|
|
|
53
49
|
return (
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
zoomImageButtonLabel: t('license.images.itemImage.zoomImageButtonLabel'),
|
|
72
|
-
zoomOutImageButtonLabel: t('license.image.itemImage.zoomOutImageButtonLabel'),
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
}
|
|
76
|
-
/>
|
|
77
|
-
</StyledImageWrapper>
|
|
78
|
-
)}
|
|
79
|
-
</FigureNotion>
|
|
50
|
+
<Figure resizeIframe id={imageFigureId} type={'full-column'}>
|
|
51
|
+
<StyledImageWrapper>
|
|
52
|
+
<StyledImage
|
|
53
|
+
alt={alt}
|
|
54
|
+
src={src}
|
|
55
|
+
expandButton={
|
|
56
|
+
<FigureOpenDialogButton
|
|
57
|
+
type={type}
|
|
58
|
+
messages={{
|
|
59
|
+
zoomImageButtonLabel: t('license.images.itemImage.zoomImageButtonLabel'),
|
|
60
|
+
zoomOutImageButtonLabel: t('license.image.itemImage.zoomOutImageButtonLabel'),
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
}
|
|
64
|
+
/>
|
|
65
|
+
</StyledImageWrapper>
|
|
66
|
+
</Figure>
|
|
80
67
|
);
|
|
81
68
|
};
|
|
@@ -43,10 +43,10 @@ const getType = (resource: string) => {
|
|
|
43
43
|
if (resource === 'brightcove') {
|
|
44
44
|
return 'video';
|
|
45
45
|
}
|
|
46
|
-
if (resource === 'image') {
|
|
47
|
-
return
|
|
46
|
+
if (resource === 'image' || resource === 'h5p') {
|
|
47
|
+
return resource;
|
|
48
48
|
}
|
|
49
|
-
return '
|
|
49
|
+
return 'other';
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const NotionVisualElement = ({ visualElement, id, figureId }: Props) => {
|
package/src/index.ts
CHANGED
|
@@ -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;
|