@ndla/ui 37.1.4 → 39.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 (121) hide show
  1. package/es/Article/Article.js +2 -2
  2. package/es/Article/ArticleHeaderWrapper.js +4 -7
  3. package/es/Article/ArticleNotions.js +16 -17
  4. package/es/Article/ArticleSideBar.js +4 -5
  5. package/es/AudioPlayer/Controls.js +187 -237
  6. package/es/BlogPost/BlogPost.js +4 -4
  7. package/es/CompetenceGoals/CompetenceGoalsDialog.js +12 -25
  8. package/es/Filter/FilterButtons.js +12 -14
  9. package/es/Filter/FilterListPhone.js +2 -4
  10. package/es/Footer/index.js +1 -2
  11. package/es/Grid/Grid.js +41 -0
  12. package/es/Grid/index.js +9 -0
  13. package/es/LearningPaths/LearningPathMenuModalWrapper.js +10 -6
  14. package/es/Masthead/MastheadSearchModal.js +56 -47
  15. package/es/MyNdla/SettingsMenu.js +6 -6
  16. package/es/NDLAFilm/AboutNdlaFilm.js +3 -3
  17. package/es/ResourcesWrapper/ResourcesTopicTitle.js +19 -23
  18. package/es/SearchTypeResult/PopupFilter.js +14 -20
  19. package/es/SearchTypeResult/components/ItemContexts.js +10 -21
  20. package/es/Topic/Topic.js +23 -23
  21. package/es/User/index.js +1 -3
  22. package/es/index.js +2 -3
  23. package/es/locale/messages-en.js +1 -0
  24. package/es/locale/messages-nb.js +1 -0
  25. package/es/locale/messages-nn.js +1 -0
  26. package/es/locale/messages-se.js +1 -0
  27. package/es/locale/messages-sma.js +1 -0
  28. package/lib/Article/Article.d.ts +2 -2
  29. package/lib/Article/Article.js +2 -2
  30. package/lib/Article/ArticleHeaderWrapper.d.ts +3 -2
  31. package/lib/Article/ArticleHeaderWrapper.js +4 -7
  32. package/lib/Article/ArticleNotions.js +17 -21
  33. package/lib/Article/ArticleSideBar.js +5 -9
  34. package/lib/AudioPlayer/Controls.d.ts +2 -2
  35. package/lib/AudioPlayer/Controls.js +187 -237
  36. package/lib/BlogPost/BlogPost.d.ts +1 -1
  37. package/lib/BlogPost/BlogPost.js +4 -4
  38. package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +3 -14
  39. package/lib/CompetenceGoals/CompetenceGoalsDialog.js +11 -26
  40. package/lib/Filter/FilterButtons.js +13 -15
  41. package/lib/Filter/FilterListPhone.js +3 -5
  42. package/lib/Footer/index.d.ts +1 -2
  43. package/lib/Footer/index.js +0 -7
  44. package/lib/Grid/Grid.d.ts +15 -0
  45. package/lib/Grid/Grid.js +48 -0
  46. package/lib/Grid/index.d.ts +9 -0
  47. package/lib/Grid/index.js +13 -0
  48. package/lib/LearningPaths/LearningPathMenuModalWrapper.js +9 -8
  49. package/lib/Masthead/MastheadSearchModal.d.ts +1 -1
  50. package/lib/Masthead/MastheadSearchModal.js +58 -46
  51. package/lib/MyNdla/SettingsMenu.js +5 -5
  52. package/lib/NDLAFilm/AboutNdlaFilm.js +2 -2
  53. package/lib/ResourcesWrapper/ResourcesTopicTitle.js +20 -27
  54. package/lib/SearchTypeResult/PopupFilter.js +14 -20
  55. package/lib/SearchTypeResult/components/ItemContexts.js +10 -21
  56. package/lib/Topic/Topic.js +22 -22
  57. package/lib/User/index.d.ts +0 -2
  58. package/lib/User/index.js +1 -13
  59. package/lib/index.d.ts +3 -3
  60. package/lib/index.js +8 -20
  61. package/lib/locale/messages-en.d.ts +1 -0
  62. package/lib/locale/messages-en.js +1 -0
  63. package/lib/locale/messages-nb.d.ts +1 -0
  64. package/lib/locale/messages-nb.js +1 -0
  65. package/lib/locale/messages-nn.d.ts +1 -0
  66. package/lib/locale/messages-nn.js +1 -0
  67. package/lib/locale/messages-se.d.ts +1 -0
  68. package/lib/locale/messages-se.js +1 -0
  69. package/lib/locale/messages-sma.d.ts +1 -0
  70. package/lib/locale/messages-sma.js +1 -0
  71. package/package.json +20 -22
  72. package/src/Article/Article.tsx +4 -4
  73. package/src/Article/ArticleHeaderWrapper.tsx +12 -18
  74. package/src/Article/ArticleNotions.tsx +7 -8
  75. package/src/Article/ArticleSideBar.tsx +3 -3
  76. package/src/AudioPlayer/Controls.tsx +150 -289
  77. package/src/BlogPost/BlogPost.stories.tsx +15 -12
  78. package/src/BlogPost/BlogPost.tsx +1 -1
  79. package/src/CompetenceGoals/CompetenceGoalsDialog.tsx +13 -38
  80. package/src/Filter/FilterButtons.tsx +4 -5
  81. package/src/Filter/FilterListPhone.tsx +3 -4
  82. package/src/Footer/index.ts +1 -2
  83. package/src/Grid/Grid.stories.tsx +68 -0
  84. package/src/Grid/Grid.tsx +63 -0
  85. package/src/Grid/index.ts +10 -0
  86. package/src/KeyFigure/KeyFigure.stories.tsx +10 -8
  87. package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +10 -6
  88. package/src/Masthead/MastheadSearchModal.tsx +48 -74
  89. package/src/MyNdla/SettingsMenu.tsx +3 -3
  90. package/src/NDLAFilm/AboutNdlaFilm.tsx +3 -3
  91. package/src/ResourcesWrapper/ResourcesTopicTitle.tsx +4 -8
  92. package/src/SearchTypeResult/PopupFilter.tsx +6 -11
  93. package/src/SearchTypeResult/components/ItemContexts.tsx +4 -21
  94. package/src/Topic/Topic.tsx +7 -7
  95. package/src/User/index.ts +0 -2
  96. package/src/index.ts +3 -3
  97. package/src/locale/messages-en.ts +1 -0
  98. package/src/locale/messages-nb.ts +1 -0
  99. package/src/locale/messages-nn.ts +1 -0
  100. package/src/locale/messages-se.ts +1 -0
  101. package/src/locale/messages-sma.ts +1 -0
  102. package/es/Figure/FigureLicenseDialogContent.js +0 -75
  103. package/es/Footer/FooterAuth.js +0 -110
  104. package/es/Masthead/MastheadAuthModal.js +0 -50
  105. package/es/SearchTypeResult/SearchNotionItem.js +0 -208
  106. package/es/User/AuthModal.js +0 -116
  107. package/lib/Figure/FigureLicenseDialogContent.d.ts +0 -22
  108. package/lib/Figure/FigureLicenseDialogContent.js +0 -80
  109. package/lib/Footer/FooterAuth.d.ts +0 -10
  110. package/lib/Footer/FooterAuth.js +0 -114
  111. package/lib/Masthead/MastheadAuthModal.d.ts +0 -13
  112. package/lib/Masthead/MastheadAuthModal.js +0 -56
  113. package/lib/SearchTypeResult/SearchNotionItem.d.ts +0 -29
  114. package/lib/SearchTypeResult/SearchNotionItem.js +0 -215
  115. package/lib/User/AuthModal.d.ts +0 -22
  116. package/lib/User/AuthModal.js +0 -124
  117. package/src/Figure/FigureLicenseDialogContent.tsx +0 -80
  118. package/src/Footer/FooterAuth.tsx +0 -104
  119. package/src/Masthead/MastheadAuthModal.tsx +0 -62
  120. package/src/SearchTypeResult/SearchNotionItem.tsx +0 -228
  121. package/src/User/AuthModal.tsx +0 -123
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
 
9
- import React, { ComponentProps, ReactNode } from 'react';
9
+ import React, { ReactNode } from 'react';
10
10
  import { useTranslation } from 'react-i18next';
11
- import { breakpoints, fonts, mq } from '@ndla/core';
12
- import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
11
+ import { breakpoints, mq } from '@ndla/core';
12
+ import { ModalHeader, ModalBody, ModalCloseButton, Modal, ModalTitle, ModalProps } from '@ndla/modal';
13
13
  import { FooterHeaderIcon } from '@ndla/icons/common';
14
14
  import styled from '@emotion/styled';
15
15
 
@@ -21,28 +21,9 @@ const HeaderWrapper = styled.div`
21
21
  width: 100%;
22
22
  `;
23
23
 
24
- const HeadingWrapper = styled.h1`
25
- display: flex;
26
- align-items: center;
27
- ${fonts.sizes('18px', '32px')};
28
- margin: 0;
29
- font-weight: ${fonts.weight.semibold};
30
- `;
31
-
32
24
  interface Props {
33
25
  children?: ReactNode;
34
- modalProps?: ComponentProps<typeof Modal>;
35
- isOpen?: boolean;
36
- onClose?: () => void;
37
26
  subjectName?: string;
38
- curriculums?: {
39
- id: string;
40
- name: string;
41
- goals?: {
42
- id: string;
43
- name: string;
44
- }[];
45
- }[];
46
27
  }
47
28
 
48
29
  const CompetenceGoalsWrapper = styled.div`
@@ -57,29 +38,23 @@ const CompetenceGoalsWrapper = styled.div`
57
38
  }
58
39
  `;
59
40
 
60
- export const CompetenceGoalsDialog = ({ children, isOpen, onClose, subjectName, modalProps }: Props) => {
41
+ export const CompetenceGoalsDialog = ({
42
+ children,
43
+ subjectName,
44
+ ...modalProps
45
+ }: Props & Omit<ModalProps, 'children'>) => {
61
46
  const { t } = useTranslation();
62
- const iconId = 'popupCompetenceGoals';
63
47
 
64
48
  return (
65
- <Modal
66
- labelledBy={iconId}
67
- {...modalProps}
68
- controllable
69
- isOpen={isOpen}
70
- onClose={onClose}
71
- size="fullscreen"
72
- backgroundColor="light-gradient"
73
- narrow
74
- >
49
+ <Modal {...(modalProps as ModalProps)} size="full">
75
50
  {(close) => (
76
51
  <>
77
- <ModalHeader modifier="menu">
52
+ <ModalHeader>
78
53
  <HeaderWrapper>
79
- <HeadingWrapper>
80
- <FooterHeaderIcon id={iconId} size="24px" style={{ marginRight: '20px' }} />
54
+ <ModalTitle>
55
+ <FooterHeaderIcon size="24px" style={{ marginRight: '20px' }} />
81
56
  {t('competenceGoals.modalText')} {subjectName && ` \u2022 ${subjectName}`}
82
- </HeadingWrapper>
57
+ </ModalTitle>
83
58
  <ModalCloseButton onClick={close} title={t('competenceGoals.competenceGoalClose')} />
84
59
  </HeaderWrapper>
85
60
  </ModalHeader>
@@ -11,7 +11,7 @@ import { ButtonV2 } from '@ndla/button';
11
11
  import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { Cross as CrossIcon, Plus as PlusIcon } from '@ndla/icons/action';
14
- import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
14
+ import { ModalHeader, ModalBody, ModalCloseButton, Modal } from '@ndla/modal';
15
15
  import ToggleItem from './ToggleItem';
16
16
  import FilterCarousel from './FilterCarousel';
17
17
 
@@ -127,10 +127,9 @@ export const FilterButtons = ({ heading, items, onFilterToggle, onRemoveAllFilte
127
127
  </StyledButtonElementWrapper>
128
128
  ))}
129
129
  <Modal
130
- label={t('searchPage.searchFilterMessages.resourceTypeFilter.button')}
131
- size="fullscreen"
130
+ aria-label={t('searchPage.searchFilterMessages.resourceTypeFilter.button')}
131
+ size="full"
132
132
  animation="subtle"
133
- backgroundColor="white"
134
133
  activateButton={
135
134
  <StyledButtonElementWrapper>
136
135
  <ButtonV2 colorTheme="light" size="normal" shape="pill">
@@ -144,7 +143,7 @@ export const FilterButtons = ({ heading, items, onFilterToggle, onRemoveAllFilte
144
143
  >
145
144
  {(onClose: () => void) => (
146
145
  <>
147
- <ModalHeader modifier={['left-align']}>
146
+ <ModalHeader>
148
147
  <h1>{heading}</h1>
149
148
  <ModalCloseButton title={t('modal.closeModal')} onClick={onClose} />
150
149
  </ModalHeader>
@@ -8,7 +8,7 @@
8
8
 
9
9
  import React, { ChangeEvent, useEffect, useState } from 'react';
10
10
  import { ChevronDown, ChevronUp } from '@ndla/icons/common';
11
- import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
11
+ import { ModalHeader, ModalBody, ModalCloseButton, Modal } from '@ndla/modal';
12
12
  import { ButtonV2 } from '@ndla/button';
13
13
  import debounce from 'lodash/debounce';
14
14
  import { classes } from './filterClasses';
@@ -138,8 +138,7 @@ const FilterListPhone = ({
138
138
  />
139
139
  )}
140
140
  <Modal
141
- size="fullscreen"
142
- backgroundColor="grey"
141
+ size="full"
143
142
  activateButton={
144
143
  <ButtonV2 variant="outline" {...classes('modal-button')}>
145
144
  {messages.openFilter}
@@ -148,7 +147,7 @@ const FilterListPhone = ({
148
147
  >
149
148
  {(onClose) => (
150
149
  <>
151
- <ModalHeader modifier={['left-align']}>
150
+ <ModalHeader>
152
151
  <div {...classes('modal-header')}>
153
152
  <div {...classes('modal-heading')}>
154
153
  {!isNarrowScreen && label && <h1 {...classes('label')}>{label}</h1>}
@@ -9,6 +9,5 @@
9
9
  import Footer from './Footer';
10
10
  import { FooterText } from './FooterText';
11
11
  import { EditorName } from './EditorName';
12
- import FooterAuth from './FooterAuth';
13
12
 
14
- export { Footer, FooterText, EditorName, FooterAuth };
13
+ export { Footer, FooterText, EditorName };
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Copyright (c) 2023-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 { Meta, StoryFn } from '@storybook/react';
11
+ import Grid from './Grid';
12
+ import { defaultParameters } from '../../../../stories/defaults';
13
+ import { BlogPostStory } from '../BlogPost/BlogPost.stories';
14
+ import { KeyFigureStory } from '../KeyFigure/KeyFigure.stories';
15
+
16
+ export default {
17
+ title: 'Enkle komponenter/Grid',
18
+ component: Grid,
19
+ tags: ['autodocs'],
20
+ parameters: {
21
+ ...defaultParameters,
22
+ layout: 'centered',
23
+ },
24
+ args: {
25
+ columns: 2,
26
+ border: false,
27
+ },
28
+ } as Meta<typeof Grid>;
29
+
30
+ export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
31
+ return (
32
+ <Grid {...args}>
33
+ <KeyFigureStory
34
+ title={KeyFigureStory.args?.title!}
35
+ subtitle={KeyFigureStory.args?.subtitle!}
36
+ image={KeyFigureStory.args?.image}
37
+ />
38
+ <KeyFigureStory
39
+ title={KeyFigureStory.args?.title!}
40
+ subtitle={KeyFigureStory.args?.subtitle!}
41
+ image={KeyFigureStory.args?.image}
42
+ />
43
+ </Grid>
44
+ );
45
+ };
46
+
47
+ export const GridBlogPostStory: StoryFn<typeof Grid> = ({ ...args }) => {
48
+ return (
49
+ <Grid {...args}>
50
+ <BlogPostStory
51
+ metaImage={BlogPostStory.args?.metaImage!}
52
+ title={BlogPostStory.args?.title!}
53
+ size={BlogPostStory.args?.size}
54
+ headingLevel={BlogPostStory.args?.headingLevel}
55
+ url={BlogPostStory.args?.url!}
56
+ author={BlogPostStory.args?.author}
57
+ />
58
+ <BlogPostStory
59
+ metaImage={BlogPostStory.args?.metaImage!}
60
+ title={BlogPostStory.args?.title!}
61
+ size={BlogPostStory.args?.size}
62
+ headingLevel={BlogPostStory.args?.headingLevel}
63
+ url={BlogPostStory.args?.url!}
64
+ author={BlogPostStory.args?.author}
65
+ />
66
+ </Grid>
67
+ );
68
+ };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright (c) 2023-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 styled from '@emotion/styled';
10
+ import { breakpoints, colors, misc, mq, spacing } from '@ndla/core';
11
+ import { ReactNode } from 'react';
12
+
13
+ export interface GridProps {
14
+ columns: 2 | 4;
15
+ border: 'none' | 'lightBlue';
16
+ children?: ReactNode[];
17
+ }
18
+
19
+ const GridContainer = styled.div`
20
+ display: grid;
21
+ grid-template-columns: auto;
22
+ justify-content: center;
23
+ gap: ${spacing.large};
24
+ padding: ${spacing.medium};
25
+
26
+ border-radius: ${misc.borderRadius};
27
+
28
+ &[data-border='lightBlue'] {
29
+ border: 1px solid ${colors.brand.light};
30
+ }
31
+
32
+ ${mq.range({ from: breakpoints.mobileWide })} {
33
+ grid-template-columns: repeat(2, auto);
34
+ }
35
+
36
+ ${mq.range({ from: breakpoints.tabletWide })} {
37
+ &[data-columns='4'] {
38
+ grid-template-columns: repeat(4, auto);
39
+ }
40
+ }
41
+
42
+ p {
43
+ word-break: break-word;
44
+ }
45
+
46
+ /** The styling here is to handle figures/text until a new figure element is developed */
47
+ figure,
48
+ iframe {
49
+ inset: 0;
50
+ width: 100% !important;
51
+ padding: 0;
52
+ }
53
+ `;
54
+
55
+ const Grid = ({ columns, border, children, ...rest }: GridProps) => {
56
+ return (
57
+ <GridContainer data-border={border} data-columns={columns} {...rest}>
58
+ {children}
59
+ </GridContainer>
60
+ );
61
+ };
62
+
63
+ export default Grid;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2023-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
+ export { default as Grid } from './Grid';
10
+ export type { GridProps as GridType } from './Grid';
@@ -10,6 +10,14 @@ import React from 'react';
10
10
  import { Meta, StoryFn } from '@storybook/react';
11
11
  import { defaultParameters } from '../../../../stories/defaults';
12
12
  import KeyFigure from './KeyFigure';
13
+ const args = {
14
+ title: '500',
15
+ subtitle: 'TVERRFAGLIGE RESSURSER',
16
+ image: {
17
+ alt: 'Nøkkeltall tverrfaglig',
18
+ src: 'https://api.test.ndla.no/image-api/raw/wMowCjRg.svg',
19
+ },
20
+ };
13
21
 
14
22
  export default {
15
23
  title: 'Enkle komponenter/Nøkkeltall',
@@ -19,18 +27,12 @@ export default {
19
27
  ...defaultParameters,
20
28
  layout: 'centered',
21
29
  },
22
- args: {
23
- title: '500',
24
- subtitle: 'TVERRFAGLIGE RESSURSER',
25
- image: {
26
- alt: 'Nøkkeltall tverrfaglig',
27
- src: 'https://api.test.ndla.no/image-api/raw/wMowCjRg.svg',
28
- },
29
- },
30
+ args: args,
30
31
  } as Meta<typeof KeyFigure>;
31
32
 
32
33
  export const KeyFigureStory: StoryFn<typeof KeyFigure> = ({ ...args }) => {
33
34
  return <KeyFigure {...args} />;
34
35
  };
35
36
 
37
+ KeyFigureStory.args = args;
36
38
  KeyFigureStory.storyName = 'Nøkkeltall';
@@ -7,12 +7,13 @@
7
7
  */
8
8
 
9
9
  import React, { ReactChild, ReactChildren, ReactNode } from 'react';
10
- import { spacing, mq, breakpoints } from '@ndla/core';
11
- import Modal, { ModalHeader, ModalBody, ModalCloseButton } from '@ndla/modal';
10
+ import { spacing, mq, breakpoints, colors } from '@ndla/core';
11
+ import { ModalHeader, ModalBody, ModalCloseButton, Modal } from '@ndla/modal';
12
12
  import { css } from '@emotion/react';
13
13
  import { ButtonV2 } from '@ndla/button';
14
14
  import { LearningPath } from '@ndla/icons/contentType';
15
15
  import { useTranslation } from 'react-i18next';
16
+ import styled from '@emotion/styled';
16
17
 
17
18
  const buttonToggleCss = css`
18
19
  ${mq.range({ from: breakpoints.tablet })} {
@@ -29,6 +30,10 @@ const buttonToggleCss = css`
29
30
  }
30
31
  `;
31
32
 
33
+ const StyledModal = styled(Modal)`
34
+ background-color: ${colors.brand.greyLightest};
35
+ `;
36
+
32
37
  type ModalWrapperProps = {
33
38
  innerWidth: number;
34
39
  children: (arg: VoidFunction) => ReactChild | ReactChildren | ReactNode;
@@ -38,10 +43,9 @@ const ModalWrapperComponent = ({ innerWidth, children }: ModalWrapperProps) => {
38
43
  const { t } = useTranslation();
39
44
  if (innerWidth < 601) {
40
45
  return (
41
- <Modal
42
- backgroundColor="grey"
46
+ <StyledModal
43
47
  animationDuration={200}
44
- size="fullscreen"
48
+ size="full"
45
49
  activateButton={
46
50
  <ButtonV2 css={buttonToggleCss}>
47
51
  <LearningPath />
@@ -57,7 +61,7 @@ const ModalWrapperComponent = ({ innerWidth, children }: ModalWrapperProps) => {
57
61
  <ModalBody>{children(closeModal)}</ModalBody>
58
62
  </>
59
63
  )}
60
- </Modal>
64
+ </StyledModal>
61
65
  );
62
66
  }
63
67
  return <>{children(() => {})}</>;
@@ -1,25 +1,27 @@
1
- import React, { ReactChild, ReactChildren, ReactNode } from 'react';
2
- import Modal from '@ndla/modal';
1
+ import React, { ReactChild, ReactChildren, ReactNode, useState } from 'react';
2
+ import { Drawer } from '@ndla/modal';
3
3
  import { IconButtonV2 as IconButton } from '@ndla/button';
4
4
  import { Cross } from '@ndla/icons/action';
5
- import { isFunction } from '@ndla/util';
6
5
  import styled from '@emotion/styled';
7
- import { css } from '@emotion/react';
8
- import { spacing, mq, breakpoints, colors, shadows } from '@ndla/core';
6
+ import { spacing, mq, breakpoints, colors } from '@ndla/core';
9
7
  import { useTranslation } from 'react-i18next';
10
8
  import ToggleSearchButton from '../Search/ToggleSearchButton';
11
9
 
12
10
  interface Props {
13
11
  onClose: VoidFunction;
14
- children: (arg: Function) => ReactChild | ReactChildren | ReactNode;
12
+ children: (arg: () => void) => ReactChild | ReactChildren | ReactNode;
15
13
  hideOnNarrowScreen?: boolean;
16
14
  ndlaFilm?: boolean;
17
15
  }
18
16
 
17
+ const StyledDrawer = styled(Drawer)`
18
+ background-color: ${colors.brand.greyLightest};
19
+ `;
20
+
19
21
  const StyledHeader = styled.div`
20
22
  display: flex;
21
23
  gap: ${spacing.small};
22
- align-items: center;
24
+ align-items: flex-start;
23
25
  ${mq.range({ from: breakpoints.tablet })} {
24
26
  width: 1024px;
25
27
  max-width: calc(100vw - 100px);
@@ -33,11 +35,14 @@ const StyledHeader = styled.div`
33
35
 
34
36
  display: flex;
35
37
  padding-top: ${spacing.small};
38
+ padding-bottom: ${spacing.small};
36
39
  ${mq.range({ from: breakpoints.tablet })} {
37
40
  padding-top: ${spacing.normal};
41
+ padding-bottom: ${spacing.normal};
38
42
  }
39
43
  ${mq.range({ from: breakpoints.desktop })} {
40
44
  padding-top: calc(${spacing.normal} + ${spacing.small});
45
+ padding-bottom: calc(${spacing.normal} + ${spacing.small});
41
46
  }
42
47
  > input {
43
48
  width: 100%;
@@ -55,76 +60,45 @@ const StyledHeader = styled.div`
55
60
  }
56
61
  `;
57
62
 
58
- const modalStyles = css`
59
- & > [data-reach-dialog-content] {
60
- position: fixed;
61
- background: none;
62
- top: 0;
63
- right: 0;
64
- left: 0;
65
- height: 74px;
66
- ${mq.range({ from: breakpoints.tablet })} {
67
- height: 110px;
68
- }
69
- ${mq.range({ from: breakpoints.desktop })} {
70
- height: 136px;
71
- }
72
- overflow-y: visible;
73
- box-shadow: none;
74
- }
75
- `;
76
-
77
- const extraBackdrop = css`
78
- position: absolute;
79
- z-index: -1;
80
- left: 0;
81
- right: 0;
82
- top: 0;
83
- height: 74px;
84
- background: ${colors.brand.greyLighter};
85
- ${mq.range({ from: breakpoints.tablet })} {
86
- height: 110px;
87
- }
88
- ${mq.range({ from: breakpoints.desktop })} {
89
- height: 136px;
90
- }
91
- box-shadow: ${shadows.searchHeader};
92
- `;
93
-
94
63
  const MastheadSearchModal = ({ onClose: onSearchClose, children, hideOnNarrowScreen, ndlaFilm }: Props) => {
95
64
  const { t } = useTranslation();
65
+ const [isOpen, setIsOpen] = useState(false);
96
66
  return (
97
- <Modal
98
- label={t('searchPage.searchFieldPlaceholder')}
99
- backgroundColor="grey"
100
- animation="slide-down"
101
- animationDuration={200}
102
- size="full-width"
103
- onClose={onSearchClose}
104
- css={modalStyles}
105
- activateButton={
106
- <ToggleSearchButton hideOnNarrowScreen={hideOnNarrowScreen} ndlaFilm={ndlaFilm}>
107
- {t('masthead.menu.search')}
108
- </ToggleSearchButton>
109
- }
110
- >
111
- {(closeModal: VoidFunction) => (
112
- <>
113
- <div css={extraBackdrop} />
114
- <StyledHeader>
115
- {isFunction(children) ? children(closeModal) : children}
116
- <IconButton
117
- aria-label={t('welcomePage.closeSearch')}
118
- variant="ghost"
119
- colorTheme="light"
120
- onClick={closeModal}
121
- >
122
- <Cross className="c-icon--medium" />
123
- </IconButton>
124
- </StyledHeader>
125
- </>
126
- )}
127
- </Modal>
67
+ <>
68
+ <ToggleSearchButton hideOnNarrowScreen={hideOnNarrowScreen} onClick={() => setIsOpen(true)} ndlaFilm={ndlaFilm}>
69
+ {t('masthead.menu.search')}
70
+ </ToggleSearchButton>
71
+ <StyledDrawer
72
+ controlled
73
+ aria-label={t('searchPage.searchFieldPlaceholder')}
74
+ position="top"
75
+ expands
76
+ size="small"
77
+ animation="slideIn"
78
+ animationDuration={200}
79
+ isOpen={isOpen}
80
+ onClose={() => {
81
+ setIsOpen(false);
82
+ onSearchClose();
83
+ }}
84
+ >
85
+ {(closeModal) => (
86
+ <>
87
+ <StyledHeader>
88
+ {children(closeModal)}
89
+ <IconButton
90
+ aria-label={t('welcomePage.closeSearch')}
91
+ variant="ghost"
92
+ colorTheme="light"
93
+ onClick={closeModal}
94
+ >
95
+ <Cross className="c-icon--medium" />
96
+ </IconButton>
97
+ </StyledHeader>
98
+ </>
99
+ )}
100
+ </StyledDrawer>
101
+ </>
128
102
  );
129
103
  };
130
104
 
@@ -11,7 +11,7 @@ import styled from '@emotion/styled';
11
11
  import { isMobile, isTablet } from 'react-device-detect';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { IconButtonV2, MenuItemProps, MenuButton, ButtonV2 } from '@ndla/button';
14
- import { Drawer, ModalBody, ModalCloseButton, ModalHeaderV2 } from '@ndla/modal';
14
+ import { Drawer, ModalBody, ModalCloseButton, ModalHeader } from '@ndla/modal';
15
15
  import { HorizontalMenu } from '@ndla/icons/contentType';
16
16
  import { breakpoints, colors, misc, mq, spacing } from '@ndla/core';
17
17
 
@@ -58,10 +58,10 @@ const SettingsMenu = ({ menuItems, children }: Props) => {
58
58
  >
59
59
  {(close) => (
60
60
  <>
61
- <ModalHeaderV2>
61
+ <ModalHeader>
62
62
  <h1>{t('myNdla.settings')}</h1>
63
63
  <ModalCloseButton onClick={close} />
64
- </ModalHeaderV2>
64
+ </ModalHeader>
65
65
  <StyledModalBody>
66
66
  {children?.(close)}
67
67
  {!!menuItems?.length && (
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import styled from '@emotion/styled';
4
- import { ModalHeader, ModalBody, ModalCloseButton, ModalV2 } from '@ndla/modal';
4
+ import { ModalHeader, ModalBody, ModalCloseButton, Modal } from '@ndla/modal';
5
5
  import { colors, spacing, mq, breakpoints } from '@ndla/core';
6
6
  import { ButtonV2 as Button } from '@ndla/button';
7
7
  import VisualElement from './VisualElement';
@@ -64,7 +64,7 @@ const AboutNdlaFilm = ({ aboutNDLAVideo, moreAboutNdlaFilm }: Props) => {
64
64
  <div>
65
65
  <h2 id={titleId}>{aboutNDLAVideo.title}</h2>
66
66
  <p>{aboutNDLAVideo.description}</p>
67
- <ModalV2 size="full" activateButton={<Button variant="link">{t('ndlaFilm.about.more')}</Button>}>
67
+ <Modal size="full" activateButton={<Button variant="link">{t('ndlaFilm.about.more')}</Button>}>
68
68
  {(onClose) => (
69
69
  <>
70
70
  <ModalHeader>
@@ -73,7 +73,7 @@ const AboutNdlaFilm = ({ aboutNDLAVideo, moreAboutNdlaFilm }: Props) => {
73
73
  <ModalBody>{moreAboutNdlaFilm}</ModalBody>
74
74
  </>
75
75
  )}
76
- </ModalV2>
76
+ </Modal>
77
77
  </div>
78
78
  </StyledAside>
79
79
  </div>
@@ -1,9 +1,9 @@
1
- import React, { Fragment, ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { css } from '@emotion/react';
4
4
  import styled from '@emotion/styled';
5
5
  import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
6
- import Modal, { ModalBody, ModalHeader, ModalCloseButton } from '@ndla/modal';
6
+ import { ModalBody, ModalHeader, ModalCloseButton, Modal, ModalTitle } from '@ndla/modal';
7
7
  import Tooltip from '@ndla/tooltip';
8
8
  import { Switch } from '@ndla/switch';
9
9
  import { LearningPathQuiz } from '@ndla/icons/contentType';
@@ -170,8 +170,6 @@ const ResourcesTopicTitle = ({
170
170
  heading = <TopicTitle css={topicTitleSingleStyle}>{messages.label}</TopicTitle>;
171
171
  }
172
172
 
173
- const tooltipId = 'popupDialogTooltip';
174
-
175
173
  return (
176
174
  <TopicTitleWrapper css={invertedStyle ? invertedTopicTitleWrapperStyle : undefined}>
177
175
  <div>
@@ -188,15 +186,13 @@ const ResourcesTopicTitle = ({
188
186
  css={invertedStyle ? invertedSwitchCSS : switchCSS}
189
187
  />
190
188
  <Modal
191
- labelledBy={tooltipId}
192
- narrow
193
189
  wrapperFunctionForButton={(activateButton: ReactNode) => (
194
190
  <TooltipWrapper>
195
191
  <Tooltip tooltip={t('resource.dialogTooltip')}>{activateButton}</Tooltip>
196
192
  </TooltipWrapper>
197
193
  )}
198
194
  activateButton={
199
- <TooltipButton id={tooltipId} aria-label={t('resource.dialogTooltip')}>
195
+ <TooltipButton aria-label={t('resource.dialogTooltip')}>
200
196
  <HelpIcon invertedStyle={invertedStyle} />
201
197
  </TooltipButton>
202
198
  }
@@ -204,10 +200,10 @@ const ResourcesTopicTitle = ({
204
200
  {(onClose: () => void) => (
205
201
  <>
206
202
  <ModalHeader>
203
+ <ModalTitle>{t('resource.dialogHeading')}</ModalTitle>
207
204
  <ModalCloseButton title={t('modal.closeModal')} onClick={onClose} />
208
205
  </ModalHeader>
209
206
  <ModalBody>
210
- <h1>{t('resource.dialogHeading')}</h1>
211
207
  <hr />
212
208
  <p>{t('resource.dialogText1')}</p>
213
209
  <p>{t('resource.dialogText2')}</p>