@ndla/ui 8.2.4 → 9.0.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/Article/ArticleNotions.js +9 -7
- package/es/Figure/Figure.js +6 -5
- package/es/Figure/FigureExpandButton.js +6 -6
- package/es/Figure/FigureOpenDialogButton.js +45 -0
- package/es/Figure/index.js +2 -1
- package/es/Image/Image.js +1 -1
- package/es/MessageBox/MessageBox.js +8 -8
- package/es/Notion/ConceptNotion.js +79 -28
- package/es/Notion/FigureNotion.js +5 -6
- package/es/Notion/Notion.js +19 -98
- package/es/Notion/NotionImage.js +25 -6
- package/es/Notion/NotionVisualElement.js +49 -10
- package/es/ResourceBox/ResourceBox.js +34 -67
- package/es/Topic/Topic.js +21 -21
- package/es/all.css +1 -1
- package/es/index.js +1 -2
- package/es/locale/messages-en.js +1 -1
- package/es/locale/messages-nb.js +1 -1
- package/es/locale/messages-nn.js +1 -1
- package/lib/Article/ArticleNotions.d.ts +2 -1
- package/lib/Article/ArticleNotions.js +9 -7
- package/lib/Figure/Figure.d.ts +2 -1
- package/lib/Figure/Figure.js +6 -5
- package/lib/Figure/FigureExpandButton.js +6 -6
- package/lib/Figure/FigureOpenDialogButton.d.ts +16 -0
- package/lib/Figure/FigureOpenDialogButton.js +57 -0
- package/lib/Figure/index.d.ts +1 -0
- package/lib/Figure/index.js +8 -0
- package/lib/Image/Image.js +1 -1
- package/lib/MessageBox/MessageBox.js +9 -9
- package/lib/Notion/ConceptNotion.d.ts +6 -7
- package/lib/Notion/ConceptNotion.js +84 -30
- package/lib/Notion/FigureNotion.d.ts +3 -2
- package/lib/Notion/FigureNotion.js +5 -7
- package/lib/Notion/Notion.d.ts +1 -12
- package/lib/Notion/Notion.js +23 -105
- package/lib/Notion/NotionImage.d.ts +2 -1
- package/lib/Notion/NotionImage.js +25 -7
- package/lib/Notion/NotionVisualElement.d.ts +6 -7
- package/lib/Notion/NotionVisualElement.js +48 -18
- package/lib/ResourceBox/ResourceBox.js +34 -63
- package/lib/Topic/Topic.js +21 -21
- package/lib/all.css +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +7 -9
- package/lib/locale/messages-en.js +1 -1
- package/lib/locale/messages-nb.js +1 -1
- package/lib/locale/messages-nn.js +1 -1
- package/package.json +10 -9
- package/src/Article/ArticleNotions.tsx +3 -2
- package/src/Figure/Figure.tsx +49 -41
- package/src/Figure/FigureExpandButton.tsx +4 -4
- package/src/Figure/FigureOpenDialogButton.tsx +37 -0
- package/src/Figure/component.figure.scss +4 -0
- package/src/Figure/index.ts +1 -0
- package/src/Image/Image.tsx +1 -1
- package/src/MessageBox/MessageBox.tsx +1 -1
- package/src/Notion/ConceptNotion.tsx +136 -37
- package/src/Notion/FigureNotion.tsx +6 -6
- package/src/Notion/Notion.tsx +7 -145
- package/src/Notion/NotionImage.tsx +44 -15
- package/src/Notion/NotionVisualElement.tsx +35 -8
- package/src/ResourceBox/ResourceBox.tsx +47 -102
- package/src/Topic/Topic.tsx +1 -1
- package/src/index.ts +2 -2
- package/src/locale/messages-en.ts +1 -1
- package/src/locale/messages-nb.ts +1 -1
- package/src/locale/messages-nn.ts +1 -1
- package/es/CloseButton/CloseButton.js +0 -46
- package/es/CloseButton/index.js +0 -10
- package/lib/CloseButton/CloseButton.d.ts +0 -10
- package/lib/CloseButton/CloseButton.js +0 -54
- package/lib/CloseButton/index.d.ts +0 -10
- package/lib/CloseButton/index.js +0 -26
- package/src/CloseButton/CloseButton.tsx +0 -36
- package/src/CloseButton/index.ts +0 -13
package/src/Notion/Notion.tsx
CHANGED
|
@@ -5,17 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
import React, { Fragment, ReactNode } from 'react';
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import { parseMarkdown } from '@ndla/util';
|
|
12
|
-
import
|
|
13
|
-
import { keyframes } from '@emotion/core';
|
|
14
|
-
import Button from '@ndla/button';
|
|
15
|
-
import { animations, breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
16
|
-
import { CursorClick } from '@ndla/icons/action';
|
|
17
|
-
import { Play, ArrowCollapse } from '@ndla/icons/common';
|
|
18
|
-
import { ImageCrop, ImageFocalPoint, makeSrcQueryString } from '../Image';
|
|
12
|
+
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
19
13
|
|
|
20
14
|
const NotionContainer = styled.div``;
|
|
21
15
|
|
|
@@ -26,11 +20,7 @@ const ContentWrapper = styled.div`
|
|
|
26
20
|
}
|
|
27
21
|
.c-figure {
|
|
28
22
|
margin: 0;
|
|
29
|
-
position: relative !important;
|
|
30
|
-
left: 0 !important;
|
|
31
|
-
width: 25% !important;
|
|
32
23
|
padding: 0 0 0 20px;
|
|
33
|
-
float: right;
|
|
34
24
|
&.expanded {
|
|
35
25
|
width: 100% !important;
|
|
36
26
|
padding: 0;
|
|
@@ -44,114 +34,21 @@ const ContentWrapper = styled.div`
|
|
|
44
34
|
`;
|
|
45
35
|
const TextWrapper = styled.div<{ hasVisualElement: boolean }>`
|
|
46
36
|
width: ${(props) => (props.hasVisualElement ? '75%' : '100%')};
|
|
37
|
+
|
|
47
38
|
${mq.range({ until: breakpoints.tabletWide })} {
|
|
48
39
|
width: 100%;
|
|
49
40
|
}
|
|
50
|
-
font-family: ${fonts.
|
|
41
|
+
font-family: ${fonts.sans};
|
|
51
42
|
${fonts.sizes('18px', '28px')};
|
|
52
43
|
${ContentWrapper} .c-figure.expanded + & {
|
|
53
44
|
width: 100%;
|
|
54
45
|
}
|
|
55
46
|
`;
|
|
56
47
|
|
|
57
|
-
const ImageElement = styled.img``;
|
|
58
|
-
|
|
59
|
-
const fadeInMediaKeyframe = keyframes`
|
|
60
|
-
0% {
|
|
61
|
-
opacity: 0;
|
|
62
|
-
height: auto;
|
|
63
|
-
}
|
|
64
|
-
100% {
|
|
65
|
-
opacity: 1;
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
const fadeOutMediaKeyframe = keyframes`
|
|
69
|
-
0% {
|
|
70
|
-
opacity: 1;
|
|
71
|
-
height: auto;
|
|
72
|
-
}
|
|
73
|
-
100% {
|
|
74
|
-
opacity: 0;
|
|
75
|
-
height:0;
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
const ImageWrapper = styled.div`
|
|
81
|
-
float: right;
|
|
82
|
-
width: 25%;
|
|
83
|
-
padding-left: ${spacing.normal};
|
|
84
|
-
position: relative;
|
|
85
|
-
|
|
86
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
87
|
-
width: 100%;
|
|
88
|
-
padding-left: 0;
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
|
|
92
|
-
const ExpandVisualElementButton = styled(Button)`
|
|
93
|
-
position: absolute;
|
|
94
|
-
right: 8px;
|
|
95
|
-
bottom: 8px;
|
|
96
|
-
transition: all ${animations.durations.normal};
|
|
97
|
-
&,
|
|
98
|
-
&:focus,
|
|
99
|
-
&:active {
|
|
100
|
-
background-color: rgba(255, 255, 255, 0.65);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
color: ${colors.brand.primary};
|
|
104
|
-
border-radius: 50%;
|
|
105
|
-
border: 0;
|
|
106
|
-
width: 40px;
|
|
107
|
-
height: 40px;
|
|
108
|
-
display: inline-flex;
|
|
109
|
-
justify-content: center;
|
|
110
|
-
align-items: center;
|
|
111
|
-
|
|
112
|
-
svg {
|
|
113
|
-
transition: transform ${animations.durations.normal} ease-out;
|
|
114
|
-
}
|
|
115
|
-
${ContentWrapper}:hover & {
|
|
116
|
-
background-color: #fff;
|
|
117
|
-
svg {
|
|
118
|
-
transform: scale(1.2);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
|
-
const ExpandIcon = styled.span`
|
|
124
|
-
${ExpandVisualElementButton}.expanded & {
|
|
125
|
-
display: none;
|
|
126
|
-
}
|
|
127
|
-
`;
|
|
128
|
-
const CollapseIcon = styled.span`
|
|
129
|
-
display: none;
|
|
130
|
-
${ExpandVisualElementButton}.expanded & {
|
|
131
|
-
display: inline-block;
|
|
132
|
-
}
|
|
133
|
-
`;
|
|
134
|
-
|
|
135
48
|
const ClearWrapper = styled.div`
|
|
136
49
|
clear: both;
|
|
137
50
|
`;
|
|
138
51
|
|
|
139
|
-
const MediaContainer = styled.div`
|
|
140
|
-
opacity: 0;
|
|
141
|
-
height: 0;
|
|
142
|
-
overflow: hidden;
|
|
143
|
-
&.expanded {
|
|
144
|
-
animation-name: ${fadeInMediaKeyframe};
|
|
145
|
-
animation-duration: 2.8s;
|
|
146
|
-
opacity: 1;
|
|
147
|
-
height: auto;
|
|
148
|
-
}
|
|
149
|
-
&.fadeOut {
|
|
150
|
-
animation-name: ${fadeOutMediaKeyframe};
|
|
151
|
-
animation-duration: 2.8s;
|
|
152
|
-
}
|
|
153
|
-
`;
|
|
154
|
-
|
|
155
52
|
const LabelsContainer = styled.div`
|
|
156
53
|
display: flex;
|
|
157
54
|
align-items: center;
|
|
@@ -160,23 +57,12 @@ const LabelsContainer = styled.div`
|
|
|
160
57
|
margin: ${spacing.small} 0;
|
|
161
58
|
`;
|
|
162
59
|
|
|
163
|
-
type VisualElementProps = {
|
|
164
|
-
type: 'video' | 'other';
|
|
165
|
-
element: ReactNode;
|
|
166
|
-
metaImage?: {
|
|
167
|
-
url: string;
|
|
168
|
-
alt: string;
|
|
169
|
-
crop?: ImageCrop;
|
|
170
|
-
focalPoint?: ImageFocalPoint;
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
60
|
export type NotionProps = {
|
|
175
61
|
id: string | number;
|
|
176
62
|
labels?: string[];
|
|
177
63
|
text: ReactNode;
|
|
178
64
|
title: string;
|
|
179
|
-
visualElement
|
|
65
|
+
visualElement: ReactNode;
|
|
180
66
|
imageElement?: ReactNode;
|
|
181
67
|
children?: ReactNode;
|
|
182
68
|
};
|
|
@@ -186,34 +72,10 @@ const Notion = ({ id, labels = [], text, title, visualElement, imageElement, chi
|
|
|
186
72
|
|
|
187
73
|
return (
|
|
188
74
|
<NotionContainer>
|
|
189
|
-
{visualElement && <MediaContainer id={`notion-media-${id}`}>{visualElement.element}</MediaContainer>}
|
|
190
75
|
<ContentWrapper>
|
|
191
76
|
{imageElement}
|
|
192
|
-
{visualElement
|
|
193
|
-
|
|
194
|
-
<ImageElement
|
|
195
|
-
src={`${visualElement.metaImage.url}?${makeSrcQueryString(
|
|
196
|
-
400,
|
|
197
|
-
visualElement.metaImage.crop,
|
|
198
|
-
visualElement.metaImage.focalPoint,
|
|
199
|
-
)}`}
|
|
200
|
-
alt={visualElement.metaImage.alt}
|
|
201
|
-
/>
|
|
202
|
-
<ExpandVisualElementButton
|
|
203
|
-
stripped
|
|
204
|
-
data-notion-expand-media={true}
|
|
205
|
-
data-notion-media-id={`notion-media-${id}`}>
|
|
206
|
-
<ExpandIcon>
|
|
207
|
-
{visualElement.type === 'video' && <Play style={{ width: '24px', height: '24px' }} />}
|
|
208
|
-
{visualElement.type === 'other' && <CursorClick style={{ width: '24px', height: '24px' }} />}
|
|
209
|
-
</ExpandIcon>
|
|
210
|
-
<CollapseIcon>
|
|
211
|
-
<ArrowCollapse style={{ width: '24px', height: '24px' }} />
|
|
212
|
-
</CollapseIcon>
|
|
213
|
-
</ExpandVisualElementButton>
|
|
214
|
-
</ImageWrapper>
|
|
215
|
-
)}
|
|
216
|
-
<TextWrapper hasVisualElement={!!(imageElement || visualElement?.metaImage)}>
|
|
77
|
+
{visualElement}
|
|
78
|
+
<TextWrapper hasVisualElement={!!(imageElement || visualElement)}>
|
|
217
79
|
{parseMarkdown(`**${title}** \u2013 ${text}`, 'body')}
|
|
218
80
|
{!!labels.length && (
|
|
219
81
|
<LabelsContainer>
|
|
@@ -6,17 +6,44 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import styled from '@emotion/styled';
|
|
10
|
+
import { animations, breakpoints, mq, spacing } from '@ndla/core';
|
|
9
11
|
import { useTranslation } from 'react-i18next';
|
|
10
|
-
import { Image,
|
|
12
|
+
import { Image, FigureOpenDialogButton } from '..';
|
|
11
13
|
import { Copyright } from '../types';
|
|
12
14
|
import FigureNotion from './FigureNotion';
|
|
15
|
+
|
|
16
|
+
const StyledImageWrapper = styled.div`
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
width: 260px;
|
|
19
|
+
padding-top: ${spacing.small};
|
|
20
|
+
${mq.range({ until: breakpoints.tabletWide })} {
|
|
21
|
+
margin: 0 auto;
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
const StyledImage = styled(Image)`
|
|
26
|
+
object-fit: cover;
|
|
27
|
+
max-height: 162px;
|
|
28
|
+
transition: transform ${animations.durations.fast};
|
|
29
|
+
&:hover {
|
|
30
|
+
transform: scale(1.1);
|
|
31
|
+
opacity: 1.1;
|
|
32
|
+
transition-duration: 0.5s;
|
|
33
|
+
}
|
|
34
|
+
${mq.range({ until: breakpoints.tabletWide })} {
|
|
35
|
+
min-width: 260px;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
13
39
|
interface Props {
|
|
40
|
+
type?: 'image' | 'video' | 'h5p' | 'iframe' | 'external';
|
|
14
41
|
id: string;
|
|
15
42
|
src: string;
|
|
16
43
|
alt: string;
|
|
17
44
|
imageCopyright?: Partial<Copyright>;
|
|
18
45
|
}
|
|
19
|
-
export const NotionImage = ({ id, src, alt, imageCopyright }: Props) => {
|
|
46
|
+
export const NotionImage = ({ id, src, alt, imageCopyright, type }: Props) => {
|
|
20
47
|
const { t } = useTranslation();
|
|
21
48
|
|
|
22
49
|
const imageId = `image-${id}`;
|
|
@@ -32,19 +59,21 @@ export const NotionImage = ({ id, src, alt, imageCopyright }: Props) => {
|
|
|
32
59
|
licenseString={imageCopyright?.license?.license ?? ''}
|
|
33
60
|
type={'image'}>
|
|
34
61
|
{({ typeClass }) => (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
<StyledImageWrapper>
|
|
63
|
+
<StyledImage
|
|
64
|
+
alt={alt}
|
|
65
|
+
src={src}
|
|
66
|
+
expandButton={
|
|
67
|
+
<FigureOpenDialogButton
|
|
68
|
+
type={type}
|
|
69
|
+
messages={{
|
|
70
|
+
zoomImageButtonLabel: t('license.images.itemImage.zoomImageButtonLabel'),
|
|
71
|
+
zoomOutImageButtonLabel: t('license.image.itemImage.zoomOutImageButtonLabel'),
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
</StyledImageWrapper>
|
|
48
77
|
)}
|
|
49
78
|
</FigureNotion>
|
|
50
79
|
);
|
|
@@ -4,12 +4,24 @@
|
|
|
4
4
|
* This source code is licensed under the GPLv3 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree. *
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import
|
|
7
|
+
import { css } from '@emotion/core';
|
|
8
|
+
import styled from '@emotion/styled';
|
|
9
|
+
import React, { ReactNode } from 'react';
|
|
9
10
|
import { Copyright } from '../types';
|
|
10
11
|
import FigureNotion from './FigureNotion';
|
|
11
12
|
|
|
13
|
+
const StyledIframe = styled.iframe<{ type: string }>`
|
|
14
|
+
${(props) =>
|
|
15
|
+
props.type === 'video'
|
|
16
|
+
? css`
|
|
17
|
+
min-height: 400px;
|
|
18
|
+
`
|
|
19
|
+
: ''}
|
|
20
|
+
`;
|
|
21
|
+
|
|
12
22
|
export type NotionVisualElementType = {
|
|
23
|
+
element?: ReactNode;
|
|
24
|
+
type?: 'video' | 'image' | 'h5p';
|
|
13
25
|
resource?: string;
|
|
14
26
|
title?: string;
|
|
15
27
|
url?: string;
|
|
@@ -22,17 +34,28 @@ export type NotionVisualElementType = {
|
|
|
22
34
|
|
|
23
35
|
interface Props {
|
|
24
36
|
visualElement: NotionVisualElementType;
|
|
37
|
+
id: string;
|
|
38
|
+
figureId: string;
|
|
25
39
|
}
|
|
40
|
+
const supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external', 'image'];
|
|
26
41
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
const getType = (resource: string) => {
|
|
43
|
+
if (resource === 'brightcove') {
|
|
44
|
+
return 'video';
|
|
45
|
+
}
|
|
46
|
+
if (resource === 'image') {
|
|
47
|
+
return 'image';
|
|
48
|
+
}
|
|
49
|
+
return 'h5p';
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const NotionVisualElement = ({ visualElement, id, figureId }: Props) => {
|
|
31
53
|
if (!visualElement.resource || !supportedEmbedTypes.includes(visualElement.resource)) {
|
|
32
54
|
return <p>Embed type is not supported!</p>;
|
|
33
55
|
}
|
|
34
56
|
|
|
35
|
-
const type = visualElement.resource
|
|
57
|
+
const type = getType(visualElement.resource);
|
|
58
|
+
|
|
36
59
|
return (
|
|
37
60
|
<FigureNotion
|
|
38
61
|
resizeIframe
|
|
@@ -42,7 +65,11 @@ const NotionVisualElement = ({ visualElement }: Props) => {
|
|
|
42
65
|
copyright={visualElement.copyright}
|
|
43
66
|
licenseString={visualElement.copyright?.license?.license ?? ''}
|
|
44
67
|
type={type}>
|
|
45
|
-
|
|
68
|
+
{visualElement.image?.src ? (
|
|
69
|
+
<img src={visualElement.image?.src} alt={visualElement.image.alt} />
|
|
70
|
+
) : (
|
|
71
|
+
<StyledIframe type={type} src={visualElement.url} title={visualElement.title} />
|
|
72
|
+
)}
|
|
46
73
|
</FigureNotion>
|
|
47
74
|
);
|
|
48
75
|
};
|
|
@@ -15,124 +15,75 @@ import { SafeLinkButton } from '@ndla/safelink';
|
|
|
15
15
|
import styled from '@emotion/styled';
|
|
16
16
|
import Image from '../Image';
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const ResourceBoxContainer = styled.div`
|
|
19
19
|
display: flex;
|
|
20
|
-
padding
|
|
21
|
-
padding-bottom: 20px;
|
|
20
|
+
padding: 20px;
|
|
22
21
|
border-radius: 5px;
|
|
23
22
|
border: 1px solid ${colors.brand.light};
|
|
24
23
|
position: relative;
|
|
25
|
-
left: -16.6666666667%;
|
|
26
|
-
width: 133.3333333333%;
|
|
27
|
-
align-items: stretch;
|
|
28
|
-
margin-bottom: 24px;
|
|
29
24
|
font-family: ${fonts.sans};
|
|
30
25
|
box-shadow: 0px 20px 35px -15px rgba(32, 88, 143, 0.15);
|
|
31
26
|
gap: 40px;
|
|
32
27
|
|
|
33
28
|
${mq.range({ until: breakpoints.desktop })} {
|
|
34
|
-
gap:
|
|
29
|
+
gap: 0;
|
|
35
30
|
flex-direction: column;
|
|
36
|
-
|
|
37
|
-
width: 80%;
|
|
38
|
-
left: 0;
|
|
39
|
-
padding-left: 24px;
|
|
40
|
-
padding-right: 24px;
|
|
41
|
-
padding-bottom: 0;
|
|
42
|
-
margin-bottom: 24px;
|
|
43
|
-
height: auto;
|
|
31
|
+
padding-top: 30px;
|
|
44
32
|
text-align: center;
|
|
45
33
|
}
|
|
46
34
|
`;
|
|
47
35
|
|
|
48
|
-
const
|
|
36
|
+
const Title = styled.h3`
|
|
49
37
|
font-weight: ${fonts.weight.bold};
|
|
50
38
|
font-size: ${fonts.sizes(18)};
|
|
51
39
|
margin-top: 0;
|
|
52
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
53
|
-
text-align: center;
|
|
54
|
-
width: 100%;
|
|
55
|
-
}
|
|
56
40
|
`;
|
|
57
41
|
|
|
58
|
-
const
|
|
42
|
+
const Caption = styled.p`
|
|
59
43
|
font-size: ${fonts.sizes(14)};
|
|
44
|
+
max-width: 600px;
|
|
60
45
|
|
|
61
46
|
${mq.range({ until: breakpoints.desktop })} {
|
|
62
47
|
line-height: 22px;
|
|
63
48
|
}
|
|
64
49
|
`;
|
|
65
50
|
|
|
66
|
-
const
|
|
51
|
+
const TextWrapper = styled.div`
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
67
54
|
align-items: flex-start;
|
|
68
55
|
${mq.range({ until: breakpoints.desktop })} {
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
align-items: center;
|
|
57
|
+
padding-top: 10px;
|
|
71
58
|
}
|
|
72
59
|
`;
|
|
73
|
-
|
|
60
|
+
|
|
61
|
+
const StyledButton = styled(SafeLinkButton)`
|
|
74
62
|
border: 1px solid ${colors.brand.tertiary};
|
|
75
63
|
:hover {
|
|
76
64
|
background-color: ${colors.brand.primary};
|
|
65
|
+
border: 1px solid ${colors.brand.primary};
|
|
77
66
|
color: white;
|
|
78
67
|
}
|
|
79
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
80
|
-
width: 210px;
|
|
81
|
-
}
|
|
82
68
|
`;
|
|
83
|
-
|
|
69
|
+
|
|
70
|
+
const StyledLaunchIcon = styled(Launch)`
|
|
84
71
|
margin-left: 8px;
|
|
85
72
|
height: 15px;
|
|
86
73
|
width: 15px;
|
|
87
74
|
`;
|
|
88
75
|
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
96
|
-
width: 200px;
|
|
97
|
-
height: 200px;
|
|
98
|
-
}
|
|
99
|
-
`;
|
|
100
|
-
const ImageSectionWrapper = styled.div`
|
|
101
|
-
align-items: flex-start;
|
|
102
|
-
display: flex;
|
|
103
|
-
justify-content: center;
|
|
104
|
-
margin-left: 20px;
|
|
105
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
106
|
-
margin: 0 auto;
|
|
107
|
-
padding-top: 10px;
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
110
|
-
|
|
111
|
-
const CaptionSectionWrapper = styled.div`
|
|
112
|
-
max-width: 600px;
|
|
113
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
114
|
-
margin: 0 auto;
|
|
115
|
-
}
|
|
116
|
-
`;
|
|
117
|
-
|
|
118
|
-
const CenterItems = styled.div`
|
|
119
|
-
display: flex;
|
|
120
|
-
justify-content: center;
|
|
121
|
-
align-items: flex-start;
|
|
122
|
-
flex-flow: column;
|
|
123
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
124
|
-
width: 100%;
|
|
125
|
-
}
|
|
126
|
-
`;
|
|
76
|
+
const ImageWrapper = styled.div`
|
|
77
|
+
img {
|
|
78
|
+
object-fit: cover;
|
|
79
|
+
width: 134px;
|
|
80
|
+
height: 134px;
|
|
81
|
+
border-radius: 5px;
|
|
127
82
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
text-align: center;
|
|
133
|
-
padding-top: 10px;
|
|
134
|
-
max-width: 200px;
|
|
135
|
-
margin: 0 auto;
|
|
83
|
+
${mq.range({ until: breakpoints.desktop })} {
|
|
84
|
+
width: 200px;
|
|
85
|
+
height: 200px;
|
|
86
|
+
}
|
|
136
87
|
}
|
|
137
88
|
`;
|
|
138
89
|
|
|
@@ -157,33 +108,27 @@ type Props = {
|
|
|
157
108
|
export const ResourceBox = ({ image, title, caption, licenseRights, locale, authors, url }: Props) => {
|
|
158
109
|
const { t } = useTranslation();
|
|
159
110
|
return (
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
</LincenseWrapper>
|
|
175
|
-
</TitleAndLicence>
|
|
176
|
-
<Boxcaption>{caption}</Boxcaption>
|
|
177
|
-
</CaptionSectionWrapper>
|
|
111
|
+
<ResourceBoxContainer>
|
|
112
|
+
<LincenseWrapper>
|
|
113
|
+
<LicenseByline licenseRights={licenseRights} locale={locale} marginRight color={colors.brand.tertiary}>
|
|
114
|
+
<div className="c-figure__byline-author-buttons">
|
|
115
|
+
<span className="c-figure__byline-authors">{authors?.map((author) => author.name).join(' ')}</span>
|
|
116
|
+
</div>
|
|
117
|
+
</LicenseByline>
|
|
118
|
+
</LincenseWrapper>
|
|
119
|
+
<ImageWrapper>
|
|
120
|
+
<Image alt={title} src={image} />
|
|
121
|
+
</ImageWrapper>
|
|
122
|
+
<TextWrapper>
|
|
123
|
+
<Title>{title}</Title>
|
|
124
|
+
<Caption>{caption}</Caption>
|
|
178
125
|
|
|
179
|
-
<
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
</CenterItems>
|
|
186
|
-
</BoxWrapper>
|
|
126
|
+
<StyledButton to={url} target="_blank" outline borderShape="rounded">
|
|
127
|
+
{t('license.other.itemImage.ariaLabel')}
|
|
128
|
+
<StyledLaunchIcon aria-hidden />
|
|
129
|
+
</StyledButton>
|
|
130
|
+
</TextWrapper>
|
|
131
|
+
</ResourceBoxContainer>
|
|
187
132
|
);
|
|
188
133
|
};
|
|
189
134
|
|
package/src/Topic/Topic.tsx
CHANGED
package/src/index.ts
CHANGED
|
@@ -81,7 +81,7 @@ export {
|
|
|
81
81
|
|
|
82
82
|
export { Footer, EditorName, FooterText, FooterAuth } from './Footer';
|
|
83
83
|
|
|
84
|
-
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton } from './Figure';
|
|
84
|
+
export { Figure, FigureCaption, FigureLicenseDialog, FigureExpandButton, FigureOpenDialogButton } from './Figure';
|
|
85
85
|
|
|
86
86
|
export { LanguageSelector } from './LanguageSelector';
|
|
87
87
|
|
|
@@ -119,7 +119,6 @@ export { MessageBox, MessageBoxTag, MessageBoxType } from './MessageBox';
|
|
|
119
119
|
|
|
120
120
|
export { ResourceBox } from './ResourceBox';
|
|
121
121
|
|
|
122
|
-
export { default as CloseButton } from './CloseButton';
|
|
123
122
|
export { default as AudioPlayer, initAudioPlayers } from './AudioPlayer';
|
|
124
123
|
|
|
125
124
|
export { NavigationHeading, NavigationBox, NavigationTopicAbout } from './Navigation';
|
|
@@ -220,4 +219,5 @@ export { default as CopyParagraphButton } from './CopyParagraphButton';
|
|
|
220
219
|
|
|
221
220
|
export { default as ContentPlaceholder } from './ContentPlaceholder';
|
|
222
221
|
export { Notion, ConceptNotion } from './Notion';
|
|
222
|
+
|
|
223
223
|
export { BannerCard } from './BannerCard';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import _styled from "@emotion/styled-base";
|
|
2
|
-
|
|
3
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Copyright (c) 2022-present, NDLA.
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
11
|
-
* LICENSE file in the root directory of this source tree.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import { Cross } from '@ndla/icons/action';
|
|
16
|
-
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { colors } from '@ndla/core';
|
|
18
|
-
import { jsx as ___EmotionJSX } from "@emotion/core";
|
|
19
|
-
|
|
20
|
-
var StyledButton = _styled("button", {
|
|
21
|
-
target: "e4bzt4x0",
|
|
22
|
-
label: "StyledButton"
|
|
23
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
24
|
-
name: "1x6nvfn",
|
|
25
|
-
styles: "background-color:transparent;border:none;display:flex;cursor:pointer;"
|
|
26
|
-
} : {
|
|
27
|
-
name: "1x6nvfn",
|
|
28
|
-
styles: "background-color:transparent;border:none;display:flex;cursor:pointer;",
|
|
29
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNsb3NlQnV0dG9uLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFha0MiLCJmaWxlIjoiQ2xvc2VCdXR0b24udHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjItcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLlxuICpcbiAqL1xuaW1wb3J0IFJlYWN0LCB7IEJ1dHRvbkhUTUxBdHRyaWJ1dGVzIH0gZnJvbSAncmVhY3QnO1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgQ3Jvc3MgfSBmcm9tICdAbmRsYS9pY29ucy9hY3Rpb24nO1xuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tICdyZWFjdC1pMThuZXh0JztcbmltcG9ydCB7IGNvbG9ycyB9IGZyb20gJ0BuZGxhL2NvcmUnO1xuXG5jb25zdCBTdHlsZWRCdXR0b24gPSBzdHlsZWQuYnV0dG9uYFxuICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDtcbiAgYm9yZGVyOiBub25lO1xuICBkaXNwbGF5OiBmbGV4O1xuICBjdXJzb3I6IHBvaW50ZXI7XG5gO1xuXG5jb25zdCBTdHlsZWRDcm9zcyA9IHN0eWxlZChDcm9zcylgXG4gIGhlaWdodDogMjRweDtcbiAgd2lkdGg6IDI0cHg7XG4gIGNvbG9yOiAke2NvbG9ycy50ZXh0LnByaW1hcnl9O1xuYDtcblxuZXhwb3J0IGNvbnN0IENsb3NlQnV0dG9uID0gKHByb3BzOiBCdXR0b25IVE1MQXR0cmlidXRlczxIVE1MQnV0dG9uRWxlbWVudD4pID0+IHtcbiAgY29uc3QgeyB0IH0gPSB1c2VUcmFuc2xhdGlvbigpO1xuICByZXR1cm4gKFxuICAgIDxTdHlsZWRCdXR0b24gYXJpYS1sYWJlbD17dCgnY2xvc2UnKX0gey4uLnByb3BzfT5cbiAgICAgIDxTdHlsZWRDcm9zcyAvPlxuICAgIDwvU3R5bGVkQnV0dG9uPlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgQ2xvc2VCdXR0b247XG4iXX0= */",
|
|
30
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var StyledCross = /*#__PURE__*/_styled(Cross, {
|
|
34
|
-
target: "e4bzt4x1",
|
|
35
|
-
label: "StyledCross"
|
|
36
|
-
})("height:24px;width:24px;color:", colors.text.primary, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNsb3NlQnV0dG9uLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFvQmlDIiwiZmlsZSI6IkNsb3NlQnV0dG9uLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIyLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKi9cbmltcG9ydCBSZWFjdCwgeyBCdXR0b25IVE1MQXR0cmlidXRlcyB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IENyb3NzIH0gZnJvbSAnQG5kbGEvaWNvbnMvYWN0aW9uJztcbmltcG9ydCB7IHVzZVRyYW5zbGF0aW9uIH0gZnJvbSAncmVhY3QtaTE4bmV4dCc7XG5pbXBvcnQgeyBjb2xvcnMgfSBmcm9tICdAbmRsYS9jb3JlJztcblxuY29uc3QgU3R5bGVkQnV0dG9uID0gc3R5bGVkLmJ1dHRvbmBcbiAgYmFja2dyb3VuZC1jb2xvcjogdHJhbnNwYXJlbnQ7XG4gIGJvcmRlcjogbm9uZTtcbiAgZGlzcGxheTogZmxleDtcbiAgY3Vyc29yOiBwb2ludGVyO1xuYDtcblxuY29uc3QgU3R5bGVkQ3Jvc3MgPSBzdHlsZWQoQ3Jvc3MpYFxuICBoZWlnaHQ6IDI0cHg7XG4gIHdpZHRoOiAyNHB4O1xuICBjb2xvcjogJHtjb2xvcnMudGV4dC5wcmltYXJ5fTtcbmA7XG5cbmV4cG9ydCBjb25zdCBDbG9zZUJ1dHRvbiA9IChwcm9wczogQnV0dG9uSFRNTEF0dHJpYnV0ZXM8SFRNTEJ1dHRvbkVsZW1lbnQ+KSA9PiB7XG4gIGNvbnN0IHsgdCB9ID0gdXNlVHJhbnNsYXRpb24oKTtcbiAgcmV0dXJuIChcbiAgICA8U3R5bGVkQnV0dG9uIGFyaWEtbGFiZWw9e3QoJ2Nsb3NlJyl9IHsuLi5wcm9wc30+XG4gICAgICA8U3R5bGVkQ3Jvc3MgLz5cbiAgICA8L1N0eWxlZEJ1dHRvbj5cbiAgKTtcbn07XG5cbmV4cG9ydCBkZWZhdWx0IENsb3NlQnV0dG9uO1xuIl19 */"));
|
|
37
|
-
|
|
38
|
-
export var CloseButton = function CloseButton(props) {
|
|
39
|
-
var _useTranslation = useTranslation(),
|
|
40
|
-
t = _useTranslation.t;
|
|
41
|
-
|
|
42
|
-
return ___EmotionJSX(StyledButton, _extends({
|
|
43
|
-
"aria-label": t('close')
|
|
44
|
-
}, props), ___EmotionJSX(StyledCross, null));
|
|
45
|
-
};
|
|
46
|
-
export default CloseButton;
|