@ndla/ui 4.3.0 → 4.3.3-alpha.12

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 (199) hide show
  1. package/README.md +11 -11
  2. package/es/Article/Article.js +3 -7
  3. package/es/Article/ArticleByline.js +4 -4
  4. package/es/Article/ArticleNotions.js +37 -92
  5. package/es/ContentPlaceholder/ContentPlaceholder.js +51 -0
  6. package/es/ContentPlaceholder/index.js +9 -0
  7. package/es/ContentTypeBadge/ContentTypeBadge.js +10 -1
  8. package/es/FactBox/FactBox.js +36 -11
  9. package/es/Filter/FilterButtons.js +18 -17
  10. package/es/Filter/FilterCarousel.js +198 -0
  11. package/es/Masthead/Masthead.js +30 -7
  12. package/es/Masthead/index.js +2 -1
  13. package/es/Masthead/utils.js +11 -0
  14. package/es/MessageBox/MessageBox.js +12 -7
  15. package/es/Notion/ConceptNotion.js +57 -0
  16. package/es/Notion/FigureNotion.js +84 -0
  17. package/es/Notion/Notion.js +122 -48
  18. package/es/Notion/NotionImage.js +47 -0
  19. package/es/Notion/NotionVisualElement.js +38 -0
  20. package/es/Notion/index.js +2 -1
  21. package/es/SearchTypeResult/ActiveFilterContent.js +17 -2
  22. package/es/SearchTypeResult/ActiveFilters.js +64 -50
  23. package/es/SearchTypeResult/PopupFilter.js +28 -125
  24. package/es/SearchTypeResult/ResultNavigation.js +41 -14
  25. package/es/SearchTypeResult/SearchFieldHeader.js +20 -41
  26. package/es/SearchTypeResult/SearchFilterContent.js +61 -0
  27. package/es/SearchTypeResult/SearchHeader.js +51 -28
  28. package/es/SearchTypeResult/SearchItem.js +64 -190
  29. package/es/SearchTypeResult/SearchItemList.js +132 -0
  30. package/es/SearchTypeResult/SearchItems.js +17 -13
  31. package/es/SearchTypeResult/SearchNotionItem.js +13 -13
  32. package/es/SearchTypeResult/SearchNotionsResult.js +16 -21
  33. package/es/SearchTypeResult/SearchTypeHeader.js +43 -26
  34. package/es/SearchTypeResult/SearchTypeResult.js +7 -5
  35. package/es/SearchTypeResult/SearchViewType.js +93 -0
  36. package/es/SearchTypeResult/components/ItemContexts.js +125 -0
  37. package/es/SearchTypeResult/components/ItemResourceHeader.js +87 -0
  38. package/es/SearchTypeResult/components/ItemTopicHeader.js +56 -0
  39. package/es/SearchTypeResult/components/SubjectFilters.js +177 -0
  40. package/es/SearchTypeResult/index.js +2 -1
  41. package/es/all.css +1 -1
  42. package/es/index-javascript.js +1 -2
  43. package/es/index.js +5 -3
  44. package/es/locale/messages-en.js +21 -6
  45. package/es/locale/messages-nb.js +21 -6
  46. package/es/locale/messages-nn.js +22 -7
  47. package/es/model/ContentType.js +2 -1
  48. package/es/shapes.js +1 -1
  49. package/lib/Article/Article.d.ts +4 -5
  50. package/lib/Article/Article.js +3 -7
  51. package/lib/Article/ArticleByline.js +4 -4
  52. package/lib/Article/ArticleNotions.d.ts +3 -8
  53. package/lib/Article/ArticleNotions.js +41 -90
  54. package/lib/ContentPlaceholder/ContentPlaceholder.d.ts +9 -0
  55. package/lib/ContentPlaceholder/ContentPlaceholder.js +54 -0
  56. package/lib/ContentPlaceholder/index.d.ts +9 -0
  57. package/lib/ContentPlaceholder/index.js +20 -0
  58. package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +1 -0
  59. package/lib/ContentTypeBadge/ContentTypeBadge.js +14 -2
  60. package/lib/FactBox/FactBox.js +41 -8
  61. package/lib/Filter/FilterButtons.d.ts +3 -10
  62. package/lib/Filter/FilterButtons.js +19 -17
  63. package/lib/Filter/FilterCarousel.d.ts +13 -0
  64. package/lib/Filter/FilterCarousel.js +207 -0
  65. package/lib/Masthead/Masthead.d.ts +3 -3
  66. package/lib/Masthead/Masthead.js +37 -7
  67. package/lib/Masthead/index.d.ts +2 -1
  68. package/lib/Masthead/index.js +8 -0
  69. package/lib/Masthead/utils.d.ts +8 -0
  70. package/lib/Masthead/utils.js +20 -0
  71. package/lib/MessageBox/MessageBox.d.ts +2 -1
  72. package/lib/MessageBox/MessageBox.js +12 -7
  73. package/lib/Notion/ConceptNotion.d.ts +25 -0
  74. package/lib/Notion/ConceptNotion.js +79 -0
  75. package/lib/Notion/FigureNotion.d.ts +23 -0
  76. package/lib/Notion/FigureNotion.js +99 -0
  77. package/lib/Notion/Notion.d.ts +24 -11
  78. package/lib/Notion/Notion.js +120 -48
  79. package/lib/Notion/NotionImage.d.ts +15 -0
  80. package/lib/Notion/NotionImage.js +63 -0
  81. package/lib/Notion/NotionVisualElement.d.ts +22 -0
  82. package/lib/Notion/NotionVisualElement.js +51 -0
  83. package/lib/Notion/index.d.ts +1 -0
  84. package/lib/Notion/index.js +8 -0
  85. package/lib/SearchTypeResult/ActiveFilterContent.js +16 -9
  86. package/lib/SearchTypeResult/ActiveFilters.d.ts +2 -1
  87. package/lib/SearchTypeResult/ActiveFilters.js +65 -50
  88. package/lib/SearchTypeResult/PopupFilter.d.ts +13 -19
  89. package/lib/SearchTypeResult/PopupFilter.js +27 -123
  90. package/lib/SearchTypeResult/ResultNavigation.d.ts +2 -2
  91. package/lib/SearchTypeResult/ResultNavigation.js +38 -14
  92. package/lib/SearchTypeResult/SearchFieldHeader.d.ts +3 -8
  93. package/lib/SearchTypeResult/SearchFieldHeader.js +18 -39
  94. package/lib/SearchTypeResult/SearchFilterContent.d.ts +16 -0
  95. package/lib/SearchTypeResult/SearchFilterContent.js +67 -0
  96. package/lib/SearchTypeResult/SearchHeader.d.ts +3 -7
  97. package/lib/SearchTypeResult/SearchHeader.js +59 -30
  98. package/lib/SearchTypeResult/SearchItem.d.ts +8 -12
  99. package/lib/SearchTypeResult/SearchItem.js +64 -187
  100. package/lib/SearchTypeResult/SearchItemList.d.ts +10 -0
  101. package/lib/SearchTypeResult/SearchItemList.js +139 -0
  102. package/lib/SearchTypeResult/SearchItems.d.ts +4 -3
  103. package/lib/SearchTypeResult/SearchItems.js +18 -13
  104. package/lib/SearchTypeResult/SearchNotionItem.js +13 -13
  105. package/lib/SearchTypeResult/SearchNotionsResult.d.ts +2 -4
  106. package/lib/SearchTypeResult/SearchNotionsResult.js +23 -23
  107. package/lib/SearchTypeResult/SearchTypeHeader.d.ts +2 -2
  108. package/lib/SearchTypeResult/SearchTypeHeader.js +40 -25
  109. package/lib/SearchTypeResult/SearchTypeResult.d.ts +7 -6
  110. package/lib/SearchTypeResult/SearchTypeResult.js +7 -5
  111. package/lib/SearchTypeResult/SearchViewType.d.ts +13 -0
  112. package/lib/SearchTypeResult/SearchViewType.js +99 -0
  113. package/lib/SearchTypeResult/components/ItemContexts.d.ts +19 -0
  114. package/lib/SearchTypeResult/components/ItemContexts.js +134 -0
  115. package/lib/SearchTypeResult/components/ItemResourceHeader.d.ts +16 -0
  116. package/lib/SearchTypeResult/components/ItemResourceHeader.js +98 -0
  117. package/lib/SearchTypeResult/components/ItemTopicHeader.d.ts +17 -0
  118. package/lib/SearchTypeResult/components/ItemTopicHeader.js +67 -0
  119. package/lib/SearchTypeResult/components/SubjectFilters.d.ts +32 -0
  120. package/lib/SearchTypeResult/components/SubjectFilters.js +192 -0
  121. package/lib/SearchTypeResult/index.d.ts +2 -1
  122. package/lib/SearchTypeResult/index.js +8 -0
  123. package/lib/all.css +1 -1
  124. package/lib/index-javascript.js +0 -20
  125. package/lib/index.d.ts +4 -2
  126. package/lib/index.js +40 -1
  127. package/lib/locale/messages-en.d.ts +16 -1
  128. package/lib/locale/messages-en.js +21 -6
  129. package/lib/locale/messages-nb.d.ts +15 -0
  130. package/lib/locale/messages-nb.js +21 -6
  131. package/lib/locale/messages-nn.d.ts +16 -1
  132. package/lib/locale/messages-nn.js +22 -7
  133. package/lib/model/ContentType.d.ts +1 -0
  134. package/lib/model/ContentType.js +4 -2
  135. package/lib/shapes.js +1 -1
  136. package/lib/types.d.ts +1 -0
  137. package/package.json +14 -15
  138. package/src/Article/Article.tsx +8 -15
  139. package/src/Article/ArticleByline.tsx +1 -1
  140. package/src/Article/ArticleNotions.tsx +13 -33
  141. package/src/ContentPlaceholder/ContentPlaceholder.tsx +68 -0
  142. package/src/ContentPlaceholder/index.ts +11 -0
  143. package/src/ContentTypeBadge/ContentTypeBadge.tsx +8 -0
  144. package/src/ContentTypeBadge/component.content-type-badge.scss +5 -0
  145. package/src/FactBox/FactBox.tsx +22 -15
  146. package/src/Figure/component.figure.scss +1 -1
  147. package/src/Filter/FilterButtons.tsx +14 -15
  148. package/src/Filter/FilterCarousel.tsx +166 -0
  149. package/src/Masthead/Masthead.tsx +45 -20
  150. package/src/Masthead/component.masthead.scss +3 -62
  151. package/src/Masthead/index.ts +3 -1
  152. package/src/Masthead/utils.ts +12 -0
  153. package/src/MessageBox/MessageBox.tsx +4 -1
  154. package/src/Notion/ConceptNotion.tsx +80 -0
  155. package/src/Notion/FigureNotion.tsx +88 -0
  156. package/src/Notion/Notion.tsx +205 -75
  157. package/src/Notion/NotionImage.tsx +51 -0
  158. package/src/Notion/NotionVisualElement.tsx +50 -0
  159. package/src/Notion/index.ts +1 -0
  160. package/src/SearchTypeResult/ActiveFilterContent.tsx +7 -2
  161. package/src/SearchTypeResult/ActiveFilters.tsx +72 -38
  162. package/src/SearchTypeResult/PopupFilter.tsx +73 -146
  163. package/src/SearchTypeResult/ResultNavigation.tsx +54 -16
  164. package/src/SearchTypeResult/SearchFieldHeader.tsx +15 -40
  165. package/src/SearchTypeResult/SearchFilterContent.tsx +63 -0
  166. package/src/SearchTypeResult/SearchHeader.tsx +31 -31
  167. package/src/SearchTypeResult/SearchItem.tsx +145 -233
  168. package/src/SearchTypeResult/SearchItemList.tsx +167 -0
  169. package/src/SearchTypeResult/SearchItems.tsx +26 -19
  170. package/src/SearchTypeResult/SearchNotionItem.tsx +5 -12
  171. package/src/SearchTypeResult/SearchNotionsResult.tsx +29 -22
  172. package/src/SearchTypeResult/SearchTypeHeader.tsx +51 -33
  173. package/src/SearchTypeResult/SearchTypeResult.tsx +13 -12
  174. package/src/SearchTypeResult/SearchViewType.tsx +109 -0
  175. package/src/SearchTypeResult/components/ItemContexts.tsx +138 -0
  176. package/src/SearchTypeResult/components/ItemResourceHeader.tsx +133 -0
  177. package/src/SearchTypeResult/components/ItemTopicHeader.tsx +95 -0
  178. package/src/SearchTypeResult/components/SubjectFilters.tsx +152 -0
  179. package/src/SearchTypeResult/index.ts +9 -1
  180. package/src/index-javascript.js +0 -2
  181. package/src/index.ts +5 -1
  182. package/src/locale/messages-en.ts +19 -4
  183. package/src/locale/messages-nb.ts +19 -4
  184. package/src/locale/messages-nn.ts +20 -5
  185. package/src/model/ContentType.ts +1 -0
  186. package/src/shapes.js +1 -0
  187. package/src/types.ts +1 -0
  188. package/es/Embedded/Facebook.js +0 -19
  189. package/es/Embedded/FacebookPage.js +0 -22
  190. package/es/Embedded/Twitter.js +0 -121
  191. package/es/Embedded/index.js +0 -3
  192. package/lib/Embedded/Facebook.js +0 -32
  193. package/lib/Embedded/FacebookPage.js +0 -35
  194. package/lib/Embedded/Twitter.js +0 -132
  195. package/lib/Embedded/index.js +0 -31
  196. package/src/Embedded/Facebook.jsx +0 -17
  197. package/src/Embedded/FacebookPage.jsx +0 -24
  198. package/src/Embedded/Twitter.jsx +0 -71
  199. package/src/Embedded/index.js +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "4.3.0",
3
+ "version": "4.3.3-alpha.12+22d4e1c49",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,18 +31,18 @@
31
31
  "types"
32
32
  ],
33
33
  "dependencies": {
34
- "@ndla/button": "^2.1.0",
35
- "@ndla/carousel": "^1.2.0",
36
- "@ndla/core": "^1.0.0",
37
- "@ndla/hooks": "^1.1.0",
38
- "@ndla/icons": "^1.6.0",
39
- "@ndla/licenses": "^2.2.0",
40
- "@ndla/modal": "^1.2.0",
41
- "@ndla/safelink": "^1.1.0",
42
- "@ndla/switch": "^0.1.0",
43
- "@ndla/tabs": "^1.1.0",
44
- "@ndla/tooltip": "^0.3.0",
45
- "@ndla/util": "^2.0.2",
34
+ "@ndla/button": "^2.1.1-alpha.20+22d4e1c49",
35
+ "@ndla/carousel": "^1.2.1-alpha.20+22d4e1c49",
36
+ "@ndla/core": "^1.0.1-alpha.20+22d4e1c49",
37
+ "@ndla/hooks": "^1.1.1-alpha.20+22d4e1c49",
38
+ "@ndla/icons": "^1.6.1-alpha.20+22d4e1c49",
39
+ "@ndla/licenses": "^3.0.2-alpha.12+22d4e1c49",
40
+ "@ndla/modal": "^1.2.1-alpha.20+22d4e1c49",
41
+ "@ndla/safelink": "^1.1.1-alpha.20+22d4e1c49",
42
+ "@ndla/switch": "^0.1.1-alpha.20+22d4e1c49",
43
+ "@ndla/tabs": "^1.1.1-alpha.20+22d4e1c49",
44
+ "@ndla/tooltip": "^0.3.1-alpha.20+22d4e1c49",
45
+ "@ndla/util": "^2.0.3-alpha.64+22d4e1c49",
46
46
  "@reach/menu-button": "^0.16.2",
47
47
  "@reach/slider": "^0.16.0",
48
48
  "focus-trap-react": "^8.9.2",
@@ -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-facebook": "^6.0.15",
58
57
  "react-sticky-el": "^2.0.6",
59
58
  "react-swipeable": "^6.2.0",
60
59
  "react-transition-group": "^2.5.3",
@@ -82,5 +81,5 @@
82
81
  "publishConfig": {
83
82
  "access": "public"
84
83
  },
85
- "gitHead": "7d6db8f3945947b35bdbb3c38229dec942d43ec1"
84
+ "gitHead": "22d4e1c498b4c967fa6463ce0a8b8ee3bbd2336e"
86
85
  }
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import React, { ComponentType, ReactNode, useEffect, useRef, useState, forwardRef, MouseEventHandler } from 'react';
9
+ import React, { ComponentType, ReactNode, useEffect, useRef, useState, forwardRef } from 'react';
10
10
  import BEMHelper from 'react-bem-helper';
11
11
  import isString from 'lodash/isString';
12
12
  import parse from 'html-react-parser';
@@ -21,9 +21,9 @@ import ArticleByline from './ArticleByline';
21
21
  import LayoutItem from '../Layout';
22
22
  import ArticleHeaderWrapper from './ArticleHeaderWrapper';
23
23
  import ArticleNotions, { NotionRelatedContent } from './ArticleNotions';
24
- import { NotionProps } from '../Notion/Notion';
25
24
  import ArticleAccessMessage from './ArticleAccessMessage';
26
25
  import MessageBox from '../MessageBox/MessageBox';
26
+ import { ConceptNotionType } from '../Notion/ConceptNotion';
27
27
 
28
28
  const classes = new BEMHelper({
29
29
  name: 'article',
@@ -114,8 +114,7 @@ type Props = {
114
114
  renderMarkdown: (text: string) => string;
115
115
  copyPageUrlLink?: string;
116
116
  printUrl?: string;
117
- notions?: { list: NotionProps[]; related: NotionRelatedContent[] };
118
- onReferenceClick?: MouseEventHandler;
117
+ notions?: { list: ConceptNotionType[]; related: NotionRelatedContent[] };
119
118
  accessMessage?: string;
120
119
  };
121
120
 
@@ -144,7 +143,6 @@ export const Article = ({
144
143
  id,
145
144
  locale,
146
145
  notions,
147
- onReferenceClick,
148
146
  printUrl,
149
147
  renderMarkdown,
150
148
  accessMessage,
@@ -207,16 +205,11 @@ export const Article = ({
207
205
  </LayoutItem>
208
206
  <LayoutItem layout="center">
209
207
  {notions && showExplainNotions && (
210
- <>
211
- <ArticleNotions
212
- locale={locale}
213
- notions={notions.list}
214
- onReferenceClick={onReferenceClick}
215
- relatedContent={notions.related}
216
- renderMarkdown={renderMarkdown}
217
- buttonOffsetRight={articlePositionRight}
218
- />
219
- </>
208
+ <ArticleNotions
209
+ notions={notions.list}
210
+ relatedContent={notions.related}
211
+ buttonOffsetRight={articlePositionRight}
212
+ />
220
213
  )}
221
214
  {getArticleContent(content, locale)}
222
215
  </LayoutItem>
@@ -21,7 +21,7 @@ const Wrapper = styled.div`
21
21
  margin-top: ${spacing.normal};
22
22
  padding-top: ${spacing.normal};
23
23
  padding-bottom: ${spacing.xsmall};
24
- border-top: 2px solid ${colors.brand.greyLighter};
24
+ border-top: 1px solid ${colors.brand.greyLight};
25
25
  ${fonts.sizes('14px', '18px')};
26
26
  font-family: ${fonts.sans};
27
27
  color: ${colors.brand.greyDark};
@@ -6,15 +6,14 @@
6
6
  *
7
7
  */
8
8
 
9
- import React, { MouseEventHandler } from 'react';
9
+ import React from 'react';
10
10
  import styled from '@emotion/styled';
11
11
  import { useTranslation } from 'react-i18next';
12
12
  import Modal, { ModalHeader, ModalCloseButton, ModalBody } from '@ndla/modal';
13
- import { mq, breakpoints } from '@ndla/core';
14
- import { Explanation } from '@ndla/icons/common';
15
- import { Locale } from '../types';
16
- import { Notion } from '../Notion';
17
- import { NotionProps } from '../Notion/Notion';
13
+ import { mq, breakpoints, fonts, colors } from '@ndla/core';
14
+ import { Explanation, NotionFlip } from '@ndla/icons/common';
15
+ import { ConceptNotion } from '../Notion';
16
+ import { ConceptNotionType } from '../Notion/ConceptNotion';
18
17
 
19
18
  const ArticleNotionsContainer = styled.div`
20
19
  margin-bottom: 26px;
@@ -23,7 +22,6 @@ const ArticleNotionsContainer = styled.div`
23
22
  margin-bottom: 0;
24
23
  }
25
24
  `;
26
- /* Stored for later
27
25
 
28
26
  const NotionsTrigger = styled.div`
29
27
  padding: 0 16px;
@@ -32,7 +30,7 @@ const NotionsTrigger = styled.div`
32
30
  background-color: ${colors.brand.greyLighter};
33
31
  border-radius: 4px;
34
32
  cursor: pointer;
35
-
33
+
36
34
  ${mq.range({ from: breakpoints.tablet })} {
37
35
  position: fixed;
38
36
  border: none;
@@ -80,7 +78,7 @@ const NotionsTrigger = styled.div`
80
78
  }
81
79
  }
82
80
  `;
83
- */
81
+
84
82
  const ModalHeadingContainer = styled.div`
85
83
  display: flex;
86
84
  align-items: center;
@@ -158,36 +156,24 @@ export type NotionRelatedContent = {
158
156
  };
159
157
 
160
158
  type ArticleNotionsProps = {
161
- locale: Locale;
162
- notions: NotionProps[];
163
- onReferenceClick?: MouseEventHandler<HTMLButtonElement>;
159
+ notions: ConceptNotionType[];
164
160
  relatedContent?: NotionRelatedContent[];
165
- renderMarkdown?: (text: string) => string;
166
161
  buttonOffsetRight: number;
167
162
  };
168
163
 
169
- export const ArticleNotions = ({
170
- locale,
171
- notions,
172
- onReferenceClick,
173
- relatedContent = [],
174
- renderMarkdown,
175
- buttonOffsetRight,
176
- }: ArticleNotionsProps) => {
164
+ export const ArticleNotions = ({ notions, relatedContent = [], buttonOffsetRight }: ArticleNotionsProps) => {
177
165
  const { t } = useTranslation();
178
- //const leftOffset = `${buttonOffsetRight - 32}px`;
166
+ const leftOffset = `${buttonOffsetRight - 32}px`;
179
167
  return (
180
168
  <ArticleNotionsContainer>
181
169
  <Modal
182
- /* Stored for later
183
-
184
- activateButton={
170
+ activateButton={
185
171
  <NotionsTrigger role="button" aria-label={t('article.notionsPrompt')} style={{ left: leftOffset }}>
186
172
  <NotionFlip />
187
173
  <Explanation />
188
174
  <span>{t('article.notionsPrompt')}</span>
189
175
  </NotionsTrigger>
190
- } */
176
+ }
191
177
  size="large"
192
178
  backgroundColor="white">
193
179
  {(onClose: () => void) => (
@@ -202,13 +188,7 @@ export const ArticleNotions = ({
202
188
  </ModalHeadingContainer>
203
189
  <NotionsContainer>
204
190
  {notions.map((notion) => (
205
- <Notion
206
- key={notion.id}
207
- locale={locale}
208
- onReferenceClick={onReferenceClick}
209
- renderMarkdown={renderMarkdown}
210
- {...notion}
211
- />
191
+ <ConceptNotion key={notion.id} concept={notion} />
212
192
  ))}
213
193
  </NotionsContainer>
214
194
  {relatedContent.length > 0 && (
@@ -0,0 +1,68 @@
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 React from 'react';
10
+ import styled from '@emotion/styled';
11
+ import { colors } from '@ndla/core';
12
+
13
+ const Wrapper = styled.div`
14
+ position: fixed;
15
+ z-index: 98;
16
+ top: 0;
17
+ left: 0;
18
+ right: 0;
19
+ `;
20
+
21
+ const Background = styled.div`
22
+ height: 100vh;
23
+ width: 100vw;
24
+ background-color: ${colors.brand.greyLightest};
25
+ `;
26
+
27
+ const Placeholder = styled.div`
28
+ position: absolute;
29
+ display: block;
30
+ height: 100vh;
31
+ width: 100vw;
32
+ margin-top: 86px;
33
+ background-position-x: center;
34
+ background-position-y: 65px;
35
+ background-repeat: no-repeat;
36
+ animation-name: pulseAnimation;
37
+ animation-duration: 1.6s;
38
+ animation-timing-function: ease-in-out;
39
+ animation-iteration-count: infinite;
40
+ @media (max-width: 476px) {
41
+ background-size: 280px 609px;
42
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIyODBweCIgaGVpZ2h0PSI2MDlweCIgdmlld0JveD0iMCAwIDI4MCA2MDkiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+R3JvdXA8L3RpdGxlPiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4gICAgPGRlZnM+PC9kZWZzPiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4gICAgICAgIDxnIGlkPSJ0aW55IiBmaWxsPSIjRTZFNkU2IiBmaWxsLXJ1bGU9Im5vbnplcm8iPiAgICAgICAgICAgIDxnIGlkPSJHcm91cCI+ICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMiIgeD0iMCIgeT0iMjEiIHdpZHRoPSIxNjQuMzA1NTU2IiBoZWlnaHQ9IjMyIj48L3JlY3Q+ICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMiIgeD0iMCIgeT0iMCIgd2l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ICAgICAgICAgICAgPC9nPiAgICAgICAgPC9nPiAgICA8L2c+PC9zdmc+);
43
+ }
44
+ @media (min-width: 476px) {
45
+ background-size: 375px 848px;
46
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIzNzVweCIgaGVpZ2h0PSI4NDhweCIgdmlld0JveD0iMCAwIDM3NSA4NDgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+R3JvdXA8L3RpdGxlPiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4gICAgPGRlZnM+PC9kZWZzPiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4gICAgICAgIDxnIGlkPSJzbWFsbCIgZmlsbD0iI0U2RTZFNiIgZmlsbC1ydWxlPSJub256ZXJvIj4gICAgICAgICAgICA8ZyBpZD0iR3JvdXAiPiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTIiIHg9IjAiIHk9IjI3IiB3aWR0aD0iMjIwLjU4ODIzNSIgaGVpZ2h0PSI0MiI+PC9yZWN0PiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTIiIHg9IjAiIHk9IjAiIHdpZHRoPSI1NC4xNDQzODUiIGhlaWdodD0iMjEiPjwvcmVjdD4gICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yIiB4PSIwIiB5PSIyMTUiIHdpZHRoPSIxMTAuMjk0MTE4IiBoZWlnaHQ9IjIxIj48L3JlY3Q+ICAgICAgICAgICAgICAgID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2xlLTIiIHg9IjAiIHk9IjgyNCIgd2lkdGg9IjI1Ny42ODcxNjYiIGhlaWdodD0iMjQiPjwvcmVjdD4gICAgICAgICAgICA8L2c+ICAgICAgICA8L2c+ICAgIDwvZz48L3N2Zz4=);
47
+ }
48
+ @media (min-width: 601px) {
49
+ background-position-y: 95px;
50
+ background-size: 530px 848px;
51
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSI1MzBweCIgaGVpZ2h0PSI4NDhweCIgdmlld0JveD0iMCAwIDUzMCA4NDgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+R3JvdXA8L3RpdGxlPiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4gICAgPGRlZnM+PC9kZWZzPiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4gICAgICAgIDxnIGlkPSJhcnRpY2xlLW1lZGl1bSIgZmlsbD0iI0U2RTZFNiIgZmlsbC1ydWxlPSJub256ZXJvIj4gICAgICAgICAgICA8ZyBpZD0iR3JvdXAiPiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTIiIHg9IjAiIHk9IjI3IiB3aWR0aD0iMzExIiBoZWlnaHQ9IjQyIj48L3JlY3Q+ICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMiIgeD0iMCIgeT0iMCIgd2lkdGg9Ijc3IiBoZWlnaHQ9IjIxIj48L3JlY3Q+ICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMi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jdD4gICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yIiB4PSIwIiB5PSI4MjQiIHdpZHRoPSIzNjMiIGhlaWdodD0iMjQiPjwvcmVjdD4gICAgICAgICAgICA8L2c+ICAgICAgICA8L2c+ICAgIDwvZz48L3N2Zz4=);
52
+ }
53
+ @media (min-width: 768px) {
54
+ background-size: 624px 848px;
55
+ background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSI2MjRweCIgaGVpZ2h0PSI4NDhweCIgdmlld0JveD0iMCAwIDYyNCA4NDgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+R3JvdXA8L3RpdGxlPiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4gICAgPGRlZnM+PC9kZWZzPiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4gICAgICAgIDxnIGlkPSJhcnRpY2xlLWxhcmdlIiBmaWxsPSIjRTZFNkU2IiBmaWxsLXJ1bGU9Im5vbnplcm8iPiAgICAgICAgICAgIDxnIGlkPSJHcm91cCI+ICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMiIgeD0iMCIgeT0iMjciIHdpZHRoPSIzMjYiIGhlaWdodD0iNDIiPjwvcmVjdD4gICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yIiB4PSIwIiB5PSIwIiB3aWR0aD0iODEiIGhlaWdodD0iMjEiPjwvcmVjdD4gICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY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IjYyNCIgaGVpZ2h0PSIyNCI+PC9yZWN0PiAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTIiIHg9IjAiIHk9IjgyNCIgd2lkdGg9IjM4MC42NCIgaGVpZ2h0PSIyNCI+PC9yZWN0PiAgICAgICAgICAgIDwvZz4gICAgICAgIDwvZz4gICAgPC9nPjwvc3ZnPg==);
56
+ }
57
+ `;
58
+
59
+ const ContentPlaceholder = () => {
60
+ return (
61
+ <Wrapper>
62
+ <Placeholder />
63
+ <Background />
64
+ </Wrapper>
65
+ );
66
+ };
67
+
68
+ export default ContentPlaceholder;
@@ -0,0 +1,11 @@
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 ContentPlaceholder from './ContentPlaceholder';
10
+
11
+ export default ContentPlaceholder;
@@ -10,6 +10,7 @@ import {
10
10
  ExternalLearningResource,
11
11
  SharedResource,
12
12
  LearningPath,
13
+ MultidisciplinaryTopic,
13
14
  } from '@ndla/icons/contentType';
14
15
 
15
16
  import { MenuBook } from '@ndla/icons/action';
@@ -67,6 +68,9 @@ export const ContentTypeBadge = ({ type, background, title, size = 'small', bord
67
68
  case contentTypes.TOPIC:
68
69
  icon = <Subject title={title} />;
69
70
  break;
71
+ case contentTypes.MULTIDISCIPLINARY_TOPIC:
72
+ icon = <MultidisciplinaryTopic />;
73
+ break;
70
74
  default:
71
75
  break;
72
76
  }
@@ -106,3 +110,7 @@ export const SourceMaterialBadge = (props: Omit<Props, 'type'>) => (
106
110
  export const LearningPathBadge = (props: Omit<Props, 'type'>) => (
107
111
  <ContentTypeBadge {...props} type={contentTypes.LEARNING_PATH} />
108
112
  );
113
+
114
+ export const MultidisciplinaryTopicBadge = (props: Omit<Props, 'type'>) => (
115
+ <ContentTypeBadge {...props} type={contentTypes.MULTIDISCIPLINARY_TOPIC} />
116
+ );
@@ -165,6 +165,11 @@
165
165
  background: $subjecttype-background;
166
166
  }
167
167
  }
168
+ &--multidisciplinary-topic{
169
+ &.c-content-type-badge--background {
170
+ background: #B9B37B;
171
+ }
172
+ }
168
173
 
169
174
  &--large {
170
175
  width: 50px;
@@ -6,15 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
- import React, { ReactNode, MouseEvent } from 'react';
9
+ import React, { ReactNode, MouseEvent, useState } from 'react';
10
10
  import BEMHelper from 'react-bem-helper';
11
11
  import Button from '@ndla/button';
12
-
13
- const toggleFactBox = (event: MouseEvent<HTMLButtonElement>) => {
14
- const button = event.currentTarget;
15
- const aside = button?.previousSibling?.parentElement;
16
- aside?.classList?.toggle('expanded');
17
- };
12
+ import { useTranslation } from 'react-i18next';
18
13
 
19
14
  const classes = new BEMHelper({
20
15
  name: 'factbox',
@@ -26,13 +21,25 @@ interface Props {
26
21
  children?: ReactNode;
27
22
  }
28
23
 
29
- const FactBox = ({ children, dangerouslySetInnerHTML }: Props) => (
30
- <aside {...classes()}>
31
- <div {...classes('content')} dangerouslySetInnerHTML={dangerouslySetInnerHTML}>
32
- {children}
33
- </div>
34
- <Button {...classes('button')} onClick={toggleFactBox} />
35
- </aside>
36
- );
24
+ const FactBox = ({ children, dangerouslySetInnerHTML }: Props) => {
25
+ const [open, setOpen] = useState(false);
26
+ const { t } = useTranslation();
27
+
28
+ const toggleFactBox = (event: MouseEvent<HTMLButtonElement>) => {
29
+ const button = event.currentTarget;
30
+ const aside = button?.previousSibling?.parentElement;
31
+ aside?.classList?.toggle('expanded');
32
+ setOpen((prev) => !prev);
33
+ };
34
+
35
+ return (
36
+ <aside {...classes()}>
37
+ <div {...classes('content')} dangerouslySetInnerHTML={dangerouslySetInnerHTML}>
38
+ {children}
39
+ </div>
40
+ <Button {...classes('button')} onClick={toggleFactBox} title={t(open ? 'factbox.close' : 'factbox.open')} />
41
+ </aside>
42
+ );
43
+ };
37
44
 
38
45
  export default FactBox;
@@ -108,7 +108,7 @@
108
108
  background-color: $white;
109
109
  padding: $spacing--small 0;
110
110
  display: block;
111
- border-bottom: 1px solid #d1d6db;
111
+ border-bottom: 1px solid $brand-grey--light;
112
112
  }
113
113
 
114
114
  .c-figure__caption--hidden-caption {
@@ -5,7 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
-
9
8
  import React, { useEffect, useState } from 'react';
10
9
  import styled from '@emotion/styled';
11
10
  import Button from '@ndla/button';
@@ -15,6 +14,7 @@ import { Cross as CrossIcon, Plus as PlusIcon } from '@ndla/icons/action';
15
14
  import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
16
15
  // @ts-ignore
17
16
  import ToggleItem from './ToggleItem';
17
+ import FilterCarousel from './FilterCarousel';
18
18
 
19
19
  const StyledHeading = styled.h3`
20
20
  ${fonts.sizes('16px', '32px')};
@@ -25,12 +25,14 @@ const StyledHeading = styled.h3`
25
25
 
26
26
  const StyledButtonsWrapper = styled.div`
27
27
  display: flex;
28
- flex-wrap: wrap;
28
+ flex-wrap: nowrap;
29
+ position: relative;
29
30
  `;
30
31
 
31
32
  const StyledButtonElementWrapper = styled.div`
32
33
  margin: 0 ${spacing.xsmall} ${spacing.xsmall} 0;
33
34
  break-inside: avoid;
35
+ flex: 1 0 auto;
34
36
  `;
35
37
 
36
38
  const StyledList = styled.ul`
@@ -61,6 +63,7 @@ const StyledButtonContentSelected = styled.span`
61
63
 
62
64
  const StyledRemoveWrapper = styled.div`
63
65
  margin-top: ${spacing.xsmall};
66
+ margin-left: 10px;
64
67
  `;
65
68
 
66
69
  const ButtonRemoveText = styled.span`
@@ -73,8 +76,8 @@ export type ItemProps = {
73
76
  value: string;
74
77
  selected?: boolean;
75
78
  };
76
- type Props = {
77
- heading: string;
79
+ export type FilterButtonsProps = {
80
+ heading?: string;
78
81
  items: ItemProps[];
79
82
  onFilterToggle: (value: string) => void;
80
83
  onRemoveAllFilters: () => void;
@@ -83,7 +86,7 @@ type Props = {
83
86
  };
84
87
  };
85
88
 
86
- export const FilterButtons = ({ heading, items, onFilterToggle, onRemoveAllFilters, labels }: Props) => {
89
+ export const FilterButtons = ({ heading, items, onFilterToggle, onRemoveAllFilters, labels }: FilterButtonsProps) => {
87
90
  const { t } = useTranslation();
88
91
  const [isNarrowScreen, setIsNarrowScreen] = useState(false);
89
92
 
@@ -155,9 +158,7 @@ export const FilterButtons = ({ heading, items, onFilterToggle, onRemoveAllFilte
155
158
  checked={item.selected}
156
159
  label={item.label}
157
160
  component="div"
158
- onChange={() => {
159
- onFilterToggle(item.value);
160
- }}
161
+ onChange={() => onFilterToggle(item.value)}
161
162
  />
162
163
  </StyledListItem>
163
164
  ))}
@@ -170,18 +171,16 @@ export const FilterButtons = ({ heading, items, onFilterToggle, onRemoveAllFilte
170
171
  )}
171
172
  {!isNarrowScreen && (
172
173
  <>
173
- <StyledHeading>{heading}</StyledHeading>
174
- <StyledButtonsWrapper>
174
+ {heading && <StyledHeading>{heading}</StyledHeading>}
175
+ <FilterCarousel>
175
176
  {items.map((item: ItemProps) => (
176
177
  <StyledButtonElementWrapper key={item.value}>
177
178
  <Button
178
179
  type="button"
179
180
  size="normal"
180
- greyLightest={!item.selected}
181
+ greyLighter={!item.selected}
181
182
  borderShape="rounded"
182
- onClick={() => {
183
- onFilterToggle(item.value);
184
- }}>
183
+ onClick={() => onFilterToggle(item.value)}>
185
184
  <StyledButtonContent>{item.label}</StyledButtonContent>
186
185
  {item.selected && (
187
186
  <StyledButtonContentSelected>
@@ -191,7 +190,7 @@ export const FilterButtons = ({ heading, items, onFilterToggle, onRemoveAllFilte
191
190
  </Button>
192
191
  </StyledButtonElementWrapper>
193
192
  ))}
194
- </StyledButtonsWrapper>
193
+ </FilterCarousel>
195
194
  <StyledRemoveWrapper>
196
195
  {hasSelectedFilters && (
197
196
  <Button onClick={onRemoveAllFilters} link>