@ndla/ui 42.1.2 → 43.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 (52) hide show
  1. package/es/AudioPlayer/Controls.js +41 -39
  2. package/es/Breadcrumb/index.js +0 -1
  3. package/es/LanguageSelector/LanguageSelector.js +31 -36
  4. package/es/MyNdla/Resource/Folder.js +10 -16
  5. package/es/MyNdla/index.js +1 -3
  6. package/es/Resource/BlockResource.js +8 -11
  7. package/es/Resource/ListResource.js +8 -11
  8. package/es/Resource/resourceComponents.js +46 -35
  9. package/es/TreeStructure/FolderItem.js +7 -11
  10. package/es/index.js +2 -2
  11. package/lib/AudioPlayer/Controls.js +40 -38
  12. package/lib/Breadcrumb/index.d.ts +0 -1
  13. package/lib/Breadcrumb/index.js +0 -7
  14. package/lib/LanguageSelector/LanguageSelector.js +31 -36
  15. package/lib/MyNdla/Resource/Folder.d.ts +3 -4
  16. package/lib/MyNdla/Resource/Folder.js +10 -16
  17. package/lib/MyNdla/index.d.ts +1 -3
  18. package/lib/MyNdla/index.js +0 -14
  19. package/lib/Resource/BlockResource.d.ts +3 -3
  20. package/lib/Resource/BlockResource.js +8 -11
  21. package/lib/Resource/ListResource.d.ts +3 -3
  22. package/lib/Resource/ListResource.js +8 -11
  23. package/lib/Resource/resourceComponents.js +45 -34
  24. package/lib/TreeStructure/FolderItem.js +7 -11
  25. package/lib/index.d.ts +2 -2
  26. package/lib/index.js +0 -12
  27. package/package.json +9 -10
  28. package/src/AudioPlayer/Controls.tsx +22 -26
  29. package/src/Breadcrumb/index.ts +0 -2
  30. package/src/LanguageSelector/LanguageSelector.tsx +26 -32
  31. package/src/MyNdla/Resource/Folder.stories.tsx +27 -5
  32. package/src/MyNdla/Resource/Folder.tsx +4 -19
  33. package/src/MyNdla/index.ts +1 -3
  34. package/src/Resource/BlockResource.stories.tsx +1 -1
  35. package/src/Resource/BlockResource.tsx +4 -6
  36. package/src/Resource/ListResource.tsx +4 -6
  37. package/src/Resource/Resource.stories.tsx +32 -2
  38. package/src/Resource/resourceComponents.tsx +34 -24
  39. package/src/TreeStructure/FolderItem.tsx +2 -4
  40. package/src/index.ts +2 -2
  41. package/es/Breadcrumb/ActionBreadcrumb.js +0 -74
  42. package/es/MyNdla/Resource/FolderMenu.js +0 -74
  43. package/es/MyNdla/SettingsMenu.js +0 -98
  44. package/lib/Breadcrumb/ActionBreadcrumb.d.ts +0 -15
  45. package/lib/Breadcrumb/ActionBreadcrumb.js +0 -82
  46. package/lib/MyNdla/Resource/FolderMenu.d.ts +0 -16
  47. package/lib/MyNdla/Resource/FolderMenu.js +0 -81
  48. package/lib/MyNdla/SettingsMenu.d.ts +0 -15
  49. package/lib/MyNdla/SettingsMenu.js +0 -102
  50. package/src/Breadcrumb/ActionBreadcrumb.tsx +0 -87
  51. package/src/MyNdla/Resource/FolderMenu.tsx +0 -102
  52. package/src/MyNdla/SettingsMenu.tsx +0 -96
@@ -8,14 +8,14 @@
8
8
 
9
9
  import React, { useEffect, useRef, useState } from 'react';
10
10
  import styled from '@emotion/styled';
11
- import { Root, Trigger, Item, Content, DropdownMenuPortal } from '@radix-ui/react-dropdown-menu';
12
11
  import { Root as SliderRoot, Track, Range, SliderThumb } from '@radix-ui/react-slider';
13
12
  import { Root as PopoverRoot, PopoverContent, PopoverTrigger, PopoverPortal } from '@radix-ui/react-popover';
14
13
  import { Play, Pause, VolumeUp } from '@ndla/icons/common';
15
- import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
14
+ import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
16
15
  import { useTranslation } from 'react-i18next';
17
16
  import { Back15, Forward15 } from '@ndla/icons/action';
18
17
  import { ButtonV2, IconButtonV2 } from '@ndla/button';
18
+ import { DropdownMenu, DropdownContent, DropdownItem, DropdownTrigger } from '@ndla/dropdown-menu';
19
19
 
20
20
  const ControlsWrapper = styled.div`
21
21
  border: 1px solid ${colors.brand.lighter};
@@ -59,22 +59,15 @@ const SpeedButton = styled(ButtonV2)`
59
59
  }
60
60
  `;
61
61
 
62
- const SpeedList = styled(Content)`
63
- background: ${colors.white};
62
+ const SpeedList = styled(DropdownContent)`
64
63
  border: 1px solid ${colors.brand.lighter};
65
- border-radius: ${misc.borderRadius};
66
64
  padding: 5px 10px;
67
- display: flex;
68
- flex-direction: column;
69
65
  justify-content: center;
70
66
  `;
71
67
 
72
- const SpeedValueButton = styled(Item)`
73
- height: 28px;
68
+ const SpeedValueButton = styled(ButtonV2)`
74
69
  padding: 0 14px;
75
- cursor: pointer;
76
- font-weight: ${fonts.weight.semibold};
77
- ${fonts.sizes('14px')};
70
+ gap: 0px;
78
71
  color: ${colors.text.light};
79
72
  display: flex;
80
73
  justify-content: center;
@@ -82,14 +75,13 @@ const SpeedValueButton = styled(Item)`
82
75
  &:active,
83
76
  &:focus,
84
77
  &[data-highlighted] {
85
- background: ${colors.brand.greyLighter};
86
- border-radius: 5px;
87
78
  outline: none;
88
79
  color: ${colors.text.primary};
89
80
  }
90
81
  `;
91
82
 
92
83
  const SpeedSelectedMark = styled.span`
84
+ align-self: flex-start;
93
85
  border-radius: 50%;
94
86
  background: #d1372e;
95
87
  width: 6px;
@@ -311,9 +303,8 @@ const Controls = ({ src, title }: Props) => {
311
303
  >
312
304
  <Back15 />
313
305
  </Back15SecButton>
314
-
315
- <Root>
316
- <Trigger asChild>
306
+ <DropdownMenu>
307
+ <DropdownTrigger>
317
308
  <SpeedButton
318
309
  shape="pill"
319
310
  variant="ghost"
@@ -324,17 +315,22 @@ const Controls = ({ src, title }: Props) => {
324
315
  >
325
316
  {speedValue}x
326
317
  </SpeedButton>
327
- </Trigger>
328
- <DropdownMenuPortal>
329
- <SpeedList side="top">
330
- {speedValues.map((speed) => (
331
- <SpeedValueButton key={speed} onSelect={() => setSpeedValue(speed)}>
318
+ </DropdownTrigger>
319
+ <SpeedList side="top">
320
+ {speedValues.map((speed) => (
321
+ <DropdownItem key={speed}>
322
+ <SpeedValueButton
323
+ variant="ghost"
324
+ colorTheme="greyLighter"
325
+ size="small"
326
+ onSelect={() => setSpeedValue(speed)}
327
+ >
332
328
  {speed}x{speed === speedValue && <SpeedSelectedMark />}
333
329
  </SpeedValueButton>
334
- ))}
335
- </SpeedList>
336
- </DropdownMenuPortal>
337
- </Root>
330
+ </DropdownItem>
331
+ ))}
332
+ </SpeedList>
333
+ </DropdownMenu>
338
334
  <Forward15SecButton
339
335
  colorTheme="greyLighter"
340
336
  variant="ghost"
@@ -14,6 +14,4 @@ export { default as HeaderBreadcrumb } from './HeaderBreadcrumb';
14
14
 
15
15
  export { default as HomeBreadcrumb } from './HomeBreadcrumb';
16
16
 
17
- export { default as ActionBreadcrumb } from './ActionBreadcrumb';
18
-
19
17
  export default Breadcrumb;
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import React from 'react';
10
- import { Root, Trigger, Item, Content, Portal, Arrow } from '@radix-ui/react-dropdown-menu';
10
+ import { DropdownMenu, DropdownTrigger, DropdownContent, DropdownItem } from '@ndla/dropdown-menu';
11
11
  import { ButtonV2 } from '@ndla/button';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { ChevronDown } from '@ndla/icons/common';
@@ -20,15 +20,12 @@ interface Props<T extends string> {
20
20
  inverted?: boolean;
21
21
  }
22
22
 
23
- const PopoverContent = styled(Content)`
24
- z-index: 9999;
25
- display: flex;
26
- flex-direction: column;
27
- overflow: hidden;
28
- background-color: ${colors.white};
23
+ const StyledDropdownContent = styled(DropdownContent)`
29
24
  border-radius: ${spacing.small};
30
25
  border: 1px solid ${colors.brand.tertiary};
31
- fill: ${colors.brand.tertiary};
26
+ [data-arrow] {
27
+ fill: ${colors.brand.tertiary};
28
+ }
32
29
  `;
33
30
 
34
31
  const LanguageChoice = styled(ButtonV2)`
@@ -67,33 +64,30 @@ const Text = styled.span`
67
64
  const LanguageSelector = <T extends string>({ locales, onSelect, inverted }: Props<T>) => {
68
65
  const { t, i18n } = useTranslation();
69
66
  return (
70
- <Root>
71
- <Trigger asChild>
67
+ <DropdownMenu>
68
+ <DropdownTrigger>
72
69
  <ButtonV2 variant="outline" shape="pill" inverted={inverted} aria-label={t('footer.selectLanguage')}>
73
70
  {t(`languages.prefixChangeLanguage`)} <ChevronDown />
74
71
  </ButtonV2>
75
- </Trigger>
76
- <Portal>
77
- <PopoverContent sideOffset={4}>
78
- <Arrow aria-hidden />
79
- {locales.map((locale) => (
80
- <Item asChild key={locale}>
81
- <LanguageChoice
82
- role="link"
83
- aria-current={i18n.language === locale}
84
- variant="ghost"
85
- shape="sharp"
86
- aria-label={t(`changeLanguage.${locale}`)}
87
- onClick={() => onSelect(locale)}
88
- >
89
- <ActivityIndicator>{i18n.language === locale && <ActiveIndicator />}</ActivityIndicator>
90
- <Text>{t(`languages.${locale}`)}</Text>
91
- </LanguageChoice>
92
- </Item>
93
- ))}
94
- </PopoverContent>
95
- </Portal>
96
- </Root>
72
+ </DropdownTrigger>
73
+ <StyledDropdownContent sideOffset={4} showArrow>
74
+ {locales.map((locale) => (
75
+ <DropdownItem key={locale}>
76
+ <LanguageChoice
77
+ role="link"
78
+ aria-current={i18n.language === locale}
79
+ variant="ghost"
80
+ shape="sharp"
81
+ aria-label={t(`changeLanguage.${locale}`)}
82
+ onClick={() => onSelect(locale)}
83
+ >
84
+ <ActivityIndicator>{i18n.language === locale && <ActiveIndicator />}</ActivityIndicator>
85
+ <Text>{t(`languages.${locale}`)}</Text>
86
+ </LanguageChoice>
87
+ </DropdownItem>
88
+ ))}
89
+ </StyledDropdownContent>
90
+ </DropdownMenu>
97
91
  );
98
92
  };
99
93
 
@@ -2,6 +2,9 @@ import React from 'react';
2
2
  import { Meta, StoryFn } from '@storybook/react';
3
3
  import { Pencil } from '@ndla/icons/action';
4
4
  import { DeleteForever } from '@ndla/icons/editor';
5
+ import { DropdownMenu, DropdownTrigger, DropdownContent, DropdownItem } from '@ndla/dropdown-menu';
6
+ import { ButtonV2, IconButtonV2 } from '@ndla/button';
7
+ import { HorizontalMenu } from '@ndla/icons/contentType';
5
8
  import { defaultParameters } from '../../../../../stories/defaults';
6
9
 
7
10
  import Folder from './Folder';
@@ -14,7 +17,7 @@ export default {
14
17
  ...defaultParameters,
15
18
  },
16
19
  argTypes: {
17
- menuItems: {
20
+ menu: {
18
21
  control: false,
19
22
  },
20
23
  },
@@ -26,10 +29,29 @@ export default {
26
29
  description: '',
27
30
  link: '',
28
31
  type: 'list',
29
- menuItems: [
30
- { icon: <Pencil />, text: 'Rediger', onClick: () => {} },
31
- { icon: <DeleteForever />, text: 'Slett', onClick: () => {}, type: 'danger' },
32
- ],
32
+ menu: (
33
+ <DropdownMenu>
34
+ <DropdownTrigger>
35
+ <IconButtonV2 aria-label="Show more" title="Show more" variant="ghost" colorTheme="light">
36
+ <HorizontalMenu />
37
+ </IconButtonV2>
38
+ </DropdownTrigger>
39
+ <DropdownContent>
40
+ <DropdownItem>
41
+ <ButtonV2 variant="ghost" colorTheme="light" shape="sharp" size="small" fontWeight="normal">
42
+ <Pencil />
43
+ Rediger
44
+ </ButtonV2>
45
+ </DropdownItem>
46
+ <DropdownItem>
47
+ <ButtonV2 variant="ghost" colorTheme="danger" shape="sharp" size="small" fontWeight="normal">
48
+ <DeleteForever />
49
+ Slett
50
+ </ButtonV2>
51
+ </DropdownItem>
52
+ </DropdownContent>
53
+ </DropdownMenu>
54
+ ),
33
55
  isShared: true,
34
56
  },
35
57
  } as Meta<typeof Folder>;
@@ -7,14 +7,12 @@
7
7
  */
8
8
 
9
9
  import styled from '@emotion/styled';
10
- import React from 'react';
10
+ import React, { ReactNode } from 'react';
11
11
  import { FolderOutlined, FolderShared } from '@ndla/icons/contentType';
12
12
  import { FileDocumentOutline, Share } from '@ndla/icons/common';
13
13
  import { fonts, spacing, colors, mq, breakpoints } from '@ndla/core';
14
14
  import { useTranslation } from 'react-i18next';
15
- import { MenuItemProps } from '@ndla/button';
16
15
  import { ResourceTitleLink } from '../../Resource/resourceComponents';
17
- import FolderMenu from './FolderMenu';
18
16
 
19
17
  export type LayoutType = 'list' | 'listLarger' | 'block';
20
18
 
@@ -151,22 +149,11 @@ interface Props {
151
149
  description?: string;
152
150
  link: string;
153
151
  type?: LayoutType;
154
- onViewTypeChange?: (type: LayoutType) => void;
155
- menuItems?: MenuItemProps[];
152
+ menu?: ReactNode;
156
153
  isShared?: boolean;
157
154
  }
158
155
 
159
- const Folder = ({
160
- id,
161
- link,
162
- title,
163
- subFolders,
164
- subResources,
165
- type = 'list',
166
- menuItems,
167
- isShared,
168
- onViewTypeChange,
169
- }: Props) => {
156
+ const Folder = ({ id, link, title, subFolders, subResources, type = 'list', menu, isShared }: Props) => {
170
157
  const { t } = useTranslation();
171
158
  const Icon = isShared ? FolderShared : FolderOutlined;
172
159
 
@@ -196,9 +183,7 @@ const Folder = ({
196
183
  <Count layoutType={type} type={'folder'} count={subFolders} />
197
184
  <Count layoutType={type} type={'resource'} count={subResources} />
198
185
  </CountContainer>
199
- {menuItems && menuItems.length > 0 && (
200
- <FolderMenu menuItems={menuItems} viewType={type} onViewTypeChange={onViewTypeChange} />
201
- )}
186
+ {menu}
202
187
  </MenuWrapper>
203
188
  </FolderWrapper>
204
189
  );
@@ -1,5 +1,3 @@
1
1
  import Folder from './Resource/Folder';
2
2
  import FolderInput from './Resource/FolderInput';
3
- import FolderMenu from './Resource/FolderMenu';
4
- import SettingsMenu from './SettingsMenu';
5
- export { Folder, FolderInput, SettingsMenu, FolderMenu };
3
+ export { Folder, FolderInput };
@@ -28,7 +28,7 @@ export default {
28
28
  headingLevel: {
29
29
  control: false,
30
30
  },
31
- menuItems: {
31
+ menu: {
32
32
  control: false,
33
33
  },
34
34
  },
@@ -7,9 +7,8 @@
7
7
  */
8
8
 
9
9
  import styled from '@emotion/styled';
10
- import React from 'react';
10
+ import React, { ReactNode } from 'react';
11
11
  import { colors, fonts, spacing } from '@ndla/core';
12
- import { MenuItemProps } from '@ndla/button';
13
12
  import ContentTypeBadge from '../ContentTypeBadge';
14
13
  import Image from '../Image';
15
14
  import {
@@ -23,7 +22,6 @@ import {
23
22
  } from './resourceComponents';
24
23
  import ContentLoader from '../ContentLoader';
25
24
  import { contentTypeMapping, resourceEmbedTypeMapping } from '../model/ContentType';
26
- import { SettingsMenu } from '../MyNdla';
27
25
 
28
26
  const BlockElementWrapper = styled.div`
29
27
  display: flex;
@@ -149,7 +147,7 @@ interface Props {
149
147
  tags?: string[];
150
148
  description?: string;
151
149
  headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
152
- menuItems?: MenuItemProps[];
150
+ menu?: ReactNode;
153
151
  isLoading?: boolean;
154
152
  targetBlank?: boolean;
155
153
  resourceTypes?: { id: string; name: string }[];
@@ -163,7 +161,7 @@ const BlockResource = ({
163
161
  tags,
164
162
  resourceImage,
165
163
  description,
166
- menuItems,
164
+ menu,
167
165
  isLoading,
168
166
  headingLevel: Heading = 'h2',
169
167
  targetBlank,
@@ -196,7 +194,7 @@ const BlockResource = ({
196
194
  </ContentWrapper>
197
195
  <TagsAndActionMenu>
198
196
  {tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
199
- {menuItems && menuItems.length > 0 && <SettingsMenu menuItems={menuItems} />}
197
+ {menu}
200
198
  </TagsAndActionMenu>
201
199
  </BlockInfoWrapper>
202
200
  </BlockElementWrapper>
@@ -7,9 +7,8 @@
7
7
  */
8
8
 
9
9
  import styled from '@emotion/styled';
10
- import React from 'react';
10
+ import React, { ReactNode } from 'react';
11
11
  import { fonts, spacing, colors, breakpoints, mq } from '@ndla/core';
12
- import { MenuItemProps } from '@ndla/button';
13
12
  import Image from '../Image';
14
13
  import {
15
14
  CompressedTagList,
@@ -23,7 +22,6 @@ import {
23
22
  import ContentLoader from '../ContentLoader';
24
23
  import ContentTypeBadge from '../ContentTypeBadge';
25
24
  import { contentTypeMapping, resourceEmbedTypeMapping } from '../model/ContentType';
26
- import { SettingsMenu } from '../MyNdla';
27
25
 
28
26
  const ListResourceWrapper = styled.div`
29
27
  flex: 1;
@@ -204,7 +202,7 @@ export interface ListResourceProps {
204
202
  resourceTypes: { id: string; name: string }[];
205
203
  tags?: string[];
206
204
  description?: string;
207
- menuItems?: MenuItemProps[];
205
+ menu?: ReactNode;
208
206
  isLoading?: boolean;
209
207
  targetBlank?: boolean;
210
208
  }
@@ -218,7 +216,7 @@ const ListResource = ({
218
216
  resourceImage,
219
217
  resourceTypes,
220
218
  description,
221
- menuItems,
219
+ menu,
222
220
  isLoading = false,
223
221
  targetBlank,
224
222
  }: ListResourceProps) => {
@@ -251,7 +249,7 @@ const ListResource = ({
251
249
  {showDescription && <Description description={description} loading={isLoading} />}
252
250
  <TagsandActionMenu>
253
251
  {tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
254
- {menuItems && menuItems.length > 0 && <SettingsMenu menuItems={menuItems} />}
252
+ {menu}
255
253
  </TagsandActionMenu>
256
254
  </ListResourceWrapper>
257
255
  );
@@ -8,8 +8,37 @@
8
8
 
9
9
  import React from 'react';
10
10
  import { Meta, StoryFn } from '@storybook/react';
11
- import { defaultParameters } from '../../../../stories/defaults';
11
+ import { DropdownMenu, DropdownContent, DropdownItem, DropdownTrigger } from '@ndla/dropdown-menu';
12
+ import { ButtonV2, IconButtonV2 } from '@ndla/button';
13
+ import { HorizontalMenu } from '@ndla/icons/contentType';
14
+ import { Pencil } from '@ndla/icons/action';
15
+ import { DeleteForever } from '@ndla/icons/editor';
12
16
  import ListResource from './ListResource';
17
+ import { defaultParameters } from '../../../../stories/defaults';
18
+
19
+ const StoryResourceMenu = () => (
20
+ <DropdownMenu>
21
+ <DropdownTrigger>
22
+ <IconButtonV2 aria-label="Show more" title="Show more" variant="ghost" colorTheme="light">
23
+ <HorizontalMenu />
24
+ </IconButtonV2>
25
+ </DropdownTrigger>
26
+ <DropdownContent>
27
+ <DropdownItem>
28
+ <ButtonV2 variant="ghost" colorTheme="light" shape="sharp" size="small" fontWeight="normal">
29
+ <Pencil />
30
+ Rediger
31
+ </ButtonV2>
32
+ </DropdownItem>
33
+ <DropdownItem>
34
+ <ButtonV2 variant="ghost" colorTheme="danger" shape="sharp" size="small" fontWeight="normal">
35
+ <DeleteForever />
36
+ Slett
37
+ </ButtonV2>
38
+ </DropdownItem>
39
+ </DropdownContent>
40
+ </DropdownMenu>
41
+ );
13
42
 
14
43
  export default {
15
44
  title: 'Components/Resources/ListResource',
@@ -28,7 +57,7 @@ export default {
28
57
  headingLevel: {
29
58
  control: false,
30
59
  },
31
- menuItems: {
60
+ menu: {
32
61
  control: false,
33
62
  },
34
63
  },
@@ -41,6 +70,7 @@ export default {
41
70
  alt: '',
42
71
  },
43
72
  resourceTypes: [{ id: 'urn:resourcetype:learningPath', name: 'Læringssti' }],
73
+ menu: <StoryResourceMenu />,
44
74
  tags: ['tag', 'tag', 'tag', 'tag'],
45
75
  },
46
76
  } as Meta<typeof ListResource>;
@@ -10,11 +10,11 @@ import styled from '@emotion/styled';
10
10
  import { colors, fonts, spacing } from '@ndla/core';
11
11
  import React, { CSSProperties, HTMLAttributes, ReactNode, useMemo } from 'react';
12
12
  import { useTranslation } from 'react-i18next';
13
- import { MenuButton } from '@ndla/button';
14
- import SafeLink from '@ndla/safelink';
15
- import { useNavigate } from 'react-router-dom';
13
+ import { IconButtonV2 } from '@ndla/button';
14
+ import SafeLink, { SafeLinkButton } from '@ndla/safelink';
16
15
  import { HashTag } from '@ndla/icons/common';
17
16
  import { css } from '@emotion/react';
17
+ import { DropdownMenu, DropdownContent, DropdownTrigger, DropdownItem } from '@ndla/dropdown-menu';
18
18
  import resourceTypeColor from '../utils/resourceTypeColor';
19
19
  import { resourceEmbedTypeMapping } from '../model/ContentType';
20
20
 
@@ -38,6 +38,10 @@ export const ResourceTitleLink = styled(SafeLink)`
38
38
  }
39
39
  `;
40
40
 
41
+ const StyledTrigger = styled(IconButtonV2)`
42
+ margin: 0px ${spacing.xsmall};
43
+ `;
44
+
41
45
  export const resourceHeadingStyle = css`
42
46
  margin: 0;
43
47
  overflow: hidden;
@@ -173,34 +177,40 @@ interface CompressedTagListProps {
173
177
  }
174
178
 
175
179
  export const CompressedTagList = ({ tags, tagLinkPrefix }: CompressedTagListProps) => {
176
- const navigate = useNavigate();
177
180
  const { t } = useTranslation();
178
181
  const visibleTags = useMemo(() => tags.slice(0, 3), [tags]);
179
- const remainingTags = useMemo(
180
- () =>
181
- tags.slice(3, tags.length).map((tag) => {
182
- return {
183
- icon: <HashTag />,
184
- text: tag,
185
- onClick: () => {
186
- navigate(`${tagLinkPrefix ? tagLinkPrefix : ''}/${encodeURIComponent(tag)}`);
187
- },
188
- };
189
- }),
190
- [navigate, tagLinkPrefix, tags],
191
- );
182
+ const remainingTags = useMemo(() => tags.slice(3, tags.length), [tags]);
192
183
 
193
184
  return (
194
185
  <>
195
186
  <TagList tagLinkPrefix={tagLinkPrefix} tags={visibleTags} />
196
187
  {remainingTags.length > 0 && (
197
- <MenuButton
198
- size="small"
199
- menuIcon={<TagCounterWrapper>{`+${remainingTags.length}`}</TagCounterWrapper>}
200
- menuItems={remainingTags}
201
- align="end"
202
- aria-label={t('myNdla.moreTags', { count: remainingTags.length })}
203
- />
188
+ <DropdownMenu>
189
+ <DropdownTrigger>
190
+ <StyledTrigger
191
+ size="xsmall"
192
+ variant="ghost"
193
+ colorTheme="light"
194
+ aria-label={t('myNdla.moreTags', { count: remainingTags.length })}
195
+ >
196
+ {<TagCounterWrapper>{`+${remainingTags.length}`}</TagCounterWrapper>}
197
+ </StyledTrigger>
198
+ </DropdownTrigger>
199
+ <DropdownContent showArrow>
200
+ {remainingTags.map((tag, i) => (
201
+ <DropdownItem key={`tag-${i}`}>
202
+ <SafeLinkButton
203
+ to={`${tagLinkPrefix ?? ''}/${encodeURIComponent(tag)}`}
204
+ variant="ghost"
205
+ colorTheme="light"
206
+ >
207
+ <HashTag />
208
+ {tag}
209
+ </SafeLinkButton>
210
+ </DropdownItem>
211
+ ))}
212
+ </DropdownContent>
213
+ </DropdownMenu>
204
214
  )}
205
215
  </>
206
216
  );
@@ -13,7 +13,7 @@ import { ArrowDropDownRounded } from '@ndla/icons/common';
13
13
  import { FolderOutlined, FolderShared } from '@ndla/icons/contentType';
14
14
  import { Done } from '@ndla/icons/editor';
15
15
  import { ButtonV2 as Button } from '@ndla/button';
16
- import { colors, spacing, animations, spacingUnit, misc, fonts } from '@ndla/core';
16
+ import { colors, spacing, animations, misc, fonts } from '@ndla/core';
17
17
  import SafeLink from '@ndla/safelink';
18
18
  import { IFolder } from '@ndla/types-backend/learningpath-api';
19
19
  import { CommonFolderItemsProps } from './types';
@@ -62,8 +62,6 @@ const FolderIconWrapper = styled.div`
62
62
  }
63
63
  `;
64
64
 
65
- const shouldForwardProp = (name: string) => !['selected', 'level', 'focused', 'isCreatingFolder'].includes(name);
66
-
67
65
  const FolderName = styled(Button)`
68
66
  display: grid;
69
67
  grid-template-columns: auto 1fr auto;
@@ -106,7 +104,7 @@ const StyledDone = styled(Done)`
106
104
  color: ${colors.support.green};
107
105
  `;
108
106
 
109
- const FolderNameLink = styled(SafeLink, { shouldForwardProp })`
107
+ const FolderNameLink = styled(SafeLink)`
110
108
  display: grid;
111
109
  align-items: center;
112
110
  grid-template-columns: ${spacing.medium} 1fr auto;
package/src/index.ts CHANGED
@@ -182,7 +182,7 @@ export { default as Topic } from './Topic';
182
182
  export type { TopicProps } from './Topic';
183
183
  export { default as Aside } from './Aside';
184
184
 
185
- export { default as Breadcrumb, HeaderBreadcrumb, HomeBreadcrumb, ActionBreadcrumb } from './Breadcrumb';
185
+ export { default as Breadcrumb, HeaderBreadcrumb, HomeBreadcrumb } from './Breadcrumb';
186
186
  export type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from './Breadcrumb';
187
187
 
188
188
  export { i18nInstance, formatNestedMessages } from './i18n';
@@ -242,7 +242,7 @@ export { Notion, ConceptNotion } from './Notion';
242
242
  export type { NotionVisualElementType, ConceptNotionType } from './Notion';
243
243
 
244
244
  export { BannerCard } from './BannerCard';
245
- export { Folder, FolderInput, FolderMenu } from './MyNdla';
245
+ export { Folder, FolderInput } from './MyNdla';
246
246
  export { ListResource, BlockResource } from './Resource';
247
247
  export type { ListResourceProps } from './Resource';
248
248
  export type { TagType } from './TagSelector';