@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.
Files changed (76) hide show
  1. package/es/Article/ArticleNotions.js +9 -7
  2. package/es/Figure/Figure.js +6 -5
  3. package/es/Figure/FigureExpandButton.js +6 -6
  4. package/es/Figure/FigureOpenDialogButton.js +45 -0
  5. package/es/Figure/index.js +2 -1
  6. package/es/Image/Image.js +1 -1
  7. package/es/MessageBox/MessageBox.js +8 -8
  8. package/es/Notion/ConceptNotion.js +79 -28
  9. package/es/Notion/FigureNotion.js +5 -6
  10. package/es/Notion/Notion.js +19 -98
  11. package/es/Notion/NotionImage.js +25 -6
  12. package/es/Notion/NotionVisualElement.js +49 -10
  13. package/es/ResourceBox/ResourceBox.js +34 -67
  14. package/es/Topic/Topic.js +21 -21
  15. package/es/all.css +1 -1
  16. package/es/index.js +1 -2
  17. package/es/locale/messages-en.js +1 -1
  18. package/es/locale/messages-nb.js +1 -1
  19. package/es/locale/messages-nn.js +1 -1
  20. package/lib/Article/ArticleNotions.d.ts +2 -1
  21. package/lib/Article/ArticleNotions.js +9 -7
  22. package/lib/Figure/Figure.d.ts +2 -1
  23. package/lib/Figure/Figure.js +6 -5
  24. package/lib/Figure/FigureExpandButton.js +6 -6
  25. package/lib/Figure/FigureOpenDialogButton.d.ts +16 -0
  26. package/lib/Figure/FigureOpenDialogButton.js +57 -0
  27. package/lib/Figure/index.d.ts +1 -0
  28. package/lib/Figure/index.js +8 -0
  29. package/lib/Image/Image.js +1 -1
  30. package/lib/MessageBox/MessageBox.js +9 -9
  31. package/lib/Notion/ConceptNotion.d.ts +6 -7
  32. package/lib/Notion/ConceptNotion.js +84 -30
  33. package/lib/Notion/FigureNotion.d.ts +3 -2
  34. package/lib/Notion/FigureNotion.js +5 -7
  35. package/lib/Notion/Notion.d.ts +1 -12
  36. package/lib/Notion/Notion.js +23 -105
  37. package/lib/Notion/NotionImage.d.ts +2 -1
  38. package/lib/Notion/NotionImage.js +25 -7
  39. package/lib/Notion/NotionVisualElement.d.ts +6 -7
  40. package/lib/Notion/NotionVisualElement.js +48 -18
  41. package/lib/ResourceBox/ResourceBox.js +34 -63
  42. package/lib/Topic/Topic.js +21 -21
  43. package/lib/all.css +1 -1
  44. package/lib/index.d.ts +1 -2
  45. package/lib/index.js +7 -9
  46. package/lib/locale/messages-en.js +1 -1
  47. package/lib/locale/messages-nb.js +1 -1
  48. package/lib/locale/messages-nn.js +1 -1
  49. package/package.json +10 -9
  50. package/src/Article/ArticleNotions.tsx +3 -2
  51. package/src/Figure/Figure.tsx +49 -41
  52. package/src/Figure/FigureExpandButton.tsx +4 -4
  53. package/src/Figure/FigureOpenDialogButton.tsx +37 -0
  54. package/src/Figure/component.figure.scss +4 -0
  55. package/src/Figure/index.ts +1 -0
  56. package/src/Image/Image.tsx +1 -1
  57. package/src/MessageBox/MessageBox.tsx +1 -1
  58. package/src/Notion/ConceptNotion.tsx +136 -37
  59. package/src/Notion/FigureNotion.tsx +6 -6
  60. package/src/Notion/Notion.tsx +7 -145
  61. package/src/Notion/NotionImage.tsx +44 -15
  62. package/src/Notion/NotionVisualElement.tsx +35 -8
  63. package/src/ResourceBox/ResourceBox.tsx +47 -102
  64. package/src/Topic/Topic.tsx +1 -1
  65. package/src/index.ts +2 -2
  66. package/src/locale/messages-en.ts +1 -1
  67. package/src/locale/messages-nb.ts +1 -1
  68. package/src/locale/messages-nn.ts +1 -1
  69. package/es/CloseButton/CloseButton.js +0 -46
  70. package/es/CloseButton/index.js +0 -10
  71. package/lib/CloseButton/CloseButton.d.ts +0 -10
  72. package/lib/CloseButton/CloseButton.js +0 -54
  73. package/lib/CloseButton/index.d.ts +0 -10
  74. package/lib/CloseButton/index.js +0 -26
  75. package/src/CloseButton/CloseButton.tsx +0 -36
  76. package/src/CloseButton/index.ts +0 -13
@@ -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 React, { Fragment, ReactNode } from 'react';
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.serif};
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?: VisualElementProps;
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 && visualElement.metaImage && (
193
- <ImageWrapper>
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, FigureExpandButton } from '..';
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
- <Image
36
- alt={alt}
37
- src={src}
38
- expandButton={
39
- <FigureExpandButton
40
- typeClass={typeClass}
41
- messages={{
42
- zoomImageButtonLabel: t('license.images.itemImage.zoomImageButtonLabel'),
43
- zoomOutImageButtonLabel: t('license.image.itemImage.zoomOutImageButtonLabel'),
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 React from 'react';
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 supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external'];
28
- const NotionVisualElement = ({ visualElement }: Props) => {
29
- const id = '1';
30
- const figureId = 'figure-1';
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 === 'brightcove' ? 'video' : 'h5p';
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
- <iframe title={visualElement.title} src={visualElement.url} />
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 BoxWrapper = styled.div`
18
+ const ResourceBoxContainer = styled.div`
19
19
  display: flex;
20
- padding-top: 20px;
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: 1px;
29
+ gap: 0;
35
30
  flex-direction: column;
36
- margin: 0 auto;
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 Boxtitle = styled.h3`
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 Boxcaption = styled.p`
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 StyledButtonDiv = styled.div`
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
- padding-bottom: 10px;
70
- margin: 0 auto;
56
+ align-items: center;
57
+ padding-top: 10px;
71
58
  }
72
59
  `;
73
- const ResourceBoxStyledButton = styled(SafeLinkButton)`
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
- const ResourceBoxLaunchIcon = styled(Launch)`
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 BoxImage = styled(Image)`
90
- object-fit: cover;
91
- width: 134px;
92
- height: 134px;
93
- border-radius: 5px;
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
- const TitleAndLicence = styled.div`
129
- display: flex;
130
- justify-content: space-between;
131
- ${mq.range({ until: breakpoints.desktop })} {
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
- <BoxWrapper>
161
- <ImageSectionWrapper>
162
- <BoxImage alt={title} src={image} sizes="25, 25" />
163
- </ImageSectionWrapper>
164
- <CenterItems>
165
- <CaptionSectionWrapper>
166
- <TitleAndLicence>
167
- <Boxtitle>{title}</Boxtitle>
168
- <LincenseWrapper>
169
- <LicenseByline licenseRights={licenseRights} locale={locale} marginRight color={colors.brand.tertiary}>
170
- <div className="c-figure__byline-author-buttons">
171
- <span className="c-figure__byline-authors">{authors?.map((author) => author.name).join(' ')}</span>
172
- </div>
173
- </LicenseByline>
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
- <StyledButtonDiv>
180
- <ResourceBoxStyledButton to={url} target="_blank" outline borderShape="rounded">
181
- {t('license.other.itemImage.ariaLabel')}
182
- <ResourceBoxLaunchIcon aria-hidden />
183
- </ResourceBoxStyledButton>
184
- </StyledButtonDiv>
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
 
@@ -277,7 +277,7 @@ const Topic = ({
277
277
  <ShowVisualElementWrapper>
278
278
  <TopicHeaderImage
279
279
  src={`${topic.image.url}?${makeSrcQueryString(
280
- 400,
280
+ 800,
281
281
  topic.image.crop,
282
282
  topic.image.focalPoint,
283
283
  )}`}
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';
@@ -413,7 +413,7 @@ const messages = {
413
413
  images: 'Images',
414
414
  audio: 'Audio',
415
415
  video: 'Video',
416
- h5p: 'H5P',
416
+ h5p: 'h5p',
417
417
  files: 'Files',
418
418
  embedlink: 'Embedded link',
419
419
  other: 'Other content',
@@ -426,7 +426,7 @@ const messages = {
426
426
  images: 'Bilder',
427
427
  audio: 'Lyd',
428
428
  video: 'Video',
429
- h5p: 'H5P',
429
+ h5p: 'h5p',
430
430
  files: 'Filer',
431
431
  embedlink: 'Innbyggingslenke',
432
432
  concept: 'Forklaringer',
@@ -427,7 +427,7 @@ const messages = {
427
427
  images: 'Bilete',
428
428
  audio: 'Lyd',
429
429
  video: 'Video',
430
- h5p: 'H5P',
430
+ h5p: 'h5p',
431
431
  files: 'Filer',
432
432
  embedlink: 'Innbyggingslenke',
433
433
  other: 'Anna innhald',
@@ -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;