@ndla/ui 44.0.11 → 44.0.13

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 (73) hide show
  1. package/es/Article/ArticleByline.js +8 -11
  2. package/es/BannerCard/BannerCard.js +7 -7
  3. package/es/ContactBlock/ContactBlock.js +13 -13
  4. package/es/LinkBlock/LinkBlock.js +6 -6
  5. package/es/Masthead/Masthead.js +13 -34
  6. package/es/Masthead/MastheadSearchModal.js +2 -4
  7. package/es/Masthead/index.js +2 -2
  8. package/es/Search/ToggleSearchButton.js +9 -24
  9. package/es/Table/Table.js +36 -30
  10. package/es/Table/index.js +1 -0
  11. package/es/User/UserInfo.js +6 -3
  12. package/es/User/parseUserObject.js +1 -1
  13. package/es/all.css +1 -1
  14. package/es/index.js +2 -2
  15. package/es/locale/messages-en.js +1 -2
  16. package/es/locale/messages-nb.js +1 -2
  17. package/es/locale/messages-nn.js +1 -2
  18. package/es/locale/messages-se.js +1 -2
  19. package/es/locale/messages-sma.js +1 -2
  20. package/lib/Article/ArticleByline.js +8 -11
  21. package/lib/BannerCard/BannerCard.js +7 -7
  22. package/lib/ContactBlock/ContactBlock.js +13 -13
  23. package/lib/LinkBlock/LinkBlock.js +6 -6
  24. package/lib/Masthead/Masthead.d.ts +0 -6
  25. package/lib/Masthead/Masthead.js +14 -36
  26. package/lib/Masthead/MastheadSearchModal.d.ts +1 -2
  27. package/lib/Masthead/MastheadSearchModal.js +2 -4
  28. package/lib/Masthead/index.d.ts +2 -2
  29. package/lib/Masthead/index.js +1 -10
  30. package/lib/Search/ToggleSearchButton.d.ts +0 -2
  31. package/lib/Search/ToggleSearchButton.js +8 -23
  32. package/lib/Table/Table.d.ts +1 -0
  33. package/lib/Table/Table.js +43 -36
  34. package/lib/Table/index.d.ts +1 -0
  35. package/lib/Table/index.js +10 -2
  36. package/lib/User/UserInfo.js +6 -3
  37. package/lib/User/parseUserObject.d.ts +1 -1
  38. package/lib/User/parseUserObject.js +1 -1
  39. package/lib/all.css +1 -1
  40. package/lib/index.d.ts +2 -2
  41. package/lib/index.js +7 -7
  42. package/lib/locale/messages-en.d.ts +1 -2
  43. package/lib/locale/messages-en.js +1 -2
  44. package/lib/locale/messages-nb.d.ts +1 -2
  45. package/lib/locale/messages-nb.js +1 -2
  46. package/lib/locale/messages-nn.d.ts +1 -2
  47. package/lib/locale/messages-nn.js +1 -2
  48. package/lib/locale/messages-se.d.ts +1 -2
  49. package/lib/locale/messages-se.js +1 -2
  50. package/lib/locale/messages-sma.d.ts +1 -2
  51. package/lib/locale/messages-sma.js +1 -2
  52. package/package.json +16 -16
  53. package/src/Article/ArticleByline.tsx +6 -8
  54. package/src/BannerCard/BannerCard.tsx +1 -1
  55. package/src/ContactBlock/ContactBlock.tsx +1 -0
  56. package/src/LinkBlock/LinkBlock.tsx +1 -0
  57. package/src/Masthead/Masthead.tsx +6 -38
  58. package/src/Masthead/MastheadSearchModal.tsx +2 -3
  59. package/src/Masthead/index.ts +2 -2
  60. package/src/Search/ToggleSearchButton.tsx +21 -38
  61. package/src/Table/Table.tsx +166 -19
  62. package/src/Table/index.ts +1 -0
  63. package/src/User/UserInfo.tsx +3 -1
  64. package/src/User/__tests__/parseUserObject-test.ts +1 -1
  65. package/src/User/parseUserObject.ts +1 -1
  66. package/src/index.ts +2 -2
  67. package/src/locale/messages-en.ts +1 -2
  68. package/src/locale/messages-nb.ts +1 -2
  69. package/src/locale/messages-nn.ts +1 -2
  70. package/src/locale/messages-se.ts +1 -2
  71. package/src/locale/messages-sma.ts +1 -2
  72. package/src/main.scss +0 -1
  73. package/src/Table/component.tables.scss +0 -218
package/lib/index.d.ts CHANGED
@@ -8,11 +8,11 @@
8
8
  export { default as SectionHeading } from './SectionHeading';
9
9
  export { ConceptNotionV2, ImageEmbed, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, } from './Embed';
10
10
  export { ArticleByline, ArticleFootNotes, ArticleIntroduction, ArticleTitle, ArticleWrapper, ArticleHeaderWrapper, default as Article, } from './Article';
11
- export { default as Table } from './Table';
11
+ export { default as Table, TableStyling } from './Table';
12
12
  export { default as ResourcesWrapper, ResourcesTopicTitle } from './ResourcesWrapper';
13
13
  export { createUniversalPortal } from './utils/createUniversalPortal';
14
14
  export { default as NoContentBox } from './NoContentBox';
15
- export { default as Masthead, MastheadItem, getMastheadHeight, useMastheadHeight, SkipToMainContent } from './Masthead';
15
+ export { default as Masthead, getMastheadHeight, useMastheadHeight, SkipToMainContent } from './Masthead';
16
16
  export { default as ContentLoader } from './ContentLoader';
17
17
  export { default as RelatedArticleList, RelatedArticle, RelatedArticleListV2 } from './RelatedArticleList';
18
18
  export { ErrorResourceAccessDenied, default as ErrorMessage } from './ErrorMessage';
package/lib/index.js CHANGED
@@ -706,12 +706,6 @@ Object.defineProperty(exports, "Masthead", {
706
706
  return _Masthead.default;
707
707
  }
708
708
  });
709
- Object.defineProperty(exports, "MastheadItem", {
710
- enumerable: true,
711
- get: function get() {
712
- return _Masthead.MastheadItem;
713
- }
714
- });
715
709
  Object.defineProperty(exports, "MastheadSearchModal", {
716
710
  enumerable: true,
717
711
  get: function get() {
@@ -1102,6 +1096,12 @@ Object.defineProperty(exports, "Table", {
1102
1096
  return _Table.default;
1103
1097
  }
1104
1098
  });
1099
+ Object.defineProperty(exports, "TableStyling", {
1100
+ enumerable: true,
1101
+ get: function get() {
1102
+ return _Table.TableStyling;
1103
+ }
1104
+ });
1105
1105
  Object.defineProperty(exports, "TagSelector", {
1106
1106
  enumerable: true,
1107
1107
  get: function get() {
@@ -1279,7 +1279,7 @@ Object.defineProperty(exports, "useSnack", {
1279
1279
  var _SectionHeading = _interopRequireDefault(require("./SectionHeading"));
1280
1280
  var _Embed = require("./Embed");
1281
1281
  var _Article = _interopRequireWildcard(require("./Article"));
1282
- var _Table = _interopRequireDefault(require("./Table"));
1282
+ var _Table = _interopRequireWildcard(require("./Table"));
1283
1283
  var _ResourcesWrapper = _interopRequireWildcard(require("./ResourcesWrapper"));
1284
1284
  var _createUniversalPortal = require("./utils/createUniversalPortal");
1285
1285
  var _NoContentBox = _interopRequireDefault(require("./NoContentBox"));
@@ -29,8 +29,6 @@ declare const messages: {
29
29
  loggedInAsButton: string;
30
30
  role: {
31
31
  employee: string;
32
- faculty: string;
33
- staff: string;
34
32
  student: string;
35
33
  };
36
34
  buttonLogIn: string;
@@ -151,6 +149,7 @@ declare const messages: {
151
149
  detailView: string;
152
150
  shortView: string;
153
151
  sharedFolder: {
152
+ folderCopied: string;
154
153
  info: string;
155
154
  firstShared: string;
156
155
  learningpathUnsupported: string;
@@ -1032,8 +1032,6 @@ var messages = _objectSpread(_objectSpread({
1032
1032
  loggedInAsButton: 'You are logged in as {{role}}',
1033
1033
  role: {
1034
1034
  employee: 'Employee',
1035
- faculty: 'Employee',
1036
- staff: 'Employee',
1037
1035
  student: 'Student'
1038
1036
  },
1039
1037
  buttonLogIn: 'Log in with Feide',
@@ -1154,6 +1152,7 @@ var messages = _objectSpread(_objectSpread({
1154
1152
  detailView: 'Detailed listview',
1155
1153
  shortView: 'Card view',
1156
1154
  sharedFolder: {
1155
+ folderCopied: 'The folder was copied.',
1157
1156
  info: 'This folder contains learning resources and tasks from NDLA, gathered by a teacher.',
1158
1157
  firstShared: 'The folder was shared for the first time {{date}}',
1159
1158
  learningpathUnsupported: 'Learning paths and multidisciplinary cases cannot be shown directly in a shared folder. You can open the learning path in a new tab by clicking the link in the navigation menu to the left.',
@@ -29,8 +29,6 @@ declare const messages: {
29
29
  loggedInAsButton: string;
30
30
  role: {
31
31
  employee: string;
32
- faculty: string;
33
- staff: string;
34
32
  student: string;
35
33
  };
36
34
  buttonLogIn: string;
@@ -151,6 +149,7 @@ declare const messages: {
151
149
  detailView: string;
152
150
  shortView: string;
153
151
  sharedFolder: {
152
+ folderCopied: string;
154
153
  info: string;
155
154
  firstShared: string;
156
155
  learningpathUnsupported: string;
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
1030
1030
  loggedInAsButton: 'Du er pålogget som {{role}}',
1031
1031
  role: {
1032
1032
  employee: 'ansatt',
1033
- faculty: 'ansatt',
1034
- staff: 'ansatt',
1035
1033
  student: 'elev'
1036
1034
  },
1037
1035
  buttonLogIn: 'Logg inn med Feide',
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
1152
1150
  detailView: 'Detaljert listevisning',
1153
1151
  shortView: 'Kort visning',
1154
1152
  sharedFolder: {
1153
+ folderCopied: 'Mappen har blitt kopiert.',
1155
1154
  info: 'Denne mappa inneholder fagstoff og oppgaver fra NDLA, samlet av en lærer. ',
1156
1155
  firstShared: 'Mappa ble delt første gang {{date}}',
1157
1156
  learningpathUnsupported: 'Læringsstier og tverrfaglige caser kan ikke vises direkte i delte mapper. Dersom du trykker på lenka i navigasjonsmenyen til venstre, vil stien åpnes i en ny fane.',
@@ -29,8 +29,6 @@ declare const messages: {
29
29
  loggedInAsButton: string;
30
30
  role: {
31
31
  employee: string;
32
- faculty: string;
33
- staff: string;
34
32
  student: string;
35
33
  };
36
34
  buttonLogIn: string;
@@ -151,6 +149,7 @@ declare const messages: {
151
149
  detailView: string;
152
150
  shortView: string;
153
151
  sharedFolder: {
152
+ folderCopied: string;
154
153
  info: string;
155
154
  firstShared: string;
156
155
  drawerButton: string;
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
1030
1030
  loggedInAsButton: 'Du er pålogga som {{role}}',
1031
1031
  role: {
1032
1032
  employee: 'tilsett',
1033
- faculty: 'tilsett',
1034
- staff: 'tilsett',
1035
1033
  student: 'elev'
1036
1034
  },
1037
1035
  buttonLogIn: 'Logg inn med Feide',
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
1152
1150
  detailView: 'Detaljert listevisning',
1153
1151
  shortView: 'Kortvisning',
1154
1152
  sharedFolder: {
1153
+ folderCopied: 'Mappa vart kopiert.',
1155
1154
  info: 'Denne mappa inneheld fagstoff og oppgåver frå NDLA, samla av ein lærar.',
1156
1155
  firstShared: 'Mappa vart delt første gong {{date}}',
1157
1156
  drawerButton: 'Vis mapper og ressursar',
@@ -29,8 +29,6 @@ declare const messages: {
29
29
  loggedInAsButton: string;
30
30
  role: {
31
31
  employee: string;
32
- faculty: string;
33
- staff: string;
34
32
  student: string;
35
33
  };
36
34
  buttonLogIn: string;
@@ -151,6 +149,7 @@ declare const messages: {
151
149
  detailView: string;
152
150
  shortView: string;
153
151
  sharedFolder: {
152
+ folderCopied: string;
154
153
  info: string;
155
154
  firstShared: string;
156
155
  drawerButton: string;
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
1030
1030
  loggedInAsButton: 'Don leat sisaloggejuvvon {{role}}',
1031
1031
  role: {
1032
1032
  employee: 'bargi',
1033
- faculty: 'bargi',
1034
- staff: 'bargi',
1035
1033
  student: 'oahppi'
1036
1034
  },
1037
1035
  buttonLogIn: 'Logge sisa Feide bokte',
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
1152
1150
  detailView: 'Bienalaš oppalašlistu',
1153
1151
  shortView: 'Oanehis listu',
1154
1152
  sharedFolder: {
1153
+ folderCopied: 'Mappen har blitt kopiert.',
1155
1154
  info: 'Dán máhpas lea NDLA fágasisdoallu ja bargobihtát, čohkkejuvvon oahpaheaddjis.',
1156
1155
  firstShared: 'Máhppa juogaduvvui vuosttaš geardde {{date}}',
1157
1156
  drawerButton: 'Čájet máhpaid ja resurssaid',
@@ -29,8 +29,6 @@ declare const messages: {
29
29
  loggedInAsButton: string;
30
30
  role: {
31
31
  employee: string;
32
- faculty: string;
33
- staff: string;
34
32
  student: string;
35
33
  };
36
34
  buttonLogIn: string;
@@ -151,6 +149,7 @@ declare const messages: {
151
149
  detailView: string;
152
150
  shortView: string;
153
151
  sharedFolder: {
152
+ folderCopied: string;
154
153
  info: string;
155
154
  firstShared: string;
156
155
  drawerButton: string;
@@ -1030,8 +1030,6 @@ var messages = _objectSpread(_objectSpread({
1030
1030
  loggedInAsButton: 'Datne tjaangeme goh {{role}}',
1031
1031
  role: {
1032
1032
  employee: 'barkije',
1033
- faculty: 'barkije',
1034
- staff: 'barkije',
1035
1033
  student: 'learohke'
1036
1034
  },
1037
1035
  buttonLogIn: 'Tjaangh Feidine',
@@ -1152,6 +1150,7 @@ var messages = _objectSpread(_objectSpread({
1152
1150
  detailView: 'Detaljert listevisning',
1153
1151
  shortView: 'Kort visning',
1154
1152
  sharedFolder: {
1153
+ folderCopied: 'Mappen har blitt kopiert.',
1155
1154
  info: 'Denne mappa inneheld fagstoff og oppgåver frå NDLA, samla av ein lærar.',
1156
1155
  firstShared: 'Mappa vart delt første gong {{date}}',
1157
1156
  drawerButton: 'Vis mapper og ressursar',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "44.0.11",
3
+ "version": "44.0.13",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,23 +31,23 @@
31
31
  "types"
32
32
  ],
33
33
  "dependencies": {
34
- "@ndla/accordion": "^2.2.18",
34
+ "@ndla/accordion": "^2.2.20",
35
35
  "@ndla/article-scripts": "^3.0.20",
36
- "@ndla/button": "^11.0.3",
37
- "@ndla/carousel": "^3.1.13",
38
- "@ndla/core": "^4.1.4",
39
- "@ndla/dropdown-menu": "^1.0.2",
40
- "@ndla/forms": "^4.3.18",
36
+ "@ndla/button": "^11.0.5",
37
+ "@ndla/carousel": "^3.1.15",
38
+ "@ndla/core": "^4.1.6",
39
+ "@ndla/dropdown-menu": "^1.0.4",
40
+ "@ndla/forms": "^4.3.20",
41
41
  "@ndla/hooks": "^2.0.9",
42
- "@ndla/icons": "^4.0.3",
42
+ "@ndla/icons": "^4.0.5",
43
43
  "@ndla/licenses": "^7.1.3",
44
- "@ndla/modal": "^4.0.2",
45
- "@ndla/notion": "^5.0.17",
46
- "@ndla/safelink": "^4.1.17",
47
- "@ndla/select": "^2.4.9",
48
- "@ndla/switch": "^1.1.9",
49
- "@ndla/tabs": "^3.0.5",
50
- "@ndla/tooltip": "^4.1.15",
44
+ "@ndla/modal": "^4.0.4",
45
+ "@ndla/notion": "^5.0.19",
46
+ "@ndla/safelink": "^4.1.19",
47
+ "@ndla/select": "^2.4.11",
48
+ "@ndla/switch": "^1.1.11",
49
+ "@ndla/tabs": "^3.0.7",
50
+ "@ndla/tooltip": "^4.1.17",
51
51
  "@ndla/util": "^3.1.15",
52
52
  "@radix-ui/react-popover": "^1.0.6",
53
53
  "@radix-ui/react-slider": "^1.1.2",
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "7c947d3a6bee5724031ca2dac8b24af20b466834"
86
+ "gitHead": "385f883c00df1b1a5818d687cb27373981783ec6"
87
87
  }
@@ -139,7 +139,6 @@ const ArticleByline = ({
139
139
  const license = getLicenseByAbbreviation(licenseString, locale);
140
140
 
141
141
  const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
142
- const showSecondaryContributors = suppliers.length > 0 && authors.length > 0;
143
142
 
144
143
  return (
145
144
  <Wrapper>
@@ -148,12 +147,12 @@ const ArticleByline = ({
148
147
  <LicenseLink license={license} />
149
148
  {showPrimaryContributors && (
150
149
  <PrimaryContributorsWrapper>
151
- {authors.length > 0
152
- ? t('article.authorsLabel', {
153
- names: renderContributors(authors, t),
154
- interpolation: { escapeValue: false },
155
- })
156
- : getSuppliersText(suppliers, t)}
150
+ {authors.length > 0 &&
151
+ `${t('article.authorsLabel', {
152
+ names: renderContributors(authors, t),
153
+ interpolation: { escapeValue: false },
154
+ })}. `}
155
+ {getSuppliersText(suppliers, t)}
157
156
  </PrimaryContributorsWrapper>
158
157
  )}
159
158
  </LicenseWrapper>
@@ -161,7 +160,6 @@ const ArticleByline = ({
161
160
  {t('article.lastUpdated')} {published}
162
161
  </div>
163
162
  </TextWrapper>
164
- {showSecondaryContributors && <TextWrapper>{getSuppliersText(suppliers, t)}</TextWrapper>}
165
163
  <AccordionRoot type="multiple" onValueChange={setOpenAccordions} value={openAccordions}>
166
164
  {licenseBox && (
167
165
  <AccordionItem value="rulesForUse">
@@ -58,7 +58,7 @@ const ContentText = styled.p`
58
58
  `;
59
59
  const LinkText = styled(SafeLink)`
60
60
  font-size: ${fonts.sizes(16)};
61
- color: ${colors.brand.grey};
61
+ color: ${colors.brand.primary};
62
62
  `;
63
63
  const TitleText = styled.h2`
64
64
  margin-top: 7px;
@@ -32,6 +32,7 @@ const BlockWrapper = styled.div`
32
32
  font-family: ${fonts.sans};
33
33
  border-radius: ${misc.borderRadius};
34
34
  border: 1px solid ${colors.brand.lighter};
35
+ background-color: ${colors.white};
35
36
  max-width: 348px;
36
37
  & ~ & {
37
38
  margin-top: ${spacing.medium};
@@ -34,6 +34,7 @@ const StyledSafeLink = styled(SafeLink)`
34
34
  align-items: center;
35
35
  box-shadow: none;
36
36
  color: inherit;
37
+ background-color: ${colors.white};
37
38
  border: 1px solid ${colors.brand.lighter};
38
39
  padding: ${spacing.normal};
39
40
  ${mq.range({ from: breakpoints.tabletWide })} {
@@ -13,52 +13,20 @@ import { ReactNode } from 'react';
13
13
  import { MessageBanner } from '../Messages';
14
14
  import SkipToMainContent from './SkipToMainContent';
15
15
 
16
- interface MastheadItemProps {
17
- children?: ReactNode;
18
- right?: boolean;
19
- left?: boolean;
20
- }
21
-
22
- const LeftMastheadItem = styled.div`
23
- display: flex;
24
- align-items: center;
25
- button {
26
- white-space: nowrap;
27
- }
28
- > div:last-child {
29
- flex-grow: 1;
30
- }
31
- ${mq.range({ from: breakpoints.desktop })} {
32
- flex-grow: 1;
33
- text-align: left;
34
- }
35
- `;
36
-
37
- const RightMastheadItem = styled.div`
38
- display: flex;
39
- gap: ${spacing.small};
40
- align-items: center;
41
- justify-content: flex-end;
42
- ${mq.range({ from: breakpoints.tablet })} {
43
- padding: ${spacing.small} 0;
44
- padding: 0;
45
- }
46
- `;
47
-
48
- export const MastheadItem = ({ children, left = false, right = false }: MastheadItemProps) => {
49
- const Wrapper = left ? LeftMastheadItem : right ? RightMastheadItem : 'div';
50
- return <Wrapper>{children}</Wrapper>;
51
- };
52
-
53
16
  const MastheadContent = styled.div`
54
17
  justify-content: center;
55
18
  align-items: center;
56
19
  text-align: center;
57
- padding: ${spacing.small};
20
+ padding: ${spacing.small} ${spacing.normal};
58
21
  font-weight: ${fonts.weight.normal};
59
22
  display: flex;
60
23
  height: 84px;
61
24
  justify-content: space-between;
25
+ gap: ${spacing.xsmall};
26
+ ${mq.range({ until: breakpoints.tablet })} {
27
+ padding: ${spacing.small};
28
+ gap: ${spacing.xsmall};
29
+ }
62
30
  `;
63
31
 
64
32
  interface StyledMastheadProps {
@@ -10,7 +10,6 @@ import ToggleSearchButton from '../Search/ToggleSearchButton';
10
10
  interface Props {
11
11
  onClose: VoidFunction;
12
12
  children: (arg: () => void) => ReactNode;
13
- hideOnNarrowScreen?: boolean;
14
13
  ndlaFilm?: boolean;
15
14
  }
16
15
 
@@ -60,7 +59,7 @@ const StyledHeader = styled.div`
60
59
  }
61
60
  `;
62
61
 
63
- const MastheadSearchModal = ({ onClose: onSearchClose, children, hideOnNarrowScreen, ndlaFilm }: Props) => {
62
+ const MastheadSearchModal = ({ onClose: onSearchClose, children, ndlaFilm }: Props) => {
64
63
  const { t } = useTranslation();
65
64
  const [isOpen, setIsOpen] = useState(false);
66
65
 
@@ -72,7 +71,7 @@ const MastheadSearchModal = ({ onClose: onSearchClose, children, hideOnNarrowScr
72
71
  return (
73
72
  <Modal open={isOpen} onOpenChange={setIsOpen}>
74
73
  <ModalTrigger>
75
- <ToggleSearchButton hideOnNarrowScreen={hideOnNarrowScreen} onClick={() => setIsOpen(true)} ndlaFilm={ndlaFilm}>
74
+ <ToggleSearchButton onClick={() => setIsOpen(true)} ndlaFilm={ndlaFilm}>
76
75
  {t('masthead.menu.search')}
77
76
  </ToggleSearchButton>
78
77
  </ModalTrigger>
@@ -6,11 +6,11 @@
6
6
  *
7
7
  */
8
8
 
9
- import Masthead, { MastheadItem } from './Masthead';
9
+ import Masthead from './Masthead';
10
10
 
11
11
  import { getMastheadHeight, useMastheadHeight } from './utils';
12
12
  import { default as SkipToMainContent } from './SkipToMainContent';
13
13
 
14
- export { MastheadItem, getMastheadHeight, useMastheadHeight, SkipToMainContent };
14
+ export { getMastheadHeight, useMastheadHeight, SkipToMainContent };
15
15
 
16
16
  export default Masthead;
@@ -7,48 +7,37 @@
7
7
  */
8
8
 
9
9
  import { forwardRef } from 'react';
10
- import { spacing, spacingUnit, breakpoints, mq, misc, fonts, colors } from '@ndla/core';
10
+ import { spacing, breakpoints, mq, misc, fonts, colors } from '@ndla/core';
11
11
  import { Search } from '@ndla/icons/common';
12
12
  import { ButtonProps, ButtonV2 } from '@ndla/button';
13
13
  import styled from '@emotion/styled';
14
14
 
15
15
  interface Props extends ButtonProps {
16
- hideOnNarrowScreen?: boolean;
17
- hideOnWideScreen?: boolean;
18
16
  ndlaFilm?: boolean;
19
17
  }
20
18
 
21
- interface StyledButtonProps {
22
- hideOnNarrowScreen?: boolean;
23
- hideOnWideScreen?: boolean;
24
- ndlaFilm?: boolean;
25
- }
26
-
27
- const props = ['hideOnNarrowScreen', 'hideOnWideScreen', 'ndlaFilm'];
28
-
29
- const shouldForwardProp = (p: string) => !props.includes(p);
30
-
31
- const StyledButton = styled(ButtonV2, { shouldForwardProp })<StyledButtonProps>`
32
- background: ${(p) => (p.ndlaFilm ? colors.ndlaFilm.filmColorBright : colors.brand.greyLighter)};
19
+ const StyledButton = styled(ButtonV2)`
33
20
  border-radius: ${misc.borderRadius};
34
21
  border: 0;
35
- display: ${(p) => (p.hideOnNarrowScreen ? 'none' : 'flex')};
36
- color: ${(p) => (p.ndlaFilm ? '#fff' : colors.brand.primary)};
37
- padding: ${spacing.small} ${spacingUnit * 0.75}px ${spacing.small} ${spacing.normal};
22
+ color: ${colors.brand.primary};
38
23
  align-items: center;
39
- margin-left: ${spacing.medium};
24
+ background: transparent;
40
25
 
41
- .c-icon {
26
+ svg {
42
27
  height: 24px;
43
28
  width: 24px;
44
29
  }
45
30
 
46
31
  ${fonts.sizes('16px', '32px')};
47
32
 
48
- ${mq.range({ from: breakpoints.desktop })} {
49
- display: ${(p) => (p.hideOnWideScreen ? 'none' : 'flex')};
50
- margin-right: ${spacing.nsmall};
33
+ &[data-film='true'] {
34
+ background: ${colors.ndlaFilm.filmColorBright};
35
+ color: ${colors.white};
36
+ }
37
+
38
+ ${mq.range({ from: breakpoints.tabletWide })} {
51
39
  padding: ${spacing.small} ${spacing.normal};
40
+ background: ${colors.brand.greyLighter};
52
41
  }
53
42
  &:hover,
54
43
  &:focus,
@@ -60,22 +49,16 @@ const StyledButton = styled(ButtonV2, { shouldForwardProp })<StyledButtonProps>`
60
49
  const StyledSpan = styled.span`
61
50
  margin-right: ${spacing.normal};
62
51
  font-weight: ${fonts.weight.normal};
52
+ ${mq.range({ until: breakpoints.tabletWide })} {
53
+ display: none;
54
+ }
63
55
  `;
64
56
 
65
- const ToggleSearchButton = forwardRef<HTMLButtonElement, Props>(
66
- ({ children, ndlaFilm, hideOnNarrowScreen, hideOnWideScreen, ...rest }, ref) => (
67
- <StyledButton
68
- ndlaFilm={ndlaFilm}
69
- hideOnNarrowScreen={hideOnNarrowScreen}
70
- hideOnWideScreen={hideOnWideScreen}
71
- type="button"
72
- ref={ref}
73
- {...rest}
74
- >
75
- <StyledSpan>{children}</StyledSpan>
76
- <Search />
77
- </StyledButton>
78
- ),
79
- );
57
+ const ToggleSearchButton = forwardRef<HTMLButtonElement, Props>(({ children, ndlaFilm, ...rest }, ref) => (
58
+ <StyledButton data-film={ndlaFilm} type="button" ref={ref} {...rest}>
59
+ <StyledSpan>{children}</StyledSpan>
60
+ <Search />
61
+ </StyledButton>
62
+ ));
80
63
 
81
64
  export default ToggleSearchButton;