@ndla/ui 22.2.0 → 24.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/es/Animation/DisplayOnPageYOffset.js +1 -1
  2. package/es/Article/Article.js +3 -3
  3. package/es/Article/ArticleAuthorContent.js +2 -4
  4. package/es/Article/ArticleByline.js +5 -6
  5. package/es/AuthorInfo/AuthorInfo.js +29 -16
  6. package/es/Breadcrumb/ActionBreadcrumb.js +3 -3
  7. package/es/ContentCard/ContentCard.js +66 -25
  8. package/es/Figure/FigureOpenDialogButton.js +1 -2
  9. package/es/FileList/File.js +34 -8
  10. package/es/FileList/FileList.js +29 -3
  11. package/es/Filter/FilterListPhone.js +1 -1
  12. package/es/Frontpage/FrontpageProgramMenu.js +10 -11
  13. package/es/InfoBox/InfoBox.js +10 -3
  14. package/es/InfoWidget/InfoWidget.js +67 -22
  15. package/es/NDLAFilm/AllMoviesAlphabetically.js +12 -12
  16. package/es/Portrait/Portrait.js +19 -13
  17. package/es/ResourceBox/ResourceBox.js +7 -35
  18. package/es/ResourceGroup/ResourceItem.js +13 -13
  19. package/es/ResourceGroup/ResourceList.js +3 -3
  20. package/es/Search/ActiveFilterContent.js +4 -14
  21. package/es/Search/ActiveFilters.js +20 -31
  22. package/es/Search/SearchField.js +31 -52
  23. package/es/Search/SearchResult.js +113 -136
  24. package/es/Search/ToggleSearchButton.js +34 -43
  25. package/es/Search/index.js +2 -8
  26. package/es/SearchTypeResult/ActiveFilters.js +18 -18
  27. package/es/SearchTypeResult/SearchFieldHeader.js +5 -6
  28. package/es/TopicMenu/TopicMenu.js +1 -1
  29. package/es/all.css +1 -1
  30. package/es/index-javascript.js +0 -1
  31. package/es/index.js +2 -1
  32. package/es/locale/messages-en.js +2 -0
  33. package/es/locale/messages-nb.js +2 -0
  34. package/es/locale/messages-nn.js +2 -0
  35. package/es/locale/messages-se.js +2 -0
  36. package/es/locale/messages-sma.js +2 -0
  37. package/lib/Animation/DisplayOnPageYOffset.js +2 -2
  38. package/lib/Article/Article.js +4 -4
  39. package/lib/Article/ArticleAuthorContent.js +9 -4
  40. package/lib/Article/ArticleByline.js +4 -4
  41. package/lib/AuthorInfo/AuthorInfo.d.ts +1 -11
  42. package/lib/AuthorInfo/AuthorInfo.js +36 -20
  43. package/lib/Breadcrumb/ActionBreadcrumb.js +3 -3
  44. package/lib/ContentCard/ContentCard.d.ts +1 -15
  45. package/lib/ContentCard/ContentCard.js +60 -28
  46. package/lib/FileList/File.js +36 -12
  47. package/lib/FileList/FileList.js +28 -5
  48. package/lib/Filter/FilterListPhone.js +2 -2
  49. package/lib/Frontpage/FrontpageProgramMenu.js +9 -9
  50. package/lib/InfoBox/InfoBox.js +11 -4
  51. package/lib/InfoWidget/InfoWidget.js +61 -25
  52. package/lib/NDLAFilm/AllMoviesAlphabetically.js +13 -13
  53. package/lib/Portrait/Portrait.js +19 -14
  54. package/lib/ResourceBox/ResourceBox.d.ts +1 -4
  55. package/lib/ResourceBox/ResourceBox.js +15 -35
  56. package/lib/ResourceGroup/ResourceItem.js +12 -14
  57. package/lib/ResourceGroup/ResourceList.js +2 -4
  58. package/lib/Search/ActiveFilterContent.d.ts +13 -0
  59. package/lib/Search/ActiveFilterContent.js +4 -15
  60. package/lib/Search/ActiveFilters.d.ts +13 -0
  61. package/lib/Search/ActiveFilters.js +31 -45
  62. package/lib/Search/SearchField.d.ts +19 -0
  63. package/lib/Search/SearchField.js +32 -56
  64. package/lib/Search/SearchResult.d.ts +36 -0
  65. package/lib/Search/SearchResult.js +116 -159
  66. package/lib/Search/ToggleSearchButton.d.ts +16 -0
  67. package/lib/Search/ToggleSearchButton.js +36 -46
  68. package/lib/Search/index.d.ts +12 -0
  69. package/lib/Search/index.js +0 -54
  70. package/lib/SearchTypeResult/ActiveFilters.js +37 -39
  71. package/lib/SearchTypeResult/SearchFieldHeader.js +6 -6
  72. package/lib/SearchTypeResult/SearchTypeHeader.d.ts +1 -1
  73. package/lib/TopicMenu/TopicMenu.js +2 -2
  74. package/lib/all.css +1 -1
  75. package/lib/index-javascript.js +0 -74
  76. package/lib/index.d.ts +1 -0
  77. package/lib/index.js +38 -1
  78. package/lib/locale/messages-en.d.ts +2 -0
  79. package/lib/locale/messages-en.js +2 -0
  80. package/lib/locale/messages-nb.d.ts +2 -0
  81. package/lib/locale/messages-nb.js +2 -0
  82. package/lib/locale/messages-nn.d.ts +2 -0
  83. package/lib/locale/messages-nn.js +2 -0
  84. package/lib/locale/messages-se.d.ts +2 -0
  85. package/lib/locale/messages-se.js +2 -0
  86. package/lib/locale/messages-sma.d.ts +2 -0
  87. package/lib/locale/messages-sma.js +2 -0
  88. package/package.json +17 -16
  89. package/src/Animation/DisplayOnPageYOffset.tsx +1 -1
  90. package/src/Article/Article.tsx +1 -1
  91. package/src/Article/ArticleAuthorContent.tsx +1 -1
  92. package/src/Article/ArticleByline.tsx +1 -2
  93. package/src/AuthorInfo/AuthorInfo.tsx +53 -19
  94. package/src/Breadcrumb/ActionBreadcrumb.tsx +1 -2
  95. package/src/ContentCard/ContentCard.tsx +127 -35
  96. package/src/Figure/FigureOpenDialogButton.tsx +1 -2
  97. package/src/FileList/File.tsx +47 -17
  98. package/src/FileList/FileList.tsx +37 -8
  99. package/src/Filter/FilterListPhone.jsx +1 -1
  100. package/src/Frontpage/FrontpageProgramMenu.tsx +1 -2
  101. package/src/InfoBox/InfoBox.tsx +24 -4
  102. package/src/InfoWidget/InfoWidget.tsx +83 -34
  103. package/src/NDLAFilm/AllMoviesAlphabetically.tsx +1 -1
  104. package/src/Portrait/Portrait.tsx +25 -10
  105. package/src/ResourceBox/ResourceBox.tsx +1 -20
  106. package/src/ResourceGroup/ResourceItem.tsx +1 -1
  107. package/src/ResourceGroup/ResourceList.tsx +1 -1
  108. package/src/Search/{ActiveFilterContent.jsx → ActiveFilterContent.tsx} +11 -12
  109. package/src/Search/{ActiveFilters.jsx → ActiveFilters.tsx} +21 -18
  110. package/src/Search/{SearchField.jsx → SearchField.tsx} +58 -68
  111. package/src/Search/SearchResult.tsx +360 -0
  112. package/src/Search/ToggleSearchButton.tsx +73 -0
  113. package/src/Search/component.search.scss +0 -4
  114. package/src/Search/index.ts +16 -0
  115. package/src/SearchTypeResult/ActiveFilters.tsx +1 -1
  116. package/src/SearchTypeResult/SearchFieldHeader.tsx +1 -2
  117. package/src/TopicMenu/TopicMenu.jsx +1 -1
  118. package/src/all.scss +0 -1
  119. package/src/index-javascript.js +0 -15
  120. package/src/index.ts +2 -0
  121. package/src/locale/messages-en.ts +2 -0
  122. package/src/locale/messages-nb.ts +2 -0
  123. package/src/locale/messages-nn.ts +2 -0
  124. package/src/locale/messages-se.ts +2 -0
  125. package/src/locale/messages-sma.ts +2 -0
  126. package/src/main.scss +0 -7
  127. package/es/BackgroundImage/BackgroundImage.js +0 -27
  128. package/es/BackgroundImage/index.js +0 -2
  129. package/es/Search/SearchFilter.js +0 -72
  130. package/es/Search/SearchFilterList.js +0 -115
  131. package/es/Search/SearchOverlay.js +0 -39
  132. package/es/Search/SearchPage.js +0 -178
  133. package/es/Search/SearchPopoverFilter.js +0 -152
  134. package/es/Search/SearchResultAuthor.js +0 -51
  135. package/lib/BackgroundImage/BackgroundImage.d.ts +0 -12
  136. package/lib/BackgroundImage/BackgroundImage.js +0 -40
  137. package/lib/BackgroundImage/index.d.ts +0 -2
  138. package/lib/BackgroundImage/index.js +0 -13
  139. package/lib/Search/SearchFilter.js +0 -88
  140. package/lib/Search/SearchFilterList.js +0 -137
  141. package/lib/Search/SearchOverlay.js +0 -62
  142. package/lib/Search/SearchPage.js +0 -207
  143. package/lib/Search/SearchPopoverFilter.js +0 -172
  144. package/lib/Search/SearchResultAuthor.js +0 -60
  145. package/src/AuthorInfo/component.author-info.scss +0 -54
  146. package/src/BackgroundImage/BackgroundImage.tsx +0 -32
  147. package/src/BackgroundImage/component.background-image.scss +0 -52
  148. package/src/BackgroundImage/index.ts +0 -3
  149. package/src/ContentCard/component.content-card.scss +0 -109
  150. package/src/FileList/component.file-list.scss +0 -102
  151. package/src/InfoBox/component.info-box.scss +0 -21
  152. package/src/InfoWidget/component.info-widget.scss +0 -52
  153. package/src/Portrait/component.portrait.scss +0 -29
  154. package/src/Search/SearchFilter.jsx +0 -82
  155. package/src/Search/SearchFilterList.jsx +0 -110
  156. package/src/Search/SearchOverlay.jsx +0 -38
  157. package/src/Search/SearchPage.jsx +0 -178
  158. package/src/Search/SearchPopoverFilter.jsx +0 -109
  159. package/src/Search/SearchResult.jsx +0 -239
  160. package/src/Search/SearchResultAuthor.jsx +0 -54
  161. package/src/Search/ToggleSearchButton.jsx +0 -64
  162. package/src/Search/component.search-filter.scss +0 -67
  163. package/src/Search/component.search-overlay.scss +0 -103
  164. package/src/Search/component.search-page.scss +0 -125
  165. package/src/Search/component.search-result-author.scss +0 -65
  166. package/src/Search/index.js +0 -34
@@ -23,78 +23,6 @@ Object.defineProperty(exports, "FilterButtons", {
23
23
  return _Filter.FilterButtons;
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "SearchOverlay", {
27
- enumerable: true,
28
- get: function get() {
29
- return _Search.SearchOverlay;
30
- }
31
- });
32
- Object.defineProperty(exports, "SearchField", {
33
- enumerable: true,
34
- get: function get() {
35
- return _Search.SearchField;
36
- }
37
- });
38
- Object.defineProperty(exports, "SearchPage", {
39
- enumerable: true,
40
- get: function get() {
41
- return _Search.SearchPage;
42
- }
43
- });
44
- Object.defineProperty(exports, "SearchResult", {
45
- enumerable: true,
46
- get: function get() {
47
- return _Search.SearchResult;
48
- }
49
- });
50
- Object.defineProperty(exports, "SearchResultAuthor", {
51
- enumerable: true,
52
- get: function get() {
53
- return _Search.SearchResultAuthor;
54
- }
55
- });
56
- Object.defineProperty(exports, "SearchResultList", {
57
- enumerable: true,
58
- get: function get() {
59
- return _Search.SearchResultList;
60
- }
61
- });
62
- Object.defineProperty(exports, "SearchResultItem", {
63
- enumerable: true,
64
- get: function get() {
65
- return _Search.SearchResultItem;
66
- }
67
- });
68
- Object.defineProperty(exports, "SearchFilter", {
69
- enumerable: true,
70
- get: function get() {
71
- return _Search.SearchFilter;
72
- }
73
- });
74
- Object.defineProperty(exports, "SearchFilterList", {
75
- enumerable: true,
76
- get: function get() {
77
- return _Search.SearchFilterList;
78
- }
79
- });
80
- Object.defineProperty(exports, "SearchPopoverFilter", {
81
- enumerable: true,
82
- get: function get() {
83
- return _Search.SearchPopoverFilter;
84
- }
85
- });
86
- Object.defineProperty(exports, "ActiveFilters", {
87
- enumerable: true,
88
- get: function get() {
89
- return _Search.ActiveFilters;
90
- }
91
- });
92
- Object.defineProperty(exports, "ToggleSearchButton", {
93
- enumerable: true,
94
- get: function get() {
95
- return _Search.ToggleSearchButton;
96
- }
97
- });
98
26
  Object.defineProperty(exports, "TopicIntroductionList", {
99
27
  enumerable: true,
100
28
  get: function get() {
@@ -146,8 +74,6 @@ Object.defineProperty(exports, "CompetenceGoalsDialog", {
146
74
 
147
75
  var _Filter = require("./Filter");
148
76
 
149
- var _Search = require("./Search");
150
-
151
77
  var _TopicIntroductionList = _interopRequireDefault(require("./TopicIntroductionList"));
152
78
 
153
79
  var _TopicMenu = _interopRequireWildcard(require("./TopicMenu"));
package/lib/index.d.ts CHANGED
@@ -89,3 +89,4 @@ export type { Snack, SnackContext } from './SnackBar';
89
89
  export { InfoBlock } from './InfoBlock';
90
90
  export { TreeStructure } from './TreeStructure';
91
91
  export type { FolderType, TreeStructureProps, TreeStructureMenuProps } from './TreeStructure';
92
+ export { SearchField, SearchResultList, SearchResultItem, ActiveFilters, ToggleSearchButton } from './Search';
package/lib/index.js CHANGED
@@ -188,7 +188,12 @@ var _exportNames = {
188
188
  BaseSnack: true,
189
189
  DefaultSnackbar: true,
190
190
  InfoBlock: true,
191
- TreeStructure: true
191
+ TreeStructure: true,
192
+ SearchField: true,
193
+ SearchResultList: true,
194
+ SearchResultItem: true,
195
+ ActiveFilters: true,
196
+ ToggleSearchButton: true
192
197
  };
193
198
  Object.defineProperty(exports, "ArticleByline", {
194
199
  enumerable: true,
@@ -1288,6 +1293,36 @@ Object.defineProperty(exports, "TreeStructure", {
1288
1293
  return _TreeStructure.TreeStructure;
1289
1294
  }
1290
1295
  });
1296
+ Object.defineProperty(exports, "SearchField", {
1297
+ enumerable: true,
1298
+ get: function get() {
1299
+ return _Search.SearchField;
1300
+ }
1301
+ });
1302
+ Object.defineProperty(exports, "SearchResultList", {
1303
+ enumerable: true,
1304
+ get: function get() {
1305
+ return _Search.SearchResultList;
1306
+ }
1307
+ });
1308
+ Object.defineProperty(exports, "SearchResultItem", {
1309
+ enumerable: true,
1310
+ get: function get() {
1311
+ return _Search.SearchResultItem;
1312
+ }
1313
+ });
1314
+ Object.defineProperty(exports, "ActiveFilters", {
1315
+ enumerable: true,
1316
+ get: function get() {
1317
+ return _Search.ActiveFilters;
1318
+ }
1319
+ });
1320
+ Object.defineProperty(exports, "ToggleSearchButton", {
1321
+ enumerable: true,
1322
+ get: function get() {
1323
+ return _Search.ToggleSearchButton;
1324
+ }
1325
+ });
1291
1326
 
1292
1327
  var _indexJavascript = require("./index-javascript");
1293
1328
 
@@ -1440,6 +1475,8 @@ var _InfoBlock = require("./InfoBlock");
1440
1475
 
1441
1476
  var _TreeStructure = require("./TreeStructure");
1442
1477
 
1478
+ var _Search = require("./Search");
1479
+
1443
1480
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1444
1481
 
1445
1482
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
@@ -86,6 +86,8 @@ declare const messages: {
86
86
  detailView: string;
87
87
  shortView: string;
88
88
  myPage: {
89
+ confirmDeleteAccount: string;
90
+ confirmDeleteAccountButton: string;
89
91
  myPage: string;
90
92
  logout: string;
91
93
  loginTerms: string;
@@ -987,6 +987,8 @@ var messages = _objectSpread(_objectSpread({
987
987
  detailView: 'Detailed listview',
988
988
  shortView: 'Short view',
989
989
  myPage: {
990
+ confirmDeleteAccount: 'Are you sure you want to delete your account?',
991
+ confirmDeleteAccountButton: 'Delete account',
990
992
  myPage: 'My page',
991
993
  logout: 'Log out of My NDLA',
992
994
  loginTerms: 'Log in with Feide to receive access. By logging on your accept your terms of service',
@@ -86,6 +86,8 @@ declare const messages: {
86
86
  detailView: string;
87
87
  shortView: string;
88
88
  myPage: {
89
+ confirmDeleteAccount: string;
90
+ confirmDeleteAccountButton: string;
89
91
  myPage: string;
90
92
  deleteAccount: string;
91
93
  logout: string;
@@ -987,6 +987,8 @@ var messages = _objectSpread(_objectSpread({
987
987
  detailView: 'Detaljrik listevisning',
988
988
  shortView: 'Kort visning',
989
989
  myPage: {
990
+ confirmDeleteAccount: 'Er du sikker på at du vil slette kontoen?',
991
+ confirmDeleteAccountButton: 'Slett konto',
990
992
  myPage: 'Min side',
991
993
  deleteAccount: 'Slett Min NDLA',
992
994
  logout: 'Logg ut av Min NDLA',
@@ -86,6 +86,8 @@ declare const messages: {
86
86
  detailView: string;
87
87
  shortView: string;
88
88
  myPage: {
89
+ confirmDeleteAccount: string;
90
+ confirmDeleteAccountButton: string;
89
91
  myPage: string;
90
92
  deleteAccount: string;
91
93
  logout: string;
@@ -987,6 +987,8 @@ var messages = _objectSpread(_objectSpread({
987
987
  detailView: 'Detaljrik listevisning',
988
988
  shortView: 'Kort visning',
989
989
  myPage: {
990
+ confirmDeleteAccount: 'Er du sikker på at du vil slette kontoen?',
991
+ confirmDeleteAccountButton: 'Slett konto',
990
992
  myPage: 'Min side',
991
993
  deleteAccount: 'Slett Min NDLA',
992
994
  logout: 'Logg ut av Min NDLA',
@@ -86,6 +86,8 @@ declare const messages: {
86
86
  detailView: string;
87
87
  shortView: string;
88
88
  myPage: {
89
+ confirmDeleteAccount: string;
90
+ confirmDeleteAccountButton: string;
89
91
  myPage: string;
90
92
  deleteAccount: string;
91
93
  logout: string;
@@ -987,6 +987,8 @@ var messages = _objectSpread(_objectSpread({
987
987
  detailView: 'Detaljrik listevisning',
988
988
  shortView: 'Kort visning',
989
989
  myPage: {
990
+ confirmDeleteAccount: 'Er du sikker på at du vil slette kontoen?',
991
+ confirmDeleteAccountButton: 'Slett konto',
990
992
  myPage: 'Min side',
991
993
  deleteAccount: 'Slett Min NDLA',
992
994
  logout: 'Logg ut av Min NDLA',
@@ -86,6 +86,8 @@ declare const messages: {
86
86
  detailView: string;
87
87
  shortView: string;
88
88
  myPage: {
89
+ confirmDeleteAccount: string;
90
+ confirmDeleteAccountButton: string;
89
91
  myPage: string;
90
92
  deleteAccount: string;
91
93
  logout: string;
@@ -987,6 +987,8 @@ var messages = _objectSpread(_objectSpread({
987
987
  detailView: 'Detaljrik listevisning',
988
988
  shortView: 'Kort visning',
989
989
  myPage: {
990
+ confirmDeleteAccount: 'Er du sikker på at du vil slette kontoen?',
991
+ confirmDeleteAccountButton: 'Slett konto',
990
992
  myPage: 'Min side',
991
993
  deleteAccount: 'Slett Min NDLA',
992
994
  logout: 'Logg ut av Min NDLA',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "22.2.0",
3
+ "version": "24.0.0",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,21 +31,22 @@
31
31
  "types"
32
32
  ],
33
33
  "dependencies": {
34
- "@ndla/button": "^3.3.0",
35
- "@ndla/carousel": "^1.2.15",
36
- "@ndla/core": "^2.3.3",
37
- "@ndla/forms": "^3.1.3",
38
- "@ndla/hooks": "^1.1.4",
39
- "@ndla/icons": "^1.11.3",
40
- "@ndla/licenses": "^5.0.6",
41
- "@ndla/modal": "^1.2.17",
42
- "@ndla/notion": "^3.1.29",
43
- "@ndla/safelink": "^2.2.6",
44
- "@ndla/switch": "^0.1.10",
45
- "@ndla/tabs": "^1.1.14",
46
- "@ndla/tooltip": "^2.1.5",
34
+ "@ndla/article-scripts": "^3.0.1",
35
+ "@ndla/button": "^3.3.1",
36
+ "@ndla/carousel": "^1.2.16",
37
+ "@ndla/core": "^2.3.4",
38
+ "@ndla/forms": "^3.1.4",
39
+ "@ndla/hooks": "^1.1.5",
40
+ "@ndla/icons": "^1.11.4",
41
+ "@ndla/licenses": "^5.0.8",
42
+ "@ndla/modal": "^1.2.18",
43
+ "@ndla/notion": "^3.1.31",
44
+ "@ndla/safelink": "^2.2.7",
45
+ "@ndla/switch": "^0.1.11",
46
+ "@ndla/tabs": "^1.1.15",
47
+ "@ndla/tooltip": "^2.2.0",
47
48
  "@ndla/types-learningpath-api": "^0.0.12",
48
- "@ndla/util": "^3.0.0",
49
+ "@ndla/util": "^3.0.1",
49
50
  "@reach/menu-button": "^0.16.2",
50
51
  "@reach/slider": "^0.16.0",
51
52
  "focus-trap-react": "^8.9.2",
@@ -84,5 +85,5 @@
84
85
  "publishConfig": {
85
86
  "access": "public"
86
87
  },
87
- "gitHead": "12ed2984919fd75fbb7f1b1e55c1d5903fd51d51"
88
+ "gitHead": "5ae8101f78ef46929de137ecbdd3275a5ef72649"
88
89
  }
@@ -8,7 +8,7 @@
8
8
 
9
9
  import React, { Component, ReactNode } from 'react';
10
10
  import PropTypes from 'prop-types';
11
- import throttle from 'lodash/throttle';
11
+ import { throttle } from 'lodash';
12
12
  import Fade from './Fade';
13
13
 
14
14
  interface Props {
@@ -8,7 +8,7 @@
8
8
 
9
9
  import React, { ComponentType, ReactNode, useEffect, useRef, useState, forwardRef } from 'react';
10
10
  import BEMHelper from 'react-bem-helper';
11
- import isString from 'lodash/isString';
11
+ import { isString } from 'lodash';
12
12
  import parse from 'html-react-parser';
13
13
  import styled from '@emotion/styled';
14
14
 
@@ -78,7 +78,7 @@ const ArticleAuthorContent = ({ showAuthor, authors, onSelectAuthor }: Props) =>
78
78
  return (
79
79
  <div {...classes()}>
80
80
  <div {...classes('author-info')}>
81
- {image && <Portrait src={image} alt={name} {...classes('portrait')} />}
81
+ {image && <Portrait src={image} alt={name} />}
82
82
  <section>
83
83
  <h1>{name}</h1>
84
84
  <hr />
@@ -13,8 +13,7 @@ import Button, { CopyButton } from '@ndla/button';
13
13
  import { colors, fonts, spacing } from '@ndla/core';
14
14
  import { copyTextToClipboard, printPage } from '@ndla/util';
15
15
  import { useTranslation } from 'react-i18next';
16
- import { LicenseByline } from '@ndla/licenses';
17
- import { getLicenseByAbbreviation } from '@ndla/licenses';
16
+ import { LicenseByline, getLicenseByAbbreviation } from '@ndla/licenses';
18
17
  import { TFunction } from 'i18next';
19
18
 
20
19
  const Wrapper = styled.div`
@@ -7,16 +7,11 @@
7
7
  */
8
8
 
9
9
  import React from 'react';
10
- import PropTypes from 'prop-types';
11
- import BEMHelper from 'react-bem-helper';
10
+ import styled from '@emotion/styled';
12
11
  import SafeLink from '@ndla/safelink';
12
+ import { breakpoints, fonts, mq, spacing } from '@ndla/core';
13
13
  import Portrait from '../Portrait';
14
14
 
15
- const classes = new BEMHelper({
16
- name: 'author-info',
17
- prefix: 'c-',
18
- });
19
-
20
15
  interface Props {
21
16
  authorName: string;
22
17
  authorRole: string;
@@ -25,24 +20,63 @@ interface Props {
25
20
  image?: string;
26
21
  }
27
22
 
23
+ const AuthorInfoSection = styled.section`
24
+ display: flex;
25
+ align-items: flex-start;
26
+ padding-bottom: ${spacing.large};
27
+ font-family: ${fonts.sans};
28
+ p,
29
+ a {
30
+ margin: 0;
31
+ ${mq.range({ until: breakpoints.tablet })} {
32
+ ${fonts.sizes('14px', '22px')};
33
+ }
34
+ }
35
+ `;
36
+
37
+ const StyledPortrait = styled(Portrait)`
38
+ margin-right: ${spacing.large};
39
+ ${mq.range({ until: breakpoints.desktop })} {
40
+ margin-right: ${spacing.medium};
41
+ width: 7rem;
42
+ height: 7rem;
43
+ span {
44
+ width: 7rem;
45
+ height: 7rem;
46
+ }
47
+ }
48
+ ${mq.range({ until: breakpoints.desktop })} {
49
+ margin-right: ${spacing.small};
50
+ width: 4rem;
51
+ height: 4rem;
52
+ span {
53
+ width: 4rem;
54
+ height: 4rem;
55
+ }
56
+ } ;
57
+ `;
58
+
59
+ const StyledHeading = styled.h1`
60
+ margin: 0 0 ${spacing.small};
61
+ ${mq.range({ until: breakpoints.desktop })} {
62
+ ${fonts.sizes('22px', '22px')};
63
+ }
64
+ ${mq.range({ until: breakpoints.tablet })} {
65
+ ${fonts.sizes('18px', '18px')};
66
+ margin-bottom: ${spacing.xsmall};
67
+ }
68
+ `;
69
+
28
70
  const AuthorInfo = ({ authorName, authorRole, email, image, phone }: Props) => (
29
- <section {...classes('')}>
30
- {image && <Portrait src={image} alt={authorName} modifier="large" {...classes('portrait-image')} />}
71
+ <AuthorInfoSection>
72
+ {image && <StyledPortrait src={image} alt={authorName} modifier="large" />}
31
73
  <div>
32
- <h1 {...classes('heading')}>{authorName}</h1>
74
+ <StyledHeading>{authorName}</StyledHeading>
33
75
  <p>{authorRole}</p>
34
76
  {phone && <p>{phone}</p>}
35
77
  {email && <SafeLink to={`mailto:${email}`}>{email}</SafeLink>}
36
78
  </div>
37
- </section>
79
+ </AuthorInfoSection>
38
80
  );
39
81
 
40
- AuthorInfo.propTypes = {
41
- authorName: PropTypes.string.isRequired,
42
- authorRole: PropTypes.string.isRequired,
43
- phone: PropTypes.string,
44
- email: PropTypes.string,
45
- image: PropTypes.string,
46
- };
47
-
48
82
  export default AuthorInfo;
@@ -11,8 +11,7 @@ import { colors, fonts, spacing } from '@ndla/core';
11
11
  import { ChevronRight } from '@ndla/icons/common';
12
12
  import SafeLink from '@ndla/safelink';
13
13
  import React from 'react';
14
- import { MenuButton } from '@ndla/button';
15
- import { MenuItemProps } from '@ndla/button';
14
+ import { MenuButton, MenuItemProps } from '@ndla/button';
16
15
  import Breadcrumb from './Breadcrumb';
17
16
  import { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from './BreadcrumbItem';
18
17
 
@@ -1,11 +1,123 @@
1
1
  import React from 'react';
2
- import BEMHelper from 'react-bem-helper';
3
- import PropTypes from 'prop-types';
2
+ import styled from '@emotion/styled';
4
3
  import { Play } from '@ndla/icons/common';
5
4
  import SafeLink from '@ndla/safelink';
6
5
  import type { SafeLinkProps } from '@ndla/safelink';
6
+ import { breakpoints, colors, fonts, mq, spacing, spacingUnit } from '@ndla/core';
7
7
 
8
- const classes = BEMHelper('c-content-card');
8
+ interface ContentCardContainerProps {
9
+ columnWidth: number;
10
+ }
11
+ const ContentCardContainer = styled.article<ContentCardContainerProps>`
12
+ position: relative;
13
+ display: block;
14
+ width: ${(p) => `${p.columnWidth}px`};
15
+ `;
16
+
17
+ const StyledHeading = styled.h1`
18
+ font-weight: ${fonts.weight.semibold};
19
+ ${fonts.sizes('14px', '16px')};
20
+ margin: ${spacing.xsmall} 0;
21
+ color: ${colors.brand.primary};
22
+
23
+ ${mq.range({ from: breakpoints.tablet })} {
24
+ margin: ${spacing.small} 0 ${spacing.xsmall};
25
+ ${fonts.sizes('20px', '22px')};
26
+ }
27
+ `;
28
+
29
+ const ContentCardLink = styled(SafeLink)`
30
+ color: ${colors.text.primary};
31
+ &:hover,
32
+ &:focus {
33
+ ${StyledHeading} {
34
+ text-decoration: underline;
35
+ }
36
+ }
37
+ `;
38
+
39
+ const ImageWrapper = styled.div`
40
+ width: 100%;
41
+ height: 72px;
42
+ border-radius: 5px;
43
+ position: relative;
44
+ overflow: hidden;
45
+ background: ${colors.background.grayDark};
46
+ ${mq.range({ from: breakpoints.tablet })} {
47
+ height: ${spacingUnit * 4.5}px;
48
+ }
49
+ `;
50
+
51
+ interface BackgroundImageProps {
52
+ image: string;
53
+ }
54
+ const BackgroundImage = styled.div<BackgroundImageProps>`
55
+ display: flex;
56
+ height: 100%;
57
+ width: 100%;
58
+ background-position: center center;
59
+ background-size: cover;
60
+ background-image: url(${(p) => p.image});
61
+ `;
62
+
63
+ const PlayBackground = styled.div`
64
+ position: absolute;
65
+ left: 50%;
66
+ top: 50%;
67
+ transform: translate3d(-50%, -50%, 0);
68
+ height: 35px;
69
+ width: 35px;
70
+ background-color: rgba(0, 0, 0, 0.48);
71
+ border-radius: 100%;
72
+ display: flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ ${mq.range({ from: breakpoints.tablet })} {
76
+ height: 42px;
77
+ width: 42px;
78
+ }
79
+
80
+ .c-icon {
81
+ color: ${colors.white};
82
+ height: 20px;
83
+ width: 20px;
84
+ margin-right: -1px;
85
+
86
+ ${mq.range({ from: breakpoints.tablet })} {
87
+ height: 25px;
88
+ width: 25px;
89
+ }
90
+ }
91
+ `;
92
+
93
+ const StyledContentType = styled.p`
94
+ ${fonts.sizes('12px', '20px')};
95
+ position: absolute;
96
+ left: ${spacing.small};
97
+ bottom: ${spacing.small};
98
+ display: inline-block;
99
+ background: ${colors.brand.greyLightest};
100
+ border-radius: 2px;
101
+ font-weight: 600;
102
+ margin: 0;
103
+ padding: 0 ${spacing.xxsmall};
104
+
105
+ display: none;
106
+ ${mq.range({ from: breakpoints.tablet })} {
107
+ display: inline-block;
108
+ }
109
+ `;
110
+
111
+ const StyledDescription = styled.p`
112
+ ${fonts.sizes('16px')};
113
+ line-height: 1.25rem;
114
+ margin: 0;
115
+ display: none;
116
+
117
+ ${mq.range({ from: breakpoints.tablet })} {
118
+ display: block;
119
+ }
120
+ `;
9
121
 
10
122
  interface Props {
11
123
  title: string;
@@ -18,43 +130,23 @@ interface Props {
18
130
  }
19
131
 
20
132
  const ContentCard = ({ title, text, image, type, isFilm = false, toLinkProps, columnWidth }: Props) => (
21
- <article {...classes()} style={{ width: `${columnWidth}px` }}>
22
- <SafeLink {...toLinkProps()} title={title} {...classes('link')}>
133
+ <ContentCardContainer columnWidth={columnWidth}>
134
+ <ContentCardLink {...toLinkProps()} title={title}>
23
135
  <header>
24
- <div {...classes('image-wrapper')}>
25
- <div
26
- {...classes('background-image')}
27
- role="img"
28
- aria-label={title}
29
- style={{
30
- backgroundImage: `url(${image})`,
31
- }}
32
- />
136
+ <ImageWrapper>
137
+ <BackgroundImage image={image} role="img" aria-label={title} />
33
138
  {isFilm && (
34
- <div {...classes('play-background')}>
139
+ <PlayBackground>
35
140
  <Play />
36
- </div>
141
+ </PlayBackground>
37
142
  )}
38
- <p {...classes('type')}>{type}</p>
39
- </div>
40
- <h1 {...classes('heading')}>{title}</h1>
143
+ <StyledContentType>{type}</StyledContentType>
144
+ </ImageWrapper>
145
+ <StyledHeading>{title}</StyledHeading>
41
146
  </header>
42
- <p {...classes('description')}>{text}</p>
43
- </SafeLink>
44
- </article>
147
+ <StyledDescription>{text}</StyledDescription>
148
+ </ContentCardLink>
149
+ </ContentCardContainer>
45
150
  );
46
151
 
47
- ContentCard.propTypes = {
48
- title: PropTypes.string.isRequired,
49
- text: PropTypes.string.isRequired,
50
- type: PropTypes.string.isRequired,
51
- image: PropTypes.string.isRequired,
52
- isFilm: PropTypes.bool,
53
- toLinkProps: PropTypes.func.isRequired,
54
- };
55
-
56
- ContentCard.defaultProps = {
57
- isFilm: false,
58
- };
59
-
60
152
  export default ContentCard;
@@ -8,8 +8,7 @@
8
8
 
9
9
  import React from 'react';
10
10
  import { Play } from '@ndla/icons/common';
11
- import { ExpandTwoArrows } from '@ndla/icons/action';
12
- import { CursorClick } from '@ndla/icons/action';
11
+ import { ExpandTwoArrows, CursorClick } from '@ndla/icons/action';
13
12
 
14
13
  interface Props {
15
14
  type?: 'image' | 'video' | 'h5p' | 'iframe' | 'external';