@ndla/ui 50.13.2 → 50.14.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/BlogPost/BlogPost.js +5 -5
- package/es/ContactBlock/ContactBlock.js +14 -22
- package/es/ContentTypeBadge/ContentTypeBadge.js +12 -7
- package/es/Embed/conceptComponents.js +11 -9
- package/es/Messages/MessageBanner.js +15 -6
- package/es/Messages/MessageBox.js +21 -21
- package/es/Navigation/NavigationBox.js +14 -14
- package/es/Resource/BlockResource.js +17 -8
- package/es/Resource/ListResource.js +17 -8
- package/es/Resource/resourceComponents.js +11 -11
- package/es/ResourceGroup/ResourceItem.js +25 -19
- package/es/SearchTypeResult/SearchFieldHeader.js +9 -7
- package/es/SearchTypeResult/components/ItemContexts.js +22 -16
- package/es/utils/resourceTypeColor.js +2 -0
- package/lib/BlogPost/BlogPost.js +5 -5
- package/lib/CompetenceGoalTab/styles.d.ts +5 -5
- package/lib/ContactBlock/ContactBlock.js +14 -22
- package/lib/ContentTypeBadge/ContentTypeBadge.js +11 -6
- package/lib/Embed/conceptComponents.js +11 -9
- package/lib/Hero/HeroContent.d.ts +1 -1
- package/lib/Messages/MessageBanner.js +14 -5
- package/lib/Messages/MessageBox.js +22 -20
- package/lib/NDLAFilm/filmStyles.d.ts +2 -2
- package/lib/Navigation/NavigationBox.js +14 -14
- package/lib/Resource/BlockResource.js +16 -7
- package/lib/Resource/ListResource.js +16 -7
- package/lib/Resource/resourceComponents.js +11 -11
- package/lib/ResourceGroup/ResourceItem.js +25 -19
- package/lib/Search/ActiveFilterContent.d.ts +1 -1
- package/lib/Search/ContentTypeResultStyles.d.ts +6 -6
- package/lib/SearchTypeResult/ActiveFilterContent.d.ts +1 -1
- package/lib/SearchTypeResult/SearchFieldHeader.js +9 -7
- package/lib/SearchTypeResult/components/ItemContexts.js +22 -16
- package/lib/TagSelector/MenuList.d.ts +1 -1
- package/lib/TagSelector/ValueButton.d.ts +1 -1
- package/lib/utils/resourceTypeColor.js +2 -0
- package/package.json +17 -17
- package/src/Article/ArticleByline.stories.tsx +0 -2
- package/src/AudioPlayer/AudiPlayer.stories.tsx +0 -2
- package/src/BlogPost/BlogPost.stories.tsx +0 -4
- package/src/BlogPost/BlogPost.tsx +1 -0
- package/src/Breadcrumb/Breadcrumb.stories.tsx +0 -2
- package/src/Breadcrumb/HomeBreadcrumb.stories.tsx +0 -2
- package/src/CampaignBlock/CampaignBlock.stories.tsx +0 -4
- package/src/ContactBlock/ContactBlock.tsx +5 -1
- package/src/ContactBlock/Contactblock.stories.tsx +0 -4
- package/src/ContentLoader/ContentLoader.stories.tsx +0 -2
- package/src/ContentTypeBadge/ContentTypeBadge.stories.tsx +0 -2
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +6 -1
- package/src/CreatedBy/CreatedBy.stories.tsx +0 -2
- package/src/Embed/AudioEmbed.stories.tsx +0 -2
- package/src/Embed/BrightcoveEmbed.stories.tsx +0 -2
- package/src/Embed/ConceptEmbed.stories.tsx +0 -2
- package/src/Embed/ExternalEmbed.stories.tsx +0 -2
- package/src/Embed/FootnoteEmbed.stories.tsx +0 -2
- package/src/Embed/H5pEmbed.stories.tsx +0 -2
- package/src/Embed/IframeEmbed.stories.tsx +0 -2
- package/src/Embed/ImageEmbed.stories.tsx +0 -2
- package/src/Embed/RelatedContentEmbed.stories.tsx +0 -2
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +0 -2
- package/src/Embed/conceptComponents.tsx +17 -5
- package/src/ErrorMessage/ErrorMessage.stories.tsx +0 -2
- package/src/ExpandableBox/ExpandableBox.stories.tsx +0 -2
- package/src/FactBox/Factbox.stories.tsx +0 -2
- package/src/FileList/FileList.stories.tsx +0 -2
- package/src/Footer/Footer.stories.tsx +0 -2
- package/src/FramedContent/FramedContent.stories.tsx +0 -2
- package/src/Gloss/Gloss.stories.tsx +0 -4
- package/src/Grid/Grid.stories.tsx +0 -2
- package/src/Hero/Hero.stories.tsx +0 -2
- package/src/Image/Image.stories.tsx +0 -2
- package/src/KeyFigure/KeyFigure.stories.tsx +0 -2
- package/src/LanguageSelector/LanguageSelector.stories.tsx +0 -4
- package/src/LearningPaths/LearningPathMenu.stories.tsx +0 -2
- package/src/LetterFilter/LetterFilter.stories.tsx +0 -4
- package/src/LicenseByline/EmbedByline.stories.tsx +0 -4
- package/src/LinkBlock/LinkBlock.stories.tsx +0 -4
- package/src/List/OrderedList.stories.tsx +0 -2
- package/src/List/UnorderedList.stories.tsx +3 -0
- package/src/Logo/Logo.stories.tsx +0 -2
- package/src/Messages/MessageBanner.stories.tsx +0 -2
- package/src/Messages/MessageBanner.tsx +10 -3
- package/src/Messages/MessageBox.stories.tsx +0 -2
- package/src/Messages/MessageBox.tsx +14 -5
- package/src/MyNdla/Resource/Folder.stories.tsx +0 -4
- package/src/MyNdla/Resource/FolderInput.stories.tsx +0 -2
- package/src/Navigation/NavigationBox.tsx +1 -1
- package/src/ProgrammeCard/ProgrammeCard.stories.tsx +0 -4
- package/src/Resource/BlockResource.stories.tsx +8 -4
- package/src/Resource/BlockResource.tsx +22 -12
- package/src/Resource/ListResource.stories.tsx +8 -4
- package/src/Resource/ListResource.tsx +17 -4
- package/src/Resource/resourceComponents.tsx +4 -0
- package/src/ResourceGroup/ResourceItem.stories.tsx +0 -2
- package/src/ResourceGroup/ResourceItem.tsx +10 -2
- package/src/SearchTypeResult/SearchFieldHeader.tsx +5 -4
- package/src/SearchTypeResult/components/ItemContexts.tsx +11 -9
- package/src/SnackBar/Snack.stories.tsx +0 -2
- package/src/Table/Table.stories.tsx +0 -2
- package/src/TagSelector/TagSelector.stories.tsx +0 -2
- package/src/TreeStructure/TreeStructure.stories.tsx +0 -2
- package/src/utils/resourceTypeColor.tsx +2 -0
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { ReactNode } from "react";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
10
11
|
import styled from "@emotion/styled";
|
|
11
|
-
import {
|
|
12
|
+
import { IconButtonV2 } from "@ndla/button";
|
|
12
13
|
import { colors, spacing } from "@ndla/core";
|
|
14
|
+
import { Cross } from "@ndla/icons/action";
|
|
13
15
|
|
|
14
16
|
interface WrapperProps {
|
|
15
17
|
small?: boolean;
|
|
@@ -34,7 +36,7 @@ const TextWrapper = styled.div`
|
|
|
34
36
|
}
|
|
35
37
|
`;
|
|
36
38
|
|
|
37
|
-
const StyledClosebutton = styled(
|
|
39
|
+
const StyledClosebutton = styled(IconButtonV2)`
|
|
38
40
|
grid-area: closebutton;
|
|
39
41
|
padding: 0;
|
|
40
42
|
justify-self: flex-end;
|
|
@@ -49,10 +51,15 @@ interface Props {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
const MessageBanner = ({ children, onClose, showCloseButton, small }: Props) => {
|
|
54
|
+
const { t } = useTranslation();
|
|
52
55
|
return (
|
|
53
56
|
<MessageBannerWrapper small={small}>
|
|
54
57
|
<TextWrapper>{children}</TextWrapper>
|
|
55
|
-
{showCloseButton &&
|
|
58
|
+
{showCloseButton && (
|
|
59
|
+
<StyledClosebutton onClick={onClose} variant="ghost" aria-label={t("close")} title={t("close")}>
|
|
60
|
+
<Cross />
|
|
61
|
+
</StyledClosebutton>
|
|
62
|
+
)}
|
|
56
63
|
</MessageBannerWrapper>
|
|
57
64
|
);
|
|
58
65
|
};
|
|
@@ -10,7 +10,6 @@ import { useTranslation } from "react-i18next";
|
|
|
10
10
|
import { Meta, StoryFn } from "@storybook/react";
|
|
11
11
|
import { Alarm, HumanMaleBoard, InformationOutline, WarningOutline } from "@ndla/icons/common";
|
|
12
12
|
import MessageBox from "./MessageBox";
|
|
13
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
14
13
|
|
|
15
14
|
export default {
|
|
16
15
|
title: "Patterns/MessageBox",
|
|
@@ -18,7 +17,6 @@ export default {
|
|
|
18
17
|
tags: ["autodocs"],
|
|
19
18
|
parameters: {
|
|
20
19
|
inlineStories: true,
|
|
21
|
-
...defaultParameters,
|
|
22
20
|
},
|
|
23
21
|
args: {
|
|
24
22
|
showCloseButton: true,
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { ReactNode } from "react";
|
|
10
|
-
import {
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
11
|
import styled from "@emotion/styled";
|
|
12
|
-
import {
|
|
12
|
+
import { IconButtonV2 } from "@ndla/button";
|
|
13
13
|
import { breakpoints, colors, fonts, mq, spacing } from "@ndla/core";
|
|
14
|
+
import { Cross } from "@ndla/icons/action";
|
|
14
15
|
import { Forward } from "@ndla/icons/common";
|
|
15
16
|
|
|
16
17
|
type MessageBoxType = "ghost" | "danger" | "info";
|
|
@@ -29,6 +30,7 @@ interface MessageBoxProps {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const MessageBoxWrapper = styled.div`
|
|
33
|
+
position: relative;
|
|
32
34
|
display: flex;
|
|
33
35
|
padding: ${spacing.small};
|
|
34
36
|
font-family: ${fonts.sans};
|
|
@@ -85,11 +87,14 @@ const Link = styled.a`
|
|
|
85
87
|
font-weight: ${fonts.weight.semibold};
|
|
86
88
|
`;
|
|
87
89
|
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
+
const StyledCloseButton = styled(IconButtonV2)`
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: ${spacing.xsmall};
|
|
93
|
+
right: ${spacing.xsmall};
|
|
90
94
|
`;
|
|
91
95
|
|
|
92
96
|
export const MessageBox = ({ type, children, links, showCloseButton, onClose }: MessageBoxProps) => {
|
|
97
|
+
const { t } = useTranslation();
|
|
93
98
|
return (
|
|
94
99
|
<MessageBoxWrapper data-type={type}>
|
|
95
100
|
<InfoWrapper>
|
|
@@ -107,7 +112,11 @@ export const MessageBox = ({ type, children, links, showCloseButton, onClose }:
|
|
|
107
112
|
)}
|
|
108
113
|
</div>
|
|
109
114
|
</InfoWrapper>
|
|
110
|
-
{showCloseButton &&
|
|
115
|
+
{showCloseButton && (
|
|
116
|
+
<StyledCloseButton variant="ghost" aria-label={t("close")} title={t("close")} onClick={onClose}>
|
|
117
|
+
<Cross />
|
|
118
|
+
</StyledCloseButton>
|
|
119
|
+
)}
|
|
111
120
|
</MessageBoxWrapper>
|
|
112
121
|
);
|
|
113
122
|
};
|
|
@@ -15,15 +15,11 @@ import { Pencil } from "@ndla/icons/action";
|
|
|
15
15
|
import { HorizontalMenu } from "@ndla/icons/contentType";
|
|
16
16
|
import { DeleteForever } from "@ndla/icons/editor";
|
|
17
17
|
import Folder from "./Folder";
|
|
18
|
-
import { defaultParameters } from "../../../../../stories/defaults";
|
|
19
18
|
|
|
20
19
|
export default {
|
|
21
20
|
title: "My NDLA/Folder",
|
|
22
21
|
component: Folder,
|
|
23
22
|
tags: ["autodocs"],
|
|
24
|
-
parameters: {
|
|
25
|
-
...defaultParameters,
|
|
26
|
-
},
|
|
27
23
|
argTypes: {
|
|
28
24
|
menu: {
|
|
29
25
|
control: false,
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import { Meta, StoryObj } from "@storybook/react";
|
|
10
10
|
import FolderInput from "./FolderInput";
|
|
11
|
-
import { defaultParameters } from "../../../../../stories/defaults";
|
|
12
11
|
|
|
13
12
|
export default {
|
|
14
13
|
title: "My NDLA/FolderInput",
|
|
@@ -16,7 +15,6 @@ export default {
|
|
|
16
15
|
component: FolderInput,
|
|
17
16
|
parameters: {
|
|
18
17
|
inlineStories: true,
|
|
19
|
-
...defaultParameters,
|
|
20
18
|
},
|
|
21
19
|
args: {
|
|
22
20
|
labelHidden: false,
|
|
@@ -228,7 +228,7 @@ export const NavigationBox = ({
|
|
|
228
228
|
>
|
|
229
229
|
<StyledMarksWrapper>
|
|
230
230
|
{item.isAdditionalResource && (
|
|
231
|
-
<StyledAdditional aria-label={t("resource.additionalTooltip")}
|
|
231
|
+
<StyledAdditional aria-label={t("resource.additionalTooltip")} aria-hidden={false} />
|
|
232
232
|
)}
|
|
233
233
|
{item.isRestrictedResource && (
|
|
234
234
|
<StyledHumanBoardIconWrapper>
|
|
@@ -8,15 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { Meta, StoryFn } from "@storybook/react";
|
|
10
10
|
import ProgrammeCard from "./ProgrammeCard";
|
|
11
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
12
11
|
|
|
13
12
|
export default {
|
|
14
13
|
title: "Components/ProgrammeCard",
|
|
15
14
|
component: ProgrammeCard,
|
|
16
15
|
tags: ["autodocs"],
|
|
17
|
-
parameters: {
|
|
18
|
-
...defaultParameters,
|
|
19
|
-
},
|
|
20
16
|
args: {
|
|
21
17
|
id: "test ID",
|
|
22
18
|
title: { title: "Elektro og datateknologi", language: "nb" },
|
|
@@ -11,15 +11,11 @@ import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
|
11
11
|
import { spacing } from "@ndla/core";
|
|
12
12
|
import BlockResource from "./BlockResource";
|
|
13
13
|
import { StoryResourceMenu, resourceTypesArr } from "./storyComponents";
|
|
14
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
15
14
|
|
|
16
15
|
export default {
|
|
17
16
|
title: "My NDLA/BlockResource",
|
|
18
17
|
component: BlockResource,
|
|
19
18
|
tags: ["autodocs"],
|
|
20
|
-
parameters: {
|
|
21
|
-
...defaultParameters,
|
|
22
|
-
},
|
|
23
19
|
argTypes: {
|
|
24
20
|
resourceImage: {
|
|
25
21
|
control: false,
|
|
@@ -70,6 +66,14 @@ export const WithMenu: StoryObj<typeof BlockResource> = {
|
|
|
70
66
|
},
|
|
71
67
|
};
|
|
72
68
|
|
|
69
|
+
export const WithUnavailableResource: StoryObj<typeof BlockResource> = {
|
|
70
|
+
args: {
|
|
71
|
+
title: "Ressurs ikke tilgjengelig",
|
|
72
|
+
resourceTypes: [],
|
|
73
|
+
resourceImage: { src: "", alt: "" },
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
73
77
|
export const Loading: StoryObj<typeof BlockResource> = {
|
|
74
78
|
args: {
|
|
75
79
|
isLoading: true,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ReactNode } from "react";
|
|
9
|
+
import { ReactNode, useMemo } from "react";
|
|
10
10
|
import styled from "@emotion/styled";
|
|
11
11
|
import { colors, spacing, stackOrder } from "@ndla/core";
|
|
12
12
|
import { Text } from "@ndla/typography";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import ContentLoader from "../ContentLoader";
|
|
23
23
|
import ContentTypeBadge from "../ContentTypeBadge";
|
|
24
24
|
import Image from "../Image";
|
|
25
|
-
import { contentTypeMapping, resourceEmbedTypeMapping } from "../model/ContentType";
|
|
25
|
+
import { contentTypeMapping, MISSING, resourceEmbedTypeMapping } from "../model/ContentType";
|
|
26
26
|
|
|
27
27
|
const BlockElementWrapper = styled.div`
|
|
28
28
|
display: flex;
|
|
@@ -166,23 +166,33 @@ const BlockResource = ({
|
|
|
166
166
|
}: Props) => {
|
|
167
167
|
const firstResourceType = resourceTypes?.[0]?.id ?? "";
|
|
168
168
|
|
|
169
|
+
const contentType = useMemo(() => {
|
|
170
|
+
if (!firstResourceType) {
|
|
171
|
+
return MISSING;
|
|
172
|
+
} else {
|
|
173
|
+
return (
|
|
174
|
+
contentTypeMapping[firstResourceType] ??
|
|
175
|
+
resourceEmbedTypeMapping[firstResourceType] ??
|
|
176
|
+
contentTypeMapping["default"]
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}, [firstResourceType]);
|
|
180
|
+
|
|
169
181
|
return (
|
|
170
182
|
<BlockElementWrapper id={id}>
|
|
171
183
|
<ImageWrapper>
|
|
172
|
-
<BlockImage
|
|
173
|
-
image={resourceImage}
|
|
174
|
-
loading={isLoading}
|
|
175
|
-
contentType={
|
|
176
|
-
contentTypeMapping[firstResourceType] ??
|
|
177
|
-
resourceEmbedTypeMapping[firstResourceType] ??
|
|
178
|
-
contentTypeMapping["default"]
|
|
179
|
-
}
|
|
180
|
-
/>
|
|
184
|
+
<BlockImage image={resourceImage} loading={isLoading} contentType={contentType} />
|
|
181
185
|
</ImageWrapper>
|
|
182
186
|
<BlockInfoWrapper>
|
|
183
187
|
<ContentWrapper>
|
|
184
188
|
<ResourceTypeAndTitleLoader loading={isLoading}>
|
|
185
|
-
<ResourceTitleLink
|
|
189
|
+
<ResourceTitleLink
|
|
190
|
+
data-link=""
|
|
191
|
+
title={title}
|
|
192
|
+
target={targetBlank ? "_blank" : undefined}
|
|
193
|
+
to={link}
|
|
194
|
+
data-resource-available={contentType !== MISSING}
|
|
195
|
+
>
|
|
186
196
|
<Text element="span" textStyle="label-small" css={resourceHeadingStyle}>
|
|
187
197
|
{title}
|
|
188
198
|
</Text>
|
|
@@ -10,16 +10,12 @@ import styled from "@emotion/styled";
|
|
|
10
10
|
import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
11
11
|
import ListResource from "./ListResource";
|
|
12
12
|
import { StoryResourceMenu, resourceTypesArr } from "./storyComponents";
|
|
13
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
14
13
|
import { spacing } from "../../../core/src";
|
|
15
14
|
|
|
16
15
|
export default {
|
|
17
16
|
title: "My NDLA/ListResource",
|
|
18
17
|
component: ListResource,
|
|
19
18
|
tags: ["autodocs"],
|
|
20
|
-
parameters: {
|
|
21
|
-
...defaultParameters,
|
|
22
|
-
},
|
|
23
19
|
argTypes: {
|
|
24
20
|
resourceImage: {
|
|
25
21
|
control: false,
|
|
@@ -71,6 +67,14 @@ export const WithMenu: StoryObj<typeof ListResource> = {
|
|
|
71
67
|
},
|
|
72
68
|
};
|
|
73
69
|
|
|
70
|
+
export const WithUnavailableResource: StoryObj<typeof ListResource> = {
|
|
71
|
+
args: {
|
|
72
|
+
title: "Ressurs ikke tilgjengelig",
|
|
73
|
+
resourceTypes: [],
|
|
74
|
+
resourceImage: { src: "", alt: "" },
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
74
78
|
export const Loading: StoryObj<typeof ListResource> = {
|
|
75
79
|
args: {
|
|
76
80
|
isLoading: true,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ReactNode } from "react";
|
|
9
|
+
import { ReactNode, useMemo } from "react";
|
|
10
10
|
import styled from "@emotion/styled";
|
|
11
11
|
import { spacing, colors, breakpoints, mq, stackOrder } from "@ndla/core";
|
|
12
12
|
import { Text } from "@ndla/typography";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import ContentLoader from "../ContentLoader";
|
|
23
23
|
import ContentTypeBadge from "../ContentTypeBadge";
|
|
24
24
|
import Image from "../Image";
|
|
25
|
-
import { contentTypeMapping, resourceEmbedTypeMapping } from "../model/ContentType";
|
|
25
|
+
import { contentTypeMapping, MISSING, resourceEmbedTypeMapping } from "../model/ContentType";
|
|
26
26
|
|
|
27
27
|
const ListResourceWrapper = styled.div`
|
|
28
28
|
flex: 1;
|
|
@@ -228,6 +228,14 @@ const ListResource = ({
|
|
|
228
228
|
const firstContentType = resourceTypes?.[0]?.id ?? "";
|
|
229
229
|
const embedResourceType = resourceEmbedTypeMapping[firstContentType];
|
|
230
230
|
|
|
231
|
+
const contentType = useMemo(() => {
|
|
232
|
+
if (!firstContentType) {
|
|
233
|
+
return MISSING;
|
|
234
|
+
} else {
|
|
235
|
+
return contentTypeMapping[firstContentType] ?? embedResourceType ?? contentTypeMapping["default"];
|
|
236
|
+
}
|
|
237
|
+
}, [embedResourceType, firstContentType]);
|
|
238
|
+
|
|
231
239
|
return (
|
|
232
240
|
<ListResourceWrapper id={id}>
|
|
233
241
|
<ImageWrapper imageSize={imageType} data-image-size={imageType}>
|
|
@@ -236,12 +244,17 @@ const ListResource = ({
|
|
|
236
244
|
loading={isLoading}
|
|
237
245
|
type={imageType}
|
|
238
246
|
background={!!embedResourceType}
|
|
239
|
-
contentType={
|
|
247
|
+
contentType={contentType}
|
|
240
248
|
/>
|
|
241
249
|
</ImageWrapper>
|
|
242
250
|
<TopicAndTitleWrapper>
|
|
243
251
|
<TypeAndTitleLoader loading={isLoading}>
|
|
244
|
-
<StyledLink
|
|
252
|
+
<StyledLink
|
|
253
|
+
to={link}
|
|
254
|
+
data-link=""
|
|
255
|
+
target={targetBlank ? "_blank" : undefined}
|
|
256
|
+
data-resource-available={contentType !== MISSING}
|
|
257
|
+
>
|
|
245
258
|
<Text element="span" textStyle="label-small" css={resourceHeadingStyle} title={title}>
|
|
246
259
|
{title}
|
|
247
260
|
</Text>
|
|
@@ -27,6 +27,10 @@ export const ResourceTitleLink = styled(SafeLink)`
|
|
|
27
27
|
box-shadow: none;
|
|
28
28
|
color: ${colors.brand.primary};
|
|
29
29
|
flex: 1;
|
|
30
|
+
&[data-resource-available="false"] {
|
|
31
|
+
color: ${colors.brand.grey};
|
|
32
|
+
font-style: italic;
|
|
33
|
+
}
|
|
30
34
|
:after {
|
|
31
35
|
content: "";
|
|
32
36
|
position: absolute;
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { Meta, StoryObj } from "@storybook/react";
|
|
10
10
|
import { FavoriteButton } from "@ndla/button";
|
|
11
11
|
import ResourceItem from "./ResourceItem";
|
|
12
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
13
12
|
|
|
14
13
|
export default {
|
|
15
14
|
title: "Components/ResourceItem",
|
|
@@ -17,7 +16,6 @@ export default {
|
|
|
17
16
|
component: ResourceItem,
|
|
18
17
|
parameters: {
|
|
19
18
|
inlineStories: true,
|
|
20
|
-
...defaultParameters,
|
|
21
19
|
},
|
|
22
20
|
args: {
|
|
23
21
|
id: "urn:resource:a7a49c0a-32ea-4343-8b11-bd6d65c24f87",
|
|
@@ -211,6 +211,14 @@ const CurrentSmall = styled.small`
|
|
|
211
211
|
}
|
|
212
212
|
`;
|
|
213
213
|
|
|
214
|
+
const StyledAdditional = styled(Additional)`
|
|
215
|
+
color: ${colors.brand.dark};
|
|
216
|
+
`;
|
|
217
|
+
|
|
218
|
+
const StyledCore = styled(Core)`
|
|
219
|
+
color: ${colors.brand.primary};
|
|
220
|
+
`;
|
|
221
|
+
|
|
214
222
|
interface Props {
|
|
215
223
|
id: string;
|
|
216
224
|
showContentTypeDescription?: boolean;
|
|
@@ -291,12 +299,12 @@ const ResourceItem = ({
|
|
|
291
299
|
<>
|
|
292
300
|
{additional && (
|
|
293
301
|
<IconWrapper id={additionalId} aria-label={contentTypeDescription} title={contentTypeDescription}>
|
|
294
|
-
<
|
|
302
|
+
<StyledAdditional size="normal" />
|
|
295
303
|
</IconWrapper>
|
|
296
304
|
)}
|
|
297
305
|
{!additional && (
|
|
298
306
|
<IconWrapper id={coreId} aria-label={contentTypeDescription} title={contentTypeDescription}>
|
|
299
|
-
<
|
|
307
|
+
<StyledCore size="normal" />
|
|
300
308
|
</IconWrapper>
|
|
301
309
|
)}
|
|
302
310
|
</>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { FormEvent, useRef, useState } from "react";
|
|
9
9
|
import { useTranslation } from "react-i18next";
|
|
10
10
|
import styled from "@emotion/styled";
|
|
11
|
+
import { IconButtonV2 } from "@ndla/button";
|
|
11
12
|
import { spacing, colors } from "@ndla/core";
|
|
12
13
|
import { Cross as CrossIcon } from "@ndla/icons/action";
|
|
13
14
|
import { Search as SearchIcon } from "@ndla/icons/common";
|
|
@@ -38,7 +39,7 @@ const StyledForm = styled.form<StyledProps>`
|
|
|
38
39
|
}
|
|
39
40
|
`;
|
|
40
41
|
|
|
41
|
-
const SearchButton = styled
|
|
42
|
+
const SearchButton = styled(IconButtonV2)`
|
|
42
43
|
width: 40px;
|
|
43
44
|
height: 40px;
|
|
44
45
|
border: 0;
|
|
@@ -46,7 +47,7 @@ const SearchButton = styled.button`
|
|
|
46
47
|
color: ${colors.brand.primary};
|
|
47
48
|
cursor: pointer;
|
|
48
49
|
`;
|
|
49
|
-
const ClearButton = styled
|
|
50
|
+
const ClearButton = styled(IconButtonV2)`
|
|
50
51
|
width: 40px;
|
|
51
52
|
height: 40px;
|
|
52
53
|
border: 0;
|
|
@@ -108,7 +109,7 @@ const SearchFieldHeader = ({
|
|
|
108
109
|
/>
|
|
109
110
|
{value && (
|
|
110
111
|
<ClearButton
|
|
111
|
-
|
|
112
|
+
aria-label={t("welcomePage.resetSearch")}
|
|
112
113
|
value={t("welcomePage.resetSearch")}
|
|
113
114
|
onClick={() => {
|
|
114
115
|
onChange("");
|
|
@@ -118,7 +119,7 @@ const SearchFieldHeader = ({
|
|
|
118
119
|
<CrossIcon style={iconStyle} title={t("welcomePage.resetSearch")} />
|
|
119
120
|
</ClearButton>
|
|
120
121
|
)}
|
|
121
|
-
<SearchButton type="submit" value={t("searchPage.search")}>
|
|
122
|
+
<SearchButton aria-label={t("searchPage.search")} type="submit" value={t("searchPage.search")}>
|
|
122
123
|
<SearchIcon style={iconStyle} title={t("searchPage.search")} />
|
|
123
124
|
</SearchButton>
|
|
124
125
|
</StyledForm>
|
|
@@ -50,6 +50,14 @@ const ContextListItem = styled.li`
|
|
|
50
50
|
${fonts.sizes("16px", "28px")};
|
|
51
51
|
`;
|
|
52
52
|
|
|
53
|
+
const StyledAdditional = styled(Additional)`
|
|
54
|
+
color: ${colors.brand.dark};
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const StyledCore = styled(Core)`
|
|
58
|
+
color: ${colors.brand.primary};
|
|
59
|
+
`;
|
|
60
|
+
|
|
53
61
|
type context = {
|
|
54
62
|
breadcrumb: string[];
|
|
55
63
|
url: string;
|
|
@@ -100,19 +108,13 @@ const ItemContexts = ({ contexts, id, title }: ItemContextsType) => {
|
|
|
100
108
|
<SafeLink to={context.url}>{title}</SafeLink>
|
|
101
109
|
<Breadcrumb breadcrumb={context.breadcrumb}>
|
|
102
110
|
{context.isAdditional ? (
|
|
103
|
-
<
|
|
111
|
+
<StyledAdditional
|
|
104
112
|
size="normal"
|
|
105
|
-
color={colors.brand.dark}
|
|
106
113
|
aria-label={t("resource.tooltipAdditionalTopic")}
|
|
107
|
-
|
|
114
|
+
aria-hidden={false}
|
|
108
115
|
/>
|
|
109
116
|
) : (
|
|
110
|
-
<
|
|
111
|
-
size="normal"
|
|
112
|
-
color={colors.brand.primary}
|
|
113
|
-
aria-label={t("resource.tooltipCoreTopic")}
|
|
114
|
-
ariaHidden={false}
|
|
115
|
-
/>
|
|
117
|
+
<StyledCore size="normal" aria-label={t("resource.tooltipCoreTopic")} aria-hidden={false} />
|
|
116
118
|
)}
|
|
117
119
|
</Breadcrumb>
|
|
118
120
|
</ContextListItem>
|
|
@@ -10,7 +10,6 @@ import { Meta, StoryObj } from "@storybook/react";
|
|
|
10
10
|
import { ButtonV2 } from "@ndla/button";
|
|
11
11
|
import { PersonOutlined } from "@ndla/icons/common";
|
|
12
12
|
import { Snack, SnackbarProvider, useSnack } from ".";
|
|
13
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
14
13
|
|
|
15
14
|
const SnackComponent = ({ ...args }: Snack) => {
|
|
16
15
|
const { addSnack } = useSnack();
|
|
@@ -30,7 +29,6 @@ export default {
|
|
|
30
29
|
tags: ["autodocs"],
|
|
31
30
|
parameters: {
|
|
32
31
|
inlineStories: true,
|
|
33
|
-
...defaultParameters,
|
|
34
32
|
},
|
|
35
33
|
args: {
|
|
36
34
|
content: <span>This is a snack</span>,
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import { Meta, StoryFn } from "@storybook/react";
|
|
10
10
|
import Table from "./Table";
|
|
11
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Tabeller skal brukes til å presentere data (tabulære data), ikke til utforming. Det anbefales å holde tabellene så enkle som mulig. Ved mer kompleksitet kan data heller deles opp i flere tabeller.
|
|
@@ -35,7 +34,6 @@ const meta: Meta = {
|
|
|
35
34
|
),
|
|
36
35
|
],
|
|
37
36
|
title: "Base styles/Tables",
|
|
38
|
-
parameters: defaultParameters,
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
export default meta;
|
|
@@ -10,7 +10,6 @@ import { useState } from "react";
|
|
|
10
10
|
import styled from "@emotion/styled";
|
|
11
11
|
import { Meta, StoryFn } from "@storybook/react";
|
|
12
12
|
import TagSelector from "./TagSelector";
|
|
13
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Komponent for å tagge noe, primært tiltenkt Min NDLA
|
|
@@ -21,7 +20,6 @@ export default {
|
|
|
21
20
|
tags: ["autodocs"],
|
|
22
21
|
parameters: {
|
|
23
22
|
inlineStories: true,
|
|
24
|
-
...defaultParameters,
|
|
25
23
|
},
|
|
26
24
|
argTypes: {
|
|
27
25
|
onChange: { control: false },
|
|
@@ -13,7 +13,6 @@ import { IFolder } from "@ndla/types-backend/learningpath-api";
|
|
|
13
13
|
import { uuid } from "@ndla/util";
|
|
14
14
|
import { flattenFolders } from "./helperFunctions";
|
|
15
15
|
import TreeStructure, { TreeStructureProps } from "./TreeStructure";
|
|
16
|
-
import { defaultParameters } from "../../../../stories/defaults";
|
|
17
16
|
import { FolderInput } from "../MyNdla";
|
|
18
17
|
|
|
19
18
|
const MY_FOLDERS_ID = "folders";
|
|
@@ -124,7 +123,6 @@ export default {
|
|
|
124
123
|
component: TreeStructure,
|
|
125
124
|
parameters: {
|
|
126
125
|
inlineStories: true,
|
|
127
|
-
...defaultParameters,
|
|
128
126
|
},
|
|
129
127
|
args: {
|
|
130
128
|
defaultOpenFolders: [MY_FOLDERS_ID],
|
|
@@ -36,6 +36,8 @@ export const resourceTypeColor = (type: string) => {
|
|
|
36
36
|
case resourceEmbedTypeMapping.concept:
|
|
37
37
|
case resourceEmbedTypeMapping.audio:
|
|
38
38
|
return colors.brand.greyLight;
|
|
39
|
+
case contentTypes.MISSING:
|
|
40
|
+
return colors.brand.greyLight;
|
|
39
41
|
default:
|
|
40
42
|
return "";
|
|
41
43
|
}
|