@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.
- package/es/Article/Article.js +2 -2
- package/es/Article/ArticleHeaderWrapper.js +4 -7
- package/es/Article/ArticleNotions.js +16 -17
- package/es/Article/ArticleSideBar.js +4 -5
- package/es/AudioPlayer/Controls.js +187 -237
- package/es/BlogPost/BlogPost.js +4 -4
- package/es/CompetenceGoals/CompetenceGoalsDialog.js +12 -25
- package/es/Filter/FilterButtons.js +12 -14
- package/es/Filter/FilterListPhone.js +2 -4
- package/es/Footer/index.js +1 -2
- package/es/Grid/Grid.js +41 -0
- package/es/Grid/index.js +9 -0
- package/es/LearningPaths/LearningPathMenuModalWrapper.js +10 -6
- package/es/Masthead/MastheadSearchModal.js +56 -47
- package/es/MyNdla/SettingsMenu.js +6 -6
- package/es/NDLAFilm/AboutNdlaFilm.js +3 -3
- package/es/ResourcesWrapper/ResourcesTopicTitle.js +19 -23
- package/es/SearchTypeResult/PopupFilter.js +14 -20
- package/es/SearchTypeResult/components/ItemContexts.js +10 -21
- package/es/Topic/Topic.js +23 -23
- package/es/User/index.js +1 -3
- package/es/index.js +2 -3
- package/es/locale/messages-en.js +1 -0
- package/es/locale/messages-nb.js +1 -0
- package/es/locale/messages-nn.js +1 -0
- package/es/locale/messages-se.js +1 -0
- package/es/locale/messages-sma.js +1 -0
- package/lib/Article/Article.d.ts +2 -2
- package/lib/Article/Article.js +2 -2
- package/lib/Article/ArticleHeaderWrapper.d.ts +3 -2
- package/lib/Article/ArticleHeaderWrapper.js +4 -7
- package/lib/Article/ArticleNotions.js +17 -21
- package/lib/Article/ArticleSideBar.js +5 -9
- package/lib/AudioPlayer/Controls.d.ts +2 -2
- package/lib/AudioPlayer/Controls.js +187 -237
- package/lib/BlogPost/BlogPost.d.ts +1 -1
- package/lib/BlogPost/BlogPost.js +4 -4
- package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +3 -14
- package/lib/CompetenceGoals/CompetenceGoalsDialog.js +11 -26
- package/lib/Filter/FilterButtons.js +13 -15
- package/lib/Filter/FilterListPhone.js +3 -5
- package/lib/Footer/index.d.ts +1 -2
- package/lib/Footer/index.js +0 -7
- package/lib/Grid/Grid.d.ts +15 -0
- package/lib/Grid/Grid.js +48 -0
- package/lib/Grid/index.d.ts +9 -0
- package/lib/Grid/index.js +13 -0
- package/lib/LearningPaths/LearningPathMenuModalWrapper.js +9 -8
- package/lib/Masthead/MastheadSearchModal.d.ts +1 -1
- package/lib/Masthead/MastheadSearchModal.js +58 -46
- package/lib/MyNdla/SettingsMenu.js +5 -5
- package/lib/NDLAFilm/AboutNdlaFilm.js +2 -2
- package/lib/ResourcesWrapper/ResourcesTopicTitle.js +20 -27
- package/lib/SearchTypeResult/PopupFilter.js +14 -20
- package/lib/SearchTypeResult/components/ItemContexts.js +10 -21
- package/lib/Topic/Topic.js +22 -22
- package/lib/User/index.d.ts +0 -2
- package/lib/User/index.js +1 -13
- package/lib/index.d.ts +3 -3
- package/lib/index.js +8 -20
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +1 -0
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +1 -0
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +1 -0
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +1 -0
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +1 -0
- package/package.json +20 -22
- package/src/Article/Article.tsx +4 -4
- package/src/Article/ArticleHeaderWrapper.tsx +12 -18
- package/src/Article/ArticleNotions.tsx +7 -8
- package/src/Article/ArticleSideBar.tsx +3 -3
- package/src/AudioPlayer/Controls.tsx +150 -289
- package/src/BlogPost/BlogPost.stories.tsx +15 -12
- package/src/BlogPost/BlogPost.tsx +1 -1
- package/src/CompetenceGoals/CompetenceGoalsDialog.tsx +13 -38
- package/src/Filter/FilterButtons.tsx +4 -5
- package/src/Filter/FilterListPhone.tsx +3 -4
- package/src/Footer/index.ts +1 -2
- package/src/Grid/Grid.stories.tsx +68 -0
- package/src/Grid/Grid.tsx +63 -0
- package/src/Grid/index.ts +10 -0
- package/src/KeyFigure/KeyFigure.stories.tsx +10 -8
- package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +10 -6
- package/src/Masthead/MastheadSearchModal.tsx +48 -74
- package/src/MyNdla/SettingsMenu.tsx +3 -3
- package/src/NDLAFilm/AboutNdlaFilm.tsx +3 -3
- package/src/ResourcesWrapper/ResourcesTopicTitle.tsx +4 -8
- package/src/SearchTypeResult/PopupFilter.tsx +6 -11
- package/src/SearchTypeResult/components/ItemContexts.tsx +4 -21
- package/src/Topic/Topic.tsx +7 -7
- package/src/User/index.ts +0 -2
- package/src/index.ts +3 -3
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/src/locale/messages-sma.ts +1 -0
- package/es/Figure/FigureLicenseDialogContent.js +0 -75
- package/es/Footer/FooterAuth.js +0 -110
- package/es/Masthead/MastheadAuthModal.js +0 -50
- package/es/SearchTypeResult/SearchNotionItem.js +0 -208
- package/es/User/AuthModal.js +0 -116
- package/lib/Figure/FigureLicenseDialogContent.d.ts +0 -22
- package/lib/Figure/FigureLicenseDialogContent.js +0 -80
- package/lib/Footer/FooterAuth.d.ts +0 -10
- package/lib/Footer/FooterAuth.js +0 -114
- package/lib/Masthead/MastheadAuthModal.d.ts +0 -13
- package/lib/Masthead/MastheadAuthModal.js +0 -56
- package/lib/SearchTypeResult/SearchNotionItem.d.ts +0 -29
- package/lib/SearchTypeResult/SearchNotionItem.js +0 -215
- package/lib/User/AuthModal.d.ts +0 -22
- package/lib/User/AuthModal.js +0 -124
- package/src/Figure/FigureLicenseDialogContent.tsx +0 -80
- package/src/Footer/FooterAuth.tsx +0 -104
- package/src/Masthead/MastheadAuthModal.tsx +0 -62
- package/src/SearchTypeResult/SearchNotionItem.tsx +0 -228
- package/src/User/AuthModal.tsx +0 -123
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { ReactNode } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
|
-
import { breakpoints,
|
|
12
|
-
import
|
|
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 = ({
|
|
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
|
|
52
|
+
<ModalHeader>
|
|
78
53
|
<HeaderWrapper>
|
|
79
|
-
<
|
|
80
|
-
<FooterHeaderIcon
|
|
54
|
+
<ModalTitle>
|
|
55
|
+
<FooterHeaderIcon size="24px" style={{ marginRight: '20px' }} />
|
|
81
56
|
{t('competenceGoals.modalText')} {subjectName && ` \u2022 ${subjectName}`}
|
|
82
|
-
</
|
|
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
|
|
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="
|
|
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
|
|
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
|
|
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="
|
|
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
|
|
150
|
+
<ModalHeader>
|
|
152
151
|
<div {...classes('modal-header')}>
|
|
153
152
|
<div {...classes('modal-heading')}>
|
|
154
153
|
{!isNarrowScreen && label && <h1 {...classes('label')}>{label}</h1>}
|
package/src/Footer/index.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
-
<
|
|
42
|
-
backgroundColor="grey"
|
|
46
|
+
<StyledModal
|
|
43
47
|
animationDuration={200}
|
|
44
|
-
size="
|
|
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
|
-
</
|
|
64
|
+
</StyledModal>
|
|
61
65
|
);
|
|
62
66
|
}
|
|
63
67
|
return <>{children(() => {})}</>;
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import React, { ReactChild, ReactChildren, ReactNode } from 'react';
|
|
2
|
-
import
|
|
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 {
|
|
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:
|
|
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:
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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,
|
|
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
|
-
<
|
|
61
|
+
<ModalHeader>
|
|
62
62
|
<h1>{t('myNdla.settings')}</h1>
|
|
63
63
|
<ModalCloseButton onClick={close} />
|
|
64
|
-
</
|
|
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,
|
|
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
|
-
<
|
|
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
|
-
</
|
|
76
|
+
</Modal>
|
|
77
77
|
</div>
|
|
78
78
|
</StyledAside>
|
|
79
79
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import 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
|
|
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
|
|
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>
|