@ndla/ui 35.0.15 → 35.0.18
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/README.md +1 -1
- package/es/Embed/conceptComponents.js +25 -21
- package/es/MyNdla/Resource/Folder.js +29 -26
- package/es/MyNdla/Resource/FolderMenu.js +74 -0
- package/es/MyNdla/SettingsMenu.js +98 -0
- package/es/MyNdla/index.js +3 -1
- package/es/Resource/BlockResource.js +8 -10
- package/es/Resource/ListResource.js +9 -17
- package/es/Resource/resourceComponents.js +11 -11
- package/es/index.js +1 -1
- package/es/locale/messages-en.js +3 -1
- package/es/locale/messages-nb.js +3 -1
- package/es/locale/messages-nn.js +3 -1
- package/es/locale/messages-se.js +3 -1
- package/es/locale/messages-sma.js +3 -1
- package/lib/Embed/conceptComponents.js +25 -21
- package/lib/MyNdla/Resource/Folder.d.ts +4 -3
- package/lib/MyNdla/Resource/Folder.js +29 -26
- package/lib/MyNdla/Resource/FolderMenu.d.ts +16 -0
- package/lib/MyNdla/Resource/FolderMenu.js +81 -0
- package/lib/MyNdla/SettingsMenu.d.ts +15 -0
- package/lib/MyNdla/SettingsMenu.js +96 -0
- package/lib/MyNdla/index.d.ts +3 -1
- package/lib/MyNdla/index.js +14 -0
- package/lib/Resource/BlockResource.js +8 -10
- package/lib/Resource/ListResource.d.ts +1 -2
- package/lib/Resource/ListResource.js +9 -17
- package/lib/Resource/resourceComponents.d.ts +1 -1
- package/lib/Resource/resourceComponents.js +11 -11
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -0
- package/lib/locale/messages-en.d.ts +2 -0
- package/lib/locale/messages-en.js +3 -1
- package/lib/locale/messages-nb.d.ts +2 -0
- package/lib/locale/messages-nb.js +3 -1
- package/lib/locale/messages-nn.d.ts +2 -0
- package/lib/locale/messages-nn.js +3 -1
- package/lib/locale/messages-se.d.ts +2 -0
- package/lib/locale/messages-se.js +3 -1
- package/lib/locale/messages-sma.d.ts +2 -0
- package/lib/locale/messages-sma.js +3 -1
- package/package.json +6 -6
- package/src/Embed/conceptComponents.tsx +6 -2
- package/src/MyNdla/Resource/Folder.tsx +31 -14
- package/src/MyNdla/Resource/FolderMenu.tsx +102 -0
- package/src/MyNdla/SettingsMenu.tsx +97 -0
- package/src/MyNdla/index.ts +3 -1
- package/src/Resource/BlockResource.tsx +3 -2
- package/src/Resource/ListResource.tsx +5 -7
- package/src/Resource/resourceComponents.tsx +2 -1
- package/src/index.ts +1 -1
- package/src/locale/messages-en.ts +3 -1
- package/src/locale/messages-nb.ts +3 -1
- package/src/locale/messages-nn.ts +3 -1
- package/src/locale/messages-se.ts +3 -1
- package/src/locale/messages-sma.ts +3 -1
|
@@ -1052,6 +1052,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1052
1052
|
resources_plural: '{{count}} ressurser',
|
|
1053
1053
|
folders: '{{count}} mappe',
|
|
1054
1054
|
folders_plural: '{{count}} mapper',
|
|
1055
|
+
settings: 'Instillinger',
|
|
1055
1056
|
folder: {
|
|
1056
1057
|
folder: 'Mappe',
|
|
1057
1058
|
"delete": 'Slett mappe',
|
|
@@ -1085,7 +1086,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1085
1086
|
},
|
|
1086
1087
|
button: {
|
|
1087
1088
|
share: 'Del mappen',
|
|
1088
|
-
preview: 'Forhåndsvis
|
|
1089
|
+
preview: 'Forhåndsvis mappe',
|
|
1089
1090
|
unShare: 'Avslutt deling',
|
|
1090
1091
|
shareLink: 'Kopier lenke'
|
|
1091
1092
|
}
|
|
@@ -1112,6 +1113,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
1112
1113
|
examLockInfo: 'Redigering av innhold på Min NDLA er deaktivert for elever i eksamensperioden.',
|
|
1113
1114
|
help: 'Hjelp',
|
|
1114
1115
|
more: 'Flere valg',
|
|
1116
|
+
selectView: 'Velg visning',
|
|
1115
1117
|
listView: 'Listevisning',
|
|
1116
1118
|
detailView: 'Detaljert listevisning',
|
|
1117
1119
|
shortView: 'Kort visning',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "35.0.
|
|
3
|
+
"version": "35.0.18",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ndla/article-scripts": "^3.0.17",
|
|
35
|
-
"@ndla/button": "^10.0.
|
|
35
|
+
"@ndla/button": "^10.0.8",
|
|
36
36
|
"@ndla/carousel": "^3.0.9",
|
|
37
37
|
"@ndla/core": "^3.1.3",
|
|
38
|
-
"@ndla/forms": "^4.2.
|
|
38
|
+
"@ndla/forms": "^4.2.17",
|
|
39
39
|
"@ndla/hooks": "^2.0.4",
|
|
40
40
|
"@ndla/icons": "^2.2.9",
|
|
41
41
|
"@ndla/licenses": "^7.0.4",
|
|
42
42
|
"@ndla/modal": "^2.2.13",
|
|
43
|
-
"@ndla/notion": "^4.2.
|
|
44
|
-
"@ndla/safelink": "^4.0.
|
|
43
|
+
"@ndla/notion": "^4.2.14",
|
|
44
|
+
"@ndla/safelink": "^4.0.18",
|
|
45
45
|
"@ndla/switch": "^1.0.8",
|
|
46
46
|
"@ndla/tabs": "^2.1.15",
|
|
47
47
|
"@ndla/tooltip": "^4.0.16",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "92fddede3f258a8af1712b11e296f8335754db07"
|
|
91
91
|
}
|
|
@@ -213,6 +213,10 @@ const ListWrapper = styled.div`
|
|
|
213
213
|
align-items: center;
|
|
214
214
|
`;
|
|
215
215
|
|
|
216
|
+
const StyledNotionDialogContent = styled(NotionDialogContent)`
|
|
217
|
+
padding-top: ${spacing.small};
|
|
218
|
+
`;
|
|
219
|
+
|
|
216
220
|
const StyledList = styled.ul`
|
|
217
221
|
display: flex;
|
|
218
222
|
gap: ${spacing.small};
|
|
@@ -292,7 +296,7 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
292
296
|
</h1>
|
|
293
297
|
{closeButton}
|
|
294
298
|
</NotionHeader>
|
|
295
|
-
<
|
|
299
|
+
<StyledNotionDialogContent>
|
|
296
300
|
{notionVisualElement && (
|
|
297
301
|
<StyledFigure resizeIframe type={'full-column'}>
|
|
298
302
|
{notionVisualElement.image?.src ? (
|
|
@@ -364,7 +368,7 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
364
368
|
</StyledFigure>
|
|
365
369
|
)}
|
|
366
370
|
<NotionDialogText>{parseMarkdown(content ?? '', 'body')}</NotionDialogText>
|
|
367
|
-
</
|
|
371
|
+
</StyledNotionDialogContent>
|
|
368
372
|
{tags && (
|
|
369
373
|
<ListWrapper>
|
|
370
374
|
{`${t('notions.tags')}:`}
|
|
@@ -13,10 +13,11 @@ import { FileDocumentOutline, Share } from '@ndla/icons/common';
|
|
|
13
13
|
import { fonts, spacing, colors, mq, breakpoints } from '@ndla/core';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import {
|
|
16
|
+
import { MenuItemProps } from '@ndla/button';
|
|
17
17
|
import { ResourceTitleLink } from '../../Resource/resourceComponents';
|
|
18
|
+
import FolderMenu from './FolderMenu';
|
|
18
19
|
|
|
19
|
-
type LayoutType = 'list' | 'listLarger' | 'block';
|
|
20
|
+
export type LayoutType = 'list' | 'listLarger' | 'block';
|
|
20
21
|
interface LayoutProps {
|
|
21
22
|
type: LayoutType;
|
|
22
23
|
}
|
|
@@ -82,7 +83,7 @@ const FolderTitle = styled.h2`
|
|
|
82
83
|
|
|
83
84
|
overflow: hidden;
|
|
84
85
|
text-overflow: ellipsis;
|
|
85
|
-
|
|
86
|
+
/* Unfortunate css needed for multi-line text overflow ellipsis. */
|
|
86
87
|
display: -webkit-box;
|
|
87
88
|
-webkit-line-clamp: 1;
|
|
88
89
|
line-clamp: 1;
|
|
@@ -158,37 +159,53 @@ interface Props {
|
|
|
158
159
|
subResources?: number;
|
|
159
160
|
description?: string;
|
|
160
161
|
link: string;
|
|
161
|
-
type
|
|
162
|
+
type?: LayoutType;
|
|
163
|
+
onViewTypeChange?: (type: LayoutType) => void;
|
|
162
164
|
menuItems?: MenuItemProps[];
|
|
163
165
|
isShared?: boolean;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
|
-
const Folder = ({
|
|
168
|
+
const Folder = ({
|
|
169
|
+
id,
|
|
170
|
+
link,
|
|
171
|
+
title,
|
|
172
|
+
subFolders,
|
|
173
|
+
subResources,
|
|
174
|
+
type = 'list',
|
|
175
|
+
menuItems,
|
|
176
|
+
isShared,
|
|
177
|
+
onViewTypeChange,
|
|
178
|
+
}: Props) => {
|
|
167
179
|
const { t } = useTranslation();
|
|
168
180
|
const Icon = isShared ? FolderShared : FolderOutlined;
|
|
169
181
|
|
|
170
182
|
return (
|
|
171
183
|
<FolderWrapper type={type} id={id}>
|
|
172
184
|
<TitleWrapper type={type}>
|
|
173
|
-
<IconWrapper
|
|
174
|
-
|
|
185
|
+
<IconWrapper
|
|
186
|
+
aria-label={`${isShared ? `${t('myNdla.folder.sharing.shared')} ` : ''}${t('myNdla.folder.folder')}`}
|
|
187
|
+
>
|
|
188
|
+
<Icon />
|
|
175
189
|
</IconWrapper>
|
|
176
190
|
<ResourceTitleLink to={link}>
|
|
177
191
|
<FolderTitle title={title}>{title}</FolderTitle>
|
|
178
192
|
</ResourceTitleLink>
|
|
179
193
|
</TitleWrapper>
|
|
180
194
|
<MenuWrapper>
|
|
181
|
-
{isShared && (
|
|
182
|
-
<IconTextWrapper type={type}>
|
|
183
|
-
<Share />
|
|
184
|
-
<span>{t('myNdla.folder.sharing.shared')}</span>
|
|
185
|
-
</IconTextWrapper>
|
|
186
|
-
)}
|
|
187
195
|
<CountContainer>
|
|
196
|
+
{isShared && (
|
|
197
|
+
// Information regarding the shared status of a folder is read previously, ignore this
|
|
198
|
+
<IconTextWrapper type={type} aria-hidden>
|
|
199
|
+
<Share />
|
|
200
|
+
<span>{t('myNdla.folder.sharing.shared')}</span>
|
|
201
|
+
</IconTextWrapper>
|
|
202
|
+
)}
|
|
188
203
|
<Count layoutType={type} type={'folder'} count={subFolders} />
|
|
189
204
|
<Count layoutType={type} type={'resource'} count={subResources} />
|
|
190
205
|
</CountContainer>
|
|
191
|
-
{menuItems && menuItems.length > 0 &&
|
|
206
|
+
{menuItems && menuItems.length > 0 && (
|
|
207
|
+
<FolderMenu menuItems={menuItems} viewType={type} onViewTypeChange={onViewTypeChange} />
|
|
208
|
+
)}
|
|
192
209
|
</MenuWrapper>
|
|
193
210
|
</FolderWrapper>
|
|
194
211
|
);
|
|
@@ -0,0 +1,102 @@
|
|
|
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 { MenuItemProps, ButtonV2 } from '@ndla/button';
|
|
10
|
+
import { FourlineHamburger, List } from '@ndla/icons/action';
|
|
11
|
+
import Tooltip from '@ndla/tooltip';
|
|
12
|
+
import styled from '@emotion/styled';
|
|
13
|
+
import { colors, spacing } from '@ndla/core';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { LayoutType } from './Folder';
|
|
16
|
+
import SettingsMenu from '../SettingsMenu';
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
menuItems: MenuItemProps[];
|
|
20
|
+
viewType?: LayoutType;
|
|
21
|
+
onViewTypeChange?: (type: LayoutType) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const ViewButtonWrapper = styled.div`
|
|
25
|
+
display: flex;
|
|
26
|
+
gap: ${spacing.small};
|
|
27
|
+
div,
|
|
28
|
+
button {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex: 1;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const ViewTypeWrapper = styled.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: ${spacing.xsmall};
|
|
38
|
+
padding: ${spacing.small};
|
|
39
|
+
border-bottom: 1px solid ${colors.brand.neutral7};
|
|
40
|
+
border-top: 1px solid ${colors.brand.neutral7};
|
|
41
|
+
span {
|
|
42
|
+
color: ${colors.brand.primary};
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const ViewButton = styled(ButtonV2)`
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
color: ${colors.brand.primary};
|
|
49
|
+
svg {
|
|
50
|
+
width: 40px;
|
|
51
|
+
height: 40px;
|
|
52
|
+
}
|
|
53
|
+
&[aria-current='true'] {
|
|
54
|
+
background-color: ${colors.brand.lightest};
|
|
55
|
+
}
|
|
56
|
+
&[aria-current='false'] {
|
|
57
|
+
color: ${colors.brand.light};
|
|
58
|
+
border-color: ${colors.brand.light};
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
const FolderMenu = ({ menuItems, viewType, onViewTypeChange }: Props) => {
|
|
63
|
+
const { t } = useTranslation();
|
|
64
|
+
return (
|
|
65
|
+
<SettingsMenu menuItems={menuItems}>
|
|
66
|
+
{(_) => {
|
|
67
|
+
if (!viewType || !onViewTypeChange) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return (
|
|
71
|
+
<ViewTypeWrapper>
|
|
72
|
+
<span>{t('myNdla.selectView')}</span>
|
|
73
|
+
<ViewButtonWrapper>
|
|
74
|
+
<Tooltip tooltip={t('myNdla.listView')}>
|
|
75
|
+
<ViewButton
|
|
76
|
+
size="large"
|
|
77
|
+
aria-current={viewType === 'list'}
|
|
78
|
+
colorTheme="primary"
|
|
79
|
+
onClick={() => onViewTypeChange('list')}
|
|
80
|
+
>
|
|
81
|
+
<FourlineHamburger />
|
|
82
|
+
</ViewButton>
|
|
83
|
+
</Tooltip>
|
|
84
|
+
<Tooltip tooltip={t('myNdla.detailView')}>
|
|
85
|
+
<ViewButton
|
|
86
|
+
size="large"
|
|
87
|
+
aria-current={viewType === 'listLarger'}
|
|
88
|
+
colorTheme="primary"
|
|
89
|
+
onClick={() => onViewTypeChange('listLarger')}
|
|
90
|
+
>
|
|
91
|
+
<List />
|
|
92
|
+
</ViewButton>
|
|
93
|
+
</Tooltip>
|
|
94
|
+
</ViewButtonWrapper>
|
|
95
|
+
</ViewTypeWrapper>
|
|
96
|
+
);
|
|
97
|
+
}}
|
|
98
|
+
</SettingsMenu>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default FolderMenu;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 { ReactNode } from 'react';
|
|
10
|
+
import styled from '@emotion/styled';
|
|
11
|
+
import { isMobile, isTablet } from 'react-device-detect';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
13
|
+
import { IconButtonV2, MenuItemProps, MenuButton, ButtonV2 } from '@ndla/button';
|
|
14
|
+
import { Drawer, ModalBody, ModalCloseButton, ModalHeaderV2 } from '@ndla/modal';
|
|
15
|
+
import { HorizontalMenu } from '@ndla/icons/contentType';
|
|
16
|
+
import { breakpoints, colors, misc, mq, spacing } from '@ndla/core';
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
menuItems?: MenuItemProps[];
|
|
20
|
+
children?: (close: () => void) => ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const StyledDrawer = styled(Drawer)`
|
|
24
|
+
max-height: 100%;
|
|
25
|
+
border-top-left-radius: ${misc.borderRadius};
|
|
26
|
+
border-top-right-radius: ${misc.borderRadius};
|
|
27
|
+
${mq.range({ until: breakpoints.tablet })} {
|
|
28
|
+
min-height: 20%;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
const Ul = styled.ul`
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: 0;
|
|
35
|
+
list-style: none;
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const StyledModalBody = styled(ModalBody)`
|
|
39
|
+
padding: 0 0 ${spacing.large} 0px;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const Li = styled.li`
|
|
43
|
+
border-bottom: 1px solid ${colors.brand.neutral7};
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
const SettingsMenu = ({ menuItems, children }: Props) => {
|
|
47
|
+
const { t } = useTranslation();
|
|
48
|
+
if (isMobile || isTablet) {
|
|
49
|
+
return (
|
|
50
|
+
<StyledDrawer
|
|
51
|
+
expands
|
|
52
|
+
position="bottom"
|
|
53
|
+
size="small"
|
|
54
|
+
activateButton={
|
|
55
|
+
<IconButtonV2 aria-label={t('myNdla.more')} colorTheme="light" variant="ghost">
|
|
56
|
+
<HorizontalMenu />
|
|
57
|
+
</IconButtonV2>
|
|
58
|
+
}
|
|
59
|
+
>
|
|
60
|
+
{(close) => (
|
|
61
|
+
<>
|
|
62
|
+
<ModalHeaderV2>
|
|
63
|
+
<h1>{t('myNdla.settings')}</h1>
|
|
64
|
+
<ModalCloseButton onClick={close} />
|
|
65
|
+
</ModalHeaderV2>
|
|
66
|
+
<StyledModalBody>
|
|
67
|
+
{children?.(close)}
|
|
68
|
+
{!!menuItems?.length && (
|
|
69
|
+
<Ul>
|
|
70
|
+
{menuItems.map((item, i) => (
|
|
71
|
+
<Li key={i}>
|
|
72
|
+
<ButtonV2
|
|
73
|
+
fontWeight="normal"
|
|
74
|
+
variant="ghost"
|
|
75
|
+
colorTheme={item.type}
|
|
76
|
+
onClick={(e) => {
|
|
77
|
+
close();
|
|
78
|
+
item.onClick(e);
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{item.icon}
|
|
82
|
+
{item.text}
|
|
83
|
+
</ButtonV2>
|
|
84
|
+
</Li>
|
|
85
|
+
))}
|
|
86
|
+
</Ul>
|
|
87
|
+
)}
|
|
88
|
+
</StyledModalBody>
|
|
89
|
+
</>
|
|
90
|
+
)}
|
|
91
|
+
</StyledDrawer>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return <MenuButton align="end" size="small" menuItems={menuItems} />;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default SettingsMenu;
|
package/src/MyNdla/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import Folder from './Resource/Folder';
|
|
2
2
|
import FolderInput from './Resource/FolderInput';
|
|
3
|
-
|
|
3
|
+
import FolderMenu from './Resource/FolderMenu';
|
|
4
|
+
import SettingsMenu from './SettingsMenu';
|
|
5
|
+
export { Folder, FolderInput, SettingsMenu, FolderMenu };
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { colors, fonts, spacing } from '@ndla/core';
|
|
12
|
-
import {
|
|
12
|
+
import { MenuItemProps } from '@ndla/button';
|
|
13
13
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
14
14
|
import Image from '../Image';
|
|
15
15
|
import {
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from './resourceComponents';
|
|
24
24
|
import ContentLoader from '../ContentLoader';
|
|
25
25
|
import { contentTypeMapping } from '../model/ContentType';
|
|
26
|
+
import { SettingsMenu } from '../MyNdla';
|
|
26
27
|
|
|
27
28
|
const BlockElementWrapper = styled.div`
|
|
28
29
|
display: flex;
|
|
@@ -188,7 +189,7 @@ const BlockResource = ({
|
|
|
188
189
|
</ContentWrapper>
|
|
189
190
|
<TagsAndActionMenu>
|
|
190
191
|
{tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
191
|
-
{menuItems && menuItems.length > 0 && <
|
|
192
|
+
{menuItems && menuItems.length > 0 && <SettingsMenu menuItems={menuItems} />}
|
|
192
193
|
</TagsAndActionMenu>
|
|
193
194
|
</BlockInfoWrapper>
|
|
194
195
|
</BlockElementWrapper>
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
|
-
import React
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { fonts, spacing, colors, breakpoints, mq } from '@ndla/core';
|
|
12
|
-
import {
|
|
12
|
+
import { MenuItemProps } from '@ndla/button';
|
|
13
13
|
import Image from '../Image';
|
|
14
14
|
import {
|
|
15
15
|
CompressedTagList,
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
import ContentLoader from '../ContentLoader';
|
|
24
24
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
25
25
|
import { contentTypeMapping } from '../model/ContentType';
|
|
26
|
+
import { SettingsMenu } from '../MyNdla';
|
|
26
27
|
|
|
27
28
|
const ListResourceWrapper = styled.div`
|
|
28
29
|
flex: 1;
|
|
@@ -196,7 +197,6 @@ export interface ListResourceProps {
|
|
|
196
197
|
tagLinkPrefix?: string;
|
|
197
198
|
title: string;
|
|
198
199
|
resourceImage: ResourceImageProps;
|
|
199
|
-
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
200
200
|
resourceTypes: { id: string; name: string }[];
|
|
201
201
|
tags?: string[];
|
|
202
202
|
description?: string;
|
|
@@ -213,7 +213,6 @@ const ListResource = ({
|
|
|
213
213
|
tags,
|
|
214
214
|
resourceImage,
|
|
215
215
|
resourceTypes,
|
|
216
|
-
headingLevel = 'h2',
|
|
217
216
|
description,
|
|
218
217
|
menuItems,
|
|
219
218
|
isLoading = false,
|
|
@@ -222,7 +221,6 @@ const ListResource = ({
|
|
|
222
221
|
const showDescription = description !== undefined;
|
|
223
222
|
const imageType = showDescription ? 'normal' : 'compact';
|
|
224
223
|
const firstContentType = resourceTypes?.[0]?.id ?? '';
|
|
225
|
-
const Title = ResourceTitle.withComponent(headingLevel);
|
|
226
224
|
|
|
227
225
|
return (
|
|
228
226
|
<ListResourceWrapper id={id}>
|
|
@@ -237,7 +235,7 @@ const ListResource = ({
|
|
|
237
235
|
<TopicAndTitleWrapper>
|
|
238
236
|
<TypeAndTitleLoader loading={isLoading}>
|
|
239
237
|
<StyledLink to={link} target={targetBlank ? '_blank' : undefined}>
|
|
240
|
-
<
|
|
238
|
+
<ResourceTitle title={title}>{title}</ResourceTitle>
|
|
241
239
|
</StyledLink>
|
|
242
240
|
<ResourceTypeList resourceTypes={resourceTypes} />
|
|
243
241
|
</TypeAndTitleLoader>
|
|
@@ -245,7 +243,7 @@ const ListResource = ({
|
|
|
245
243
|
{showDescription && <Description description={description} loading={isLoading} />}
|
|
246
244
|
<TagsandActionMenu>
|
|
247
245
|
{tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
248
|
-
{menuItems && menuItems.length > 0 && <
|
|
246
|
+
{menuItems && menuItems.length > 0 && <SettingsMenu menuItems={menuItems} />}
|
|
249
247
|
</TagsandActionMenu>
|
|
250
248
|
</ListResourceWrapper>
|
|
251
249
|
);
|
|
@@ -35,10 +35,11 @@ export const ResourceTitleLink = styled(SafeLink)`
|
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
37
|
|
|
38
|
-
export const ResourceTitle = styled.
|
|
38
|
+
export const ResourceTitle = styled.span`
|
|
39
39
|
margin: 0;
|
|
40
40
|
overflow: hidden;
|
|
41
41
|
text-overflow: ellipsis;
|
|
42
|
+
font-weight: ${fonts.weight.bold};
|
|
42
43
|
// Unfortunate css needed for multi-line text overflow ellipsis.
|
|
43
44
|
line-height: 1;
|
|
44
45
|
display: -webkit-box;
|
package/src/index.ts
CHANGED
|
@@ -255,7 +255,7 @@ export { Notion, ConceptNotion } from './Notion';
|
|
|
255
255
|
export type { NotionVisualElementType, ConceptNotionType } from './Notion';
|
|
256
256
|
|
|
257
257
|
export { BannerCard } from './BannerCard';
|
|
258
|
-
export { Folder, FolderInput } from './MyNdla';
|
|
258
|
+
export { Folder, FolderInput, FolderMenu } from './MyNdla';
|
|
259
259
|
export { ListResource, BlockResource } from './Resource';
|
|
260
260
|
export type { ListResourceProps } from './Resource';
|
|
261
261
|
export type { TagType } from './TagSelector';
|
|
@@ -1101,6 +1101,7 @@ const messages = {
|
|
|
1101
1101
|
resources_plural: '{{count}} Resources',
|
|
1102
1102
|
folders: '{{count}} Folder',
|
|
1103
1103
|
folders_plural: '{{count}} Folders',
|
|
1104
|
+
settings: 'Settings',
|
|
1104
1105
|
folder: {
|
|
1105
1106
|
folder: 'Folder',
|
|
1106
1107
|
delete: 'Delete folder',
|
|
@@ -1138,7 +1139,7 @@ const messages = {
|
|
|
1138
1139
|
},
|
|
1139
1140
|
button: {
|
|
1140
1141
|
share: 'Share folder',
|
|
1141
|
-
preview: 'Preview
|
|
1142
|
+
preview: 'Preview folder',
|
|
1142
1143
|
unShare: 'Stop sharing',
|
|
1143
1144
|
shareLink: 'Copy link',
|
|
1144
1145
|
},
|
|
@@ -1167,6 +1168,7 @@ const messages = {
|
|
|
1167
1168
|
examLockInfo: 'Editing content on Min NDLA is deactivated for pupils during the exam period.',
|
|
1168
1169
|
help: 'Help',
|
|
1169
1170
|
more: 'More options',
|
|
1171
|
+
selectView: 'Select view',
|
|
1170
1172
|
listView: 'List view',
|
|
1171
1173
|
detailView: 'Detailed listview',
|
|
1172
1174
|
shortView: 'Card view',
|
|
@@ -1100,6 +1100,7 @@ const messages = {
|
|
|
1100
1100
|
resources_plural: '{{count}} ressurser',
|
|
1101
1101
|
folders: '{{count}} mappe',
|
|
1102
1102
|
folders_plural: '{{count}} mapper',
|
|
1103
|
+
settings: 'Instillinger',
|
|
1103
1104
|
folder: {
|
|
1104
1105
|
folder: 'Mappe',
|
|
1105
1106
|
delete: 'Slett mappe',
|
|
@@ -1136,7 +1137,7 @@ const messages = {
|
|
|
1136
1137
|
},
|
|
1137
1138
|
button: {
|
|
1138
1139
|
share: 'Del mappen',
|
|
1139
|
-
preview: 'Forhåndsvis
|
|
1140
|
+
preview: 'Forhåndsvis mappe',
|
|
1140
1141
|
unShare: 'Avslutt deling',
|
|
1141
1142
|
shareLink: 'Kopier lenke',
|
|
1142
1143
|
},
|
|
@@ -1164,6 +1165,7 @@ const messages = {
|
|
|
1164
1165
|
examLockInfo: 'Redigering av innhold på Min NDLA er deaktivert for elever i eksamensperioden.',
|
|
1165
1166
|
help: 'Hjelp',
|
|
1166
1167
|
more: 'Flere valg',
|
|
1168
|
+
selectView: 'Velg visning',
|
|
1167
1169
|
listView: 'Listevisning',
|
|
1168
1170
|
detailView: 'Detaljert listevisning',
|
|
1169
1171
|
shortView: 'Kort visning',
|
|
@@ -1100,6 +1100,7 @@ const messages = {
|
|
|
1100
1100
|
resources_plural: '{{count}} ressursar',
|
|
1101
1101
|
folders: '{{count}} mappe',
|
|
1102
1102
|
folders_plural: '{{count}} mapper',
|
|
1103
|
+
settings: 'Instillinger',
|
|
1103
1104
|
folder: {
|
|
1104
1105
|
folder: 'Mappe',
|
|
1105
1106
|
delete: 'Slett mappe',
|
|
@@ -1136,7 +1137,7 @@ const messages = {
|
|
|
1136
1137
|
},
|
|
1137
1138
|
button: {
|
|
1138
1139
|
share: 'Del mappa',
|
|
1139
|
-
preview: 'Førehandsvis
|
|
1140
|
+
preview: 'Førehandsvis mappe',
|
|
1140
1141
|
unShare: 'Avslutt deling',
|
|
1141
1142
|
shareLink: 'Kopier lenke',
|
|
1142
1143
|
},
|
|
@@ -1164,6 +1165,7 @@ const messages = {
|
|
|
1164
1165
|
examLockInfo: 'Redigering av innhald på Min NDLA er deaktivert for elevar i eksamensperioden.',
|
|
1165
1166
|
help: 'Hjelp',
|
|
1166
1167
|
more: 'Fleire val',
|
|
1168
|
+
selectView: 'Velg visning',
|
|
1167
1169
|
listView: 'Listevisning',
|
|
1168
1170
|
detailView: 'Detaljert listevisning',
|
|
1169
1171
|
shortView: 'Kortvisning',
|
|
@@ -1101,6 +1101,7 @@ const messages = {
|
|
|
1101
1101
|
resources_plural: '{{count}} resurssat',
|
|
1102
1102
|
folders: '{{count}} máhpat',
|
|
1103
1103
|
folders_plural: '{{count}} mapper',
|
|
1104
|
+
settings: 'Instillinger',
|
|
1104
1105
|
folder: {
|
|
1105
1106
|
folder: 'Máhppa',
|
|
1106
1107
|
delete: 'Sihko máhpa',
|
|
@@ -1137,7 +1138,7 @@ const messages = {
|
|
|
1137
1138
|
},
|
|
1138
1139
|
button: {
|
|
1139
1140
|
share: 'Del mappen',
|
|
1140
|
-
preview: 'Forhåndsvis
|
|
1141
|
+
preview: 'Forhåndsvis mappe',
|
|
1141
1142
|
unShare: 'Avslutt deling',
|
|
1142
1143
|
shareLink: 'Kopier lenke',
|
|
1143
1144
|
},
|
|
@@ -1165,6 +1166,7 @@ const messages = {
|
|
|
1165
1166
|
examLockInfo: 'Mu NDLA sisdoalu redigeren ii leat doaimmas ohppiide eksámenáigodagas.',
|
|
1166
1167
|
help: 'Veahkki',
|
|
1167
1168
|
more: 'Eanet válljejumit',
|
|
1169
|
+
selectView: 'Velg visning',
|
|
1168
1170
|
listView: 'Oppalašlistu',
|
|
1169
1171
|
detailView: 'Bienalaš oppalašlistu',
|
|
1170
1172
|
shortView: 'Oanehis listu',
|
|
@@ -1104,6 +1104,7 @@ const messages = {
|
|
|
1104
1104
|
resources_plural: '{{count}} ressurser',
|
|
1105
1105
|
folders: '{{count}} mappe',
|
|
1106
1106
|
folders_plural: '{{count}} mapper',
|
|
1107
|
+
settings: 'Instillinger',
|
|
1107
1108
|
folder: {
|
|
1108
1109
|
folder: 'Mappe',
|
|
1109
1110
|
delete: 'Slett mappe',
|
|
@@ -1140,7 +1141,7 @@ const messages = {
|
|
|
1140
1141
|
},
|
|
1141
1142
|
button: {
|
|
1142
1143
|
share: 'Del mappen',
|
|
1143
|
-
preview: 'Forhåndsvis
|
|
1144
|
+
preview: 'Forhåndsvis mappe',
|
|
1144
1145
|
unShare: 'Avslutt deling',
|
|
1145
1146
|
shareLink: 'Kopier lenke',
|
|
1146
1147
|
},
|
|
@@ -1169,6 +1170,7 @@ const messages = {
|
|
|
1169
1170
|
examLockInfo: 'Redigering av innhold på Min NDLA er deaktivert for elever i eksamensperioden.',
|
|
1170
1171
|
help: 'Hjelp',
|
|
1171
1172
|
more: 'Flere valg',
|
|
1173
|
+
selectView: 'Velg visning',
|
|
1172
1174
|
listView: 'Listevisning',
|
|
1173
1175
|
detailView: 'Detaljert listevisning',
|
|
1174
1176
|
shortView: 'Kort visning',
|