@ndla/ui 56.0.2-alpha.0 → 56.0.4-alpha.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/dist/panda.buildinfo.json +34 -5
- package/dist/styles.css +144 -18
- package/es/Article/Article.js +1 -5
- package/es/Article/ArticleByline.js +3 -3
- package/es/Article/ArticleContent.js +27 -0
- package/es/Article/index.js +2 -1
- package/es/AudioPlayer/Controls.js +8 -8
- package/es/AudioPlayer/SpeechControl.js +2 -2
- package/es/Breadcrumb/BreadcrumbItem.js +2 -2
- package/es/Breadcrumb/HomeBreadcrumb.js +5 -5
- package/es/CampaignBlock/CampaignBlock.js +2 -2
- package/es/ContentTypeBadge/ContentTypeBadge.js +15 -15
- package/es/CopyParagraphButton/CopyParagraphButton.js +4 -4
- package/es/Embed/CodeEmbed.js +3 -3
- package/es/Embed/EmbedErrorPlaceholder.js +2 -2
- package/es/Embed/ImageEmbed.js +6 -5
- package/es/Embed/UuDisclaimerEmbed.js +2 -2
- package/es/ErrorMessage/ErrorMessage.js +2 -0
- package/es/ErrorMessage/ErrorResourceAccessDenied.js +3 -3
- package/es/FactBox/FactBox.js +2 -2
- package/es/FileList/File.js +78 -23
- package/es/FileList/FileList.js +32 -37
- package/es/FileList/PdfFile.js +17 -16
- package/es/FileList/index.js +3 -5
- package/es/Gloss/Gloss.js +2 -2
- package/es/Grid/Grid.js +69 -48
- package/es/Grid/GridParallaxItem.js +32 -0
- package/es/Grid/index.js +2 -1
- package/es/KeyFigure/KeyFigure.js +28 -33
- package/es/LicenseByline/EmbedByline.js +2 -2
- package/es/LinkBlock/LinkBlock.js +4 -3
- package/es/LinkBlock/LinkBlockSection.js +1 -0
- package/es/RelatedArticleList/RelatedArticleList.js +1 -1
- package/es/ResourceBox/ResourceBox.js +2 -2
- package/es/TagSelector/TagSelector.js +2 -2
- package/es/TreeStructure/AddFolderButton.js +4 -4
- package/es/TreeStructure/ComboboxButton.js +4 -4
- package/es/TreeStructure/FolderItem.js +16 -16
- package/es/index.js +1 -4
- package/es/styles.css +144 -18
- package/lib/Article/Article.d.ts +0 -1
- package/lib/Article/Article.js +3 -7
- package/lib/Article/ArticleByline.js +2 -2
- package/lib/Article/ArticleContent.d.ts +11 -0
- package/lib/Article/ArticleContent.js +33 -0
- package/lib/Article/index.d.ts +2 -1
- package/lib/Article/index.js +2 -1
- package/lib/AudioPlayer/Controls.js +5 -5
- package/lib/AudioPlayer/SpeechControl.js +1 -1
- package/lib/Breadcrumb/BreadcrumbItem.js +1 -1
- package/lib/Breadcrumb/HomeBreadcrumb.js +4 -4
- package/lib/CampaignBlock/CampaignBlock.js +1 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.js +11 -11
- package/lib/CopyParagraphButton/CopyParagraphButton.js +4 -4
- package/lib/Embed/CodeEmbed.js +1 -1
- package/lib/Embed/EmbedErrorPlaceholder.js +1 -1
- package/lib/Embed/ImageEmbed.js +4 -3
- package/lib/Embed/UuDisclaimerEmbed.js +1 -1
- package/lib/ErrorMessage/ErrorMessage.js +2 -0
- package/lib/ErrorMessage/ErrorResourceAccessDenied.js +2 -2
- package/lib/FactBox/FactBox.js +1 -1
- package/lib/FileList/File.d.ts +5 -3
- package/lib/FileList/File.js +78 -23
- package/lib/FileList/FileList.d.ts +6 -6
- package/lib/FileList/FileList.js +35 -38
- package/lib/FileList/PdfFile.d.ts +2 -2
- package/lib/FileList/PdfFile.js +17 -15
- package/lib/FileList/index.d.ts +3 -5
- package/lib/FileList/index.js +19 -18
- package/lib/Gloss/Gloss.js +1 -1
- package/lib/Grid/Grid.d.ts +4 -7
- package/lib/Grid/Grid.js +71 -49
- package/lib/Grid/GridParallaxItem.d.ts +9 -0
- package/lib/Grid/GridParallaxItem.js +39 -0
- package/lib/Grid/index.d.ts +2 -1
- package/lib/Grid/index.js +4 -5
- package/lib/KeyFigure/KeyFigure.js +30 -33
- package/lib/LicenseByline/EmbedByline.js +1 -1
- package/lib/LinkBlock/LinkBlock.js +3 -2
- package/lib/LinkBlock/LinkBlockSection.js +1 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +1 -1
- package/lib/ResourceBox/ResourceBox.js +1 -1
- package/lib/TagSelector/TagSelector.js +1 -1
- package/lib/TreeStructure/AddFolderButton.js +3 -3
- package/lib/TreeStructure/ComboboxButton.js +3 -3
- package/lib/TreeStructure/FolderItem.js +13 -13
- package/lib/index.d.ts +1 -4
- package/lib/index.js +9 -24
- package/lib/styles.css +144 -18
- package/package.json +7 -7
- package/src/Article/Article.tsx +1 -6
- package/src/Article/ArticleByline.tsx +3 -3
- package/src/Article/ArticleContent.tsx +21 -0
- package/src/Article/index.ts +2 -1
- package/src/AudioPlayer/Controls.tsx +8 -8
- package/src/AudioPlayer/SpeechControl.tsx +2 -2
- package/src/Breadcrumb/BreadcrumbItem.tsx +2 -2
- package/src/Breadcrumb/HomeBreadcrumb.tsx +5 -5
- package/src/CampaignBlock/CampaignBlock.tsx +2 -2
- package/src/ContentTypeBadge/ContentTypeBadge.stories.tsx +8 -7
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +15 -24
- package/src/ContentTypeBadge/ContentTypeBadgeNew.stories.tsx +2 -2
- package/src/CopyParagraphButton/CopyParagraphButton.tsx +2 -2
- package/src/Embed/CodeEmbed.tsx +3 -3
- package/src/Embed/EmbedErrorPlaceholder.tsx +2 -2
- package/src/Embed/ImageEmbed.tsx +7 -6
- package/src/Embed/UuDisclaimerEmbed.tsx +2 -2
- package/src/ErrorMessage/ErrorMessage.tsx +2 -0
- package/src/ErrorMessage/ErrorResourceAccessDenied.tsx +3 -3
- package/src/FactBox/FactBox.tsx +2 -2
- package/src/FileList/File.tsx +63 -28
- package/src/FileList/FileList.stories.tsx +121 -12
- package/src/FileList/FileList.tsx +31 -37
- package/src/FileList/PdfFile.tsx +9 -9
- package/src/FileList/index.ts +3 -7
- package/src/Gloss/Gloss.tsx +2 -2
- package/src/Grid/Grid.stories.tsx +30 -31
- package/src/Grid/Grid.tsx +57 -85
- package/src/Grid/GridParallaxItem.tsx +26 -0
- package/src/Grid/index.ts +3 -1
- package/src/KeyFigure/KeyFigure.stories.tsx +18 -11
- package/src/KeyFigure/KeyFigure.tsx +33 -47
- package/src/LicenseByline/EmbedByline.tsx +2 -2
- package/src/LinkBlock/LinkBlock.tsx +4 -3
- package/src/LinkBlock/LinkBlockSection.tsx +1 -1
- package/src/RelatedArticleList/RelatedArticleList.tsx +1 -1
- package/src/ResourceBox/ResourceBox.tsx +2 -2
- package/src/TagSelector/TagSelector.stories.tsx +6 -6
- package/src/TagSelector/TagSelector.tsx +2 -2
- package/src/TreeStructure/AddFolderButton.tsx +2 -2
- package/src/TreeStructure/ComboboxButton.tsx +2 -2
- package/src/TreeStructure/FolderItem.tsx +8 -8
- package/src/TreeStructure/TreeStructure.stories.tsx +4 -4
- package/src/index.ts +1 -7
- package/es/FileList/Format.js +0 -93
- package/es/Footer/FooterBlock.js +0 -17
- package/es/Footer/index.js +0 -9
- package/es/Messages/MessageBox.js +0 -79
- package/es/Messages/index.js +0 -10
- package/es/utils/resourceTypeColor.js +0 -46
- package/lib/FileList/Format.d.ts +0 -16
- package/lib/FileList/Format.js +0 -98
- package/lib/Footer/FooterBlock.d.ts +0 -13
- package/lib/Footer/FooterBlock.js +0 -24
- package/lib/Footer/index.d.ts +0 -8
- package/lib/Footer/index.js +0 -12
- package/lib/Messages/MessageBox.d.ts +0 -23
- package/lib/Messages/MessageBox.js +0 -87
- package/lib/Messages/index.d.ts +0 -9
- package/lib/Messages/index.js +0 -13
- package/lib/utils/resourceTypeColor.d.ts +0 -9
- package/lib/utils/resourceTypeColor.js +0 -54
- package/src/FileList/Format.tsx +0 -83
- package/src/Footer/Footer.stories.tsx +0 -35
- package/src/Footer/FooterBlock.tsx +0 -30
- package/src/Footer/index.ts +0 -9
- package/src/Messages/MessageBox.stories.tsx +0 -95
- package/src/Messages/MessageBox.tsx +0 -126
- package/src/Messages/index.ts +0 -11
- package/src/utils/resourceTypeColor.tsx +0 -46
|
@@ -6,52 +6,51 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import styled from "@emotion/styled";
|
|
10
|
-
import { DocsContainer, DocsContainerProps } from "@storybook/addon-docs";
|
|
11
9
|
import { Meta, StoryFn } from "@storybook/react";
|
|
12
|
-
import {
|
|
13
|
-
import Grid from "./Grid";
|
|
10
|
+
import { ArticleContent, ArticleWrapper, OneColumn } from "@ndla/ui";
|
|
11
|
+
import { Grid } from "./Grid";
|
|
14
12
|
import { BlogPostStory } from "../BlogPost/BlogPost.stories";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
const GridWrapper = styled.div`
|
|
18
|
-
.docs-story {
|
|
19
|
-
background-color: ${colors.background.lightBlue};
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
const GridDocsContainer = ({ ...props }: DocsContainerProps) => (
|
|
24
|
-
<GridWrapper>
|
|
25
|
-
<DocsContainer {...props} />
|
|
26
|
-
</GridWrapper>
|
|
27
|
-
);
|
|
13
|
+
import { Plain } from "../KeyFigure/KeyFigure.stories";
|
|
28
14
|
|
|
29
15
|
export default {
|
|
30
16
|
title: "Components/Grid",
|
|
31
17
|
component: Grid,
|
|
32
18
|
tags: ["autodocs"],
|
|
33
19
|
parameters: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
container: GridDocsContainer,
|
|
37
|
-
},
|
|
20
|
+
inlineStories: true,
|
|
21
|
+
layout: "fullscreen",
|
|
38
22
|
},
|
|
39
23
|
args: {
|
|
40
|
-
columns: "
|
|
24
|
+
columns: "3",
|
|
41
25
|
border: "none",
|
|
42
|
-
background: "
|
|
26
|
+
background: "gray",
|
|
43
27
|
},
|
|
28
|
+
decorators: [
|
|
29
|
+
(Story) => (
|
|
30
|
+
<OneColumn wide>
|
|
31
|
+
<ArticleWrapper>
|
|
32
|
+
<ArticleContent>
|
|
33
|
+
<Story />
|
|
34
|
+
</ArticleContent>
|
|
35
|
+
</ArticleWrapper>
|
|
36
|
+
</OneColumn>
|
|
37
|
+
),
|
|
38
|
+
],
|
|
44
39
|
} as Meta<typeof Grid>;
|
|
45
40
|
|
|
41
|
+
const keyFigureArgs = [
|
|
42
|
+
{ title: "22 000+", subtitle: "Tilgjengelige ressurser" },
|
|
43
|
+
{ title: "149", subtitle: "Eksamensfag" },
|
|
44
|
+
{ title: "500", subtitle: "Tverrfaglige ressurser" },
|
|
45
|
+
{ title: "0", subtitle: "Dårlige ideer" },
|
|
46
|
+
];
|
|
47
|
+
|
|
46
48
|
export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
47
49
|
const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
|
|
48
|
-
const items = new Array(columns).fill(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
image={KeyFigureStory.args?.image!}
|
|
53
|
-
/>,
|
|
54
|
-
);
|
|
50
|
+
const items = new Array(columns).fill(0).map((_, idx) => {
|
|
51
|
+
const args = keyFigureArgs[idx % keyFigureArgs.length];
|
|
52
|
+
return <Plain key={idx} {...args} />;
|
|
53
|
+
});
|
|
55
54
|
return <Grid {...args}>{items}</Grid>;
|
|
56
55
|
};
|
|
57
56
|
|
|
@@ -61,7 +60,7 @@ export const GridBlogPostStory: StoryFn<typeof Grid> = ({ ...args }) => {
|
|
|
61
60
|
<BlogPostStory
|
|
62
61
|
metaImage={BlogPostStory.args?.metaImage!}
|
|
63
62
|
title={BlogPostStory.args?.title!}
|
|
64
|
-
size={
|
|
63
|
+
size={"normal"}
|
|
65
64
|
headingLevel={BlogPostStory.args?.headingLevel}
|
|
66
65
|
url={BlogPostStory.args?.url!}
|
|
67
66
|
author={BlogPostStory.args?.author}
|
package/src/Grid/Grid.tsx
CHANGED
|
@@ -6,103 +6,75 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import styled from "@
|
|
11
|
-
|
|
9
|
+
import { ReactNode } from "react";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
+
|
|
12
|
+
const GridContainer = styled("div", {
|
|
13
|
+
base: {
|
|
14
|
+
display: "grid",
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
borderRadius: "xsmall",
|
|
17
|
+
padding: "xsmall",
|
|
18
|
+
gridRowGap: "large",
|
|
19
|
+
gridColumnGap: "medium",
|
|
20
|
+
width: "100%",
|
|
21
|
+
backgroundColor: "background.subtle",
|
|
22
|
+
maxWidth: "surface.4xlarge",
|
|
23
|
+
minWidth: "surface.xxsmall",
|
|
24
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
25
|
+
tabletDown: {
|
|
26
|
+
gridTemplateColumns: "repeat(1, minmax(0, 1fr))",
|
|
27
|
+
},
|
|
28
|
+
tabletToDesktop: {
|
|
29
|
+
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
|
30
|
+
"& > div:nth-child(3):last-child": {
|
|
31
|
+
display: "flex",
|
|
32
|
+
flexFlow: "column",
|
|
33
|
+
justifyContent: "center",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
gridColumn: "span 2",
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
variants: {
|
|
40
|
+
columns: {
|
|
41
|
+
"2": {},
|
|
42
|
+
"2x2": {},
|
|
43
|
+
"3": { desktop: { gridTemplateColumns: "repeat(3, minmax(0, 1fr))" } },
|
|
44
|
+
"4": { desktop: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" } },
|
|
45
|
+
},
|
|
46
|
+
background: {
|
|
47
|
+
white: { backgroundColor: "surface.default" },
|
|
48
|
+
transparent: { backgroundColor: "transparent" },
|
|
49
|
+
gray: { backgroundColor: "background.subtle" },
|
|
50
|
+
},
|
|
51
|
+
border: {
|
|
52
|
+
lightBlue: {
|
|
53
|
+
border: "1px solid",
|
|
54
|
+
borderColor: "surface.brand.2",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
12
59
|
|
|
13
60
|
export interface GridProps {
|
|
14
|
-
columns: "2" | "4" | "2x2";
|
|
61
|
+
columns: "2" | "3" | "4" | "2x2";
|
|
15
62
|
border?: "none" | "lightBlue";
|
|
16
|
-
background?: "transparent" | "white";
|
|
17
|
-
size?: boolean;
|
|
63
|
+
background?: "transparent" | "white" | "gray";
|
|
18
64
|
children?: ReactNode[];
|
|
19
65
|
}
|
|
20
66
|
|
|
21
|
-
const
|
|
22
|
-
display: grid;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
border-radius: ${misc.borderRadius};
|
|
25
|
-
grid-template-columns: 1fr;
|
|
26
|
-
grid-gap: ${spacing.normal};
|
|
27
|
-
padding: ${spacing.normal};
|
|
28
|
-
margin-bottom: ${spacing.normal};
|
|
29
|
-
clear: both;
|
|
30
|
-
|
|
31
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
32
|
-
&[data-columns="2x2"],
|
|
33
|
-
&[data-columns="3"],
|
|
34
|
-
&[data-columns="4"] {
|
|
35
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
40
|
-
> div:nth-child(3):last-child {
|
|
41
|
-
display: flex;
|
|
42
|
-
flex-flow: column;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
align-items: center;
|
|
45
|
-
grid-column: span 2;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
50
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
51
|
-
|
|
52
|
-
&[data-columns="3"] {
|
|
53
|
-
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&[data-columns="4"] {
|
|
57
|
-
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&[data-frontpage="true"] {
|
|
62
|
-
grid-gap: ${spacing.large};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&[data-border="lightBlue"] {
|
|
66
|
-
border: 1px solid ${colors.brand.lighter};
|
|
67
|
-
}
|
|
68
|
-
&[data-background="white"] {
|
|
69
|
-
background-color: ${colors.white};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
p {
|
|
73
|
-
word-break: break-word;
|
|
74
|
-
margin-top: 0px;
|
|
75
|
-
}
|
|
76
|
-
`;
|
|
77
|
-
|
|
78
|
-
const Grid = ({ columns, border, children, background, size, ...rest }: GridProps) => {
|
|
67
|
+
export const Grid = ({ columns, border, children, background = "gray" }: GridProps) => {
|
|
79
68
|
const amountOfColumns = children?.length === 3 ? "3" : columns;
|
|
80
69
|
|
|
81
70
|
return (
|
|
82
71
|
<GridContainer
|
|
83
|
-
data-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{...rest}
|
|
72
|
+
data-embed-type="grid"
|
|
73
|
+
border={border === "none" ? undefined : border}
|
|
74
|
+
columns={amountOfColumns}
|
|
75
|
+
background={background}
|
|
88
76
|
>
|
|
89
77
|
{children}
|
|
90
78
|
</GridContainer>
|
|
91
79
|
);
|
|
92
80
|
};
|
|
93
|
-
|
|
94
|
-
const StyledGridParallaxItem = styled.div`
|
|
95
|
-
position: relative;
|
|
96
|
-
> div {
|
|
97
|
-
top: var(--masthead-height, 0px);
|
|
98
|
-
position: sticky;
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
|
-
export const GridParallaxItem = ({ children, ...rest }: HTMLAttributes<HTMLDivElement>) => (
|
|
103
|
-
<StyledGridParallaxItem {...rest}>
|
|
104
|
-
<div>{children}</div>
|
|
105
|
-
</StyledGridParallaxItem>
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
export default Grid;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-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 { HTMLAttributes } from "react";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
+
|
|
12
|
+
const StyledGridParallaxItem = styled("div", {
|
|
13
|
+
base: {
|
|
14
|
+
position: "relative",
|
|
15
|
+
"& > div": {
|
|
16
|
+
top: "var(--masthead-height, 0px)",
|
|
17
|
+
position: "sticky",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const GridParallaxItem = ({ children, ...rest }: HTMLAttributes<HTMLDivElement>) => (
|
|
23
|
+
<StyledGridParallaxItem {...rest} data-embed-type="grid-parallax">
|
|
24
|
+
<div>{children}</div>
|
|
25
|
+
</StyledGridParallaxItem>
|
|
26
|
+
);
|
package/src/Grid/index.ts
CHANGED
|
@@ -6,15 +6,12 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
9
|
+
import { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
10
10
|
import KeyFigure from "./KeyFigure";
|
|
11
|
+
|
|
11
12
|
const args = {
|
|
12
|
-
title: "
|
|
13
|
-
subtitle:
|
|
14
|
-
image: {
|
|
15
|
-
alt: "Nøkkeltall tverrfaglig",
|
|
16
|
-
src: "https://api.test.ndla.no/image-api/raw/wMowCjRg.svg",
|
|
17
|
-
},
|
|
13
|
+
title: "22 000+",
|
|
14
|
+
subtitle: "Tilgjengelige ressurser",
|
|
18
15
|
};
|
|
19
16
|
|
|
20
17
|
export default {
|
|
@@ -24,12 +21,22 @@ export default {
|
|
|
24
21
|
parameters: {
|
|
25
22
|
layout: "centered",
|
|
26
23
|
},
|
|
27
|
-
args
|
|
24
|
+
args,
|
|
28
25
|
} as Meta<typeof KeyFigure>;
|
|
29
26
|
|
|
30
|
-
export const
|
|
27
|
+
export const Plain: StoryFn<typeof KeyFigure> = ({ ...args }) => {
|
|
31
28
|
return <KeyFigure {...args} />;
|
|
32
29
|
};
|
|
33
30
|
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
export const WithImageAndHTML: StoryObj<typeof KeyFigure> = {
|
|
32
|
+
args: {
|
|
33
|
+
title: "<i>500</i>",
|
|
34
|
+
subtitle: `<span lang="nn">TVERRFAGLEGE</span> RESSURSER`,
|
|
35
|
+
image: {
|
|
36
|
+
alt: "Nøkkeltall tverrfaglig",
|
|
37
|
+
src: "https://api.test.ndla.no/image-api/raw/wMowCjRg.svg",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
Plain.args = args;
|
|
@@ -7,51 +7,37 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import parse from "html-react-parser";
|
|
10
|
-
import styled from "@
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
const SubTitleWrapper = styled.div`
|
|
44
|
-
overflow-wrap: "break-word";
|
|
45
|
-
text-align: center;
|
|
46
|
-
${fonts.sizes("18px", "29px")};
|
|
47
|
-
color: ${colors.text.primary};
|
|
48
|
-
font-weight: ${fonts.weight.normal};
|
|
49
|
-
font-family: ${fonts.sans};
|
|
50
|
-
|
|
51
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
52
|
-
padding-top: ${spacing.xxsmall};
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
11
|
+
|
|
12
|
+
const ContentWrapper = styled("div", {
|
|
13
|
+
base: {
|
|
14
|
+
display: "flex",
|
|
15
|
+
flexDirection: "column",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const StyledImage = styled("img", {
|
|
22
|
+
base: {
|
|
23
|
+
height: "surface.3xsmall",
|
|
24
|
+
width: "surface.3xsmall",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const TitleWrapper = styled("div", {
|
|
29
|
+
base: {
|
|
30
|
+
textStyle: "heading.large",
|
|
31
|
+
textAlign: "center",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const SubTitleWrapper = styled("div", {
|
|
36
|
+
base: {
|
|
37
|
+
textStyle: "title.medium",
|
|
38
|
+
textAlign: "center",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
55
41
|
|
|
56
42
|
interface Props {
|
|
57
43
|
image?: {
|
|
@@ -64,8 +50,8 @@ interface Props {
|
|
|
64
50
|
|
|
65
51
|
const KeyFigure = ({ image, title, subtitle }: Props) => {
|
|
66
52
|
return (
|
|
67
|
-
<ContentWrapper>
|
|
68
|
-
<StyledImage src={`${image?.src}?width=150`} width={150} height={150} alt={image?.alt} />
|
|
53
|
+
<ContentWrapper data-embed-type="key-figure">
|
|
54
|
+
{image && <StyledImage src={`${image?.src}?width=150`} width={150} height={150} alt={image?.alt} />}
|
|
69
55
|
<TitleWrapper>{parse(title)}</TitleWrapper>
|
|
70
56
|
<SubTitleWrapper>{parse(subtitle)}</SubTitleWrapper>
|
|
71
57
|
</ContentWrapper>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { ReactNode, useState } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import {
|
|
11
|
+
import { AlertLine } from "@ndla/icons/common";
|
|
12
12
|
import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
|
|
13
13
|
import { Button, Text } from "@ndla/primitives";
|
|
14
14
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -122,7 +122,7 @@ export const EmbedByline = ({ type, description, children, visibleAlt, ...props
|
|
|
122
122
|
return (
|
|
123
123
|
<ErrorBylineWrapper>
|
|
124
124
|
<ContentWrapper>
|
|
125
|
-
<
|
|
125
|
+
<AlertLine />
|
|
126
126
|
<BaseDescription>
|
|
127
127
|
<span>{t("embed.embedError", { type: typeString })}</span>
|
|
128
128
|
</BaseDescription>
|
|
@@ -10,7 +10,8 @@ import { format } from "date-fns";
|
|
|
10
10
|
import { enGB, nb, nn } from "date-fns/locale";
|
|
11
11
|
import parse from "html-react-parser";
|
|
12
12
|
import { useMemo } from "react";
|
|
13
|
-
import {
|
|
13
|
+
import { ArrowRightLine } from "@ndla/icons/common";
|
|
14
|
+
import { CalendarLine } from "@ndla/icons/editor";
|
|
14
15
|
import { Heading } from "@ndla/primitives";
|
|
15
16
|
import { SafeLink } from "@ndla/safelink";
|
|
16
17
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -63,7 +64,7 @@ const StyledDateContainer = styled("div", {
|
|
|
63
64
|
},
|
|
64
65
|
});
|
|
65
66
|
|
|
66
|
-
const StyledCalendarEd = styled(
|
|
67
|
+
const StyledCalendarEd = styled(CalendarLine, {
|
|
67
68
|
base: {
|
|
68
69
|
color: "icon.strong",
|
|
69
70
|
},
|
|
@@ -94,7 +95,7 @@ const LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {
|
|
|
94
95
|
</StyledDateContainer>
|
|
95
96
|
)}
|
|
96
97
|
</InfoWrapper>
|
|
97
|
-
<
|
|
98
|
+
<ArrowRightLine data-forward />
|
|
98
99
|
</StyledSafeLink>
|
|
99
100
|
);
|
|
100
101
|
};
|
|
@@ -24,7 +24,7 @@ const StyledList = styled("ul", {
|
|
|
24
24
|
|
|
25
25
|
const LinkBlockSection = ({ children, ...rest }: Props) => {
|
|
26
26
|
return (
|
|
27
|
-
<nav {...rest}>
|
|
27
|
+
<nav {...rest} data-embed-type="link-block-list">
|
|
28
28
|
<StyledList>
|
|
29
29
|
{Children.map(children, (child) => (
|
|
30
30
|
<li>{child}</li>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { ShareBoxLine } from "@ndla/icons/common";
|
|
10
10
|
import { Heading, Image, Text } from "@ndla/primitives";
|
|
11
11
|
import { SafeLinkButton } from "@ndla/safelink";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -93,7 +93,7 @@ export const ResourceBox = ({ image, title, caption, url, buttonText }: Props) =
|
|
|
93
93
|
<StyledText textStyle="body.medium">{caption}</StyledText>
|
|
94
94
|
<SafeLinkButton to={url} target="_blank" variant="secondary">
|
|
95
95
|
{buttonText}
|
|
96
|
-
<
|
|
96
|
+
<ShareBoxLine />
|
|
97
97
|
</SafeLinkButton>
|
|
98
98
|
</ContentWrapper>
|
|
99
99
|
</Container>
|
|
@@ -10,9 +10,9 @@ import { useState } from "react";
|
|
|
10
10
|
import type { ComboboxInputValueChangeDetails } from "@ark-ui/react";
|
|
11
11
|
|
|
12
12
|
import { Meta, StoryFn } from "@storybook/react";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { CloseLine } from "@ndla/icons/action";
|
|
14
|
+
import { ArrowDownShortLine } from "@ndla/icons/common";
|
|
15
|
+
import { CheckLine } from "@ndla/icons/editor";
|
|
16
16
|
import {
|
|
17
17
|
ComboboxContent,
|
|
18
18
|
ComboboxItem,
|
|
@@ -82,14 +82,14 @@ export const Default: StoryFn<typeof TagSelectorRoot> = ({ translations, ...args
|
|
|
82
82
|
|
|
83
83
|
<TagSelectorClearTrigger asChild>
|
|
84
84
|
<IconButton variant="clear">
|
|
85
|
-
<
|
|
85
|
+
<CloseLine />
|
|
86
86
|
</IconButton>
|
|
87
87
|
</TagSelectorClearTrigger>
|
|
88
88
|
</InputContainer>
|
|
89
89
|
</TagSelectorControl>
|
|
90
90
|
<TagSelectorTrigger asChild>
|
|
91
91
|
<IconButton variant="secondary">
|
|
92
|
-
<
|
|
92
|
+
<ArrowDownShortLine />
|
|
93
93
|
</IconButton>
|
|
94
94
|
</TagSelectorTrigger>
|
|
95
95
|
</HStack>
|
|
@@ -99,7 +99,7 @@ export const Default: StoryFn<typeof TagSelectorRoot> = ({ translations, ...args
|
|
|
99
99
|
<ComboboxItem key={item} item={item}>
|
|
100
100
|
<ComboboxItemText>{item}</ComboboxItemText>
|
|
101
101
|
<ComboboxItemIndicator>
|
|
102
|
-
<
|
|
102
|
+
<CheckLine />
|
|
103
103
|
</ComboboxItemIndicator>
|
|
104
104
|
</ComboboxItem>
|
|
105
105
|
))}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { forwardRef, useEffect, useId, useRef } from "react";
|
|
10
10
|
import type { ComboboxCollectionItem } from "@ark-ui/react";
|
|
11
11
|
import { ComboboxContext, useTagsInputContext } from "@ark-ui/react";
|
|
12
|
-
import {
|
|
12
|
+
import { CloseLine } from "@ndla/icons/action";
|
|
13
13
|
import {
|
|
14
14
|
ComboboxClearTrigger,
|
|
15
15
|
ComboboxControl,
|
|
@@ -153,7 +153,7 @@ export const TagSelectorInput = forwardRef<HTMLInputElement, TagSelectorInputPro
|
|
|
153
153
|
<TagsInputItemPreview>
|
|
154
154
|
<TagsInputItemText>{value}</TagsInputItemText>
|
|
155
155
|
<TagsInputItemDeleteTrigger>
|
|
156
|
-
<
|
|
156
|
+
<CloseLine />
|
|
157
157
|
</TagsInputItemDeleteTrigger>
|
|
158
158
|
</TagsInputItemPreview>
|
|
159
159
|
<TagsInputItemInput />
|
|
@@ -10,7 +10,7 @@ import { useRef } from "react";
|
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
11
|
import styled from "@emotion/styled";
|
|
12
12
|
import { ButtonV2 as Button } from "@ndla/button";
|
|
13
|
-
import {
|
|
13
|
+
import { AddLine } from "@ndla/icons/action";
|
|
14
14
|
import { IFolder } from "@ndla/types-backend/myndla-api";
|
|
15
15
|
|
|
16
16
|
interface AddFolderButtonProps {
|
|
@@ -28,7 +28,7 @@ const StyledAddFolderButton = styled(Button)`
|
|
|
28
28
|
}
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
|
-
const StyledPlus = styled(
|
|
31
|
+
const StyledPlus = styled(AddLine)`
|
|
32
32
|
height: 24px;
|
|
33
33
|
width: 24px;
|
|
34
34
|
`;
|
|
@@ -10,7 +10,7 @@ import { KeyboardEvent, forwardRef } from "react";
|
|
|
10
10
|
import styled from "@emotion/styled";
|
|
11
11
|
import { ButtonV2 as Button, IconButtonV2 as IconButton } from "@ndla/button";
|
|
12
12
|
import { breakpoints, colors, mq, spacing } from "@ndla/core";
|
|
13
|
-
import {
|
|
13
|
+
import { ArrowUpShortLine, ArrowDownShortLine } from "@ndla/icons/common";
|
|
14
14
|
import { IFolder } from "@ndla/types-backend/myndla-api";
|
|
15
15
|
import { useForwardedRef } from "@ndla/util";
|
|
16
16
|
import { arrowNavigation } from "./arrowNavigation";
|
|
@@ -162,7 +162,7 @@ const ComboboxButton = forwardRef<HTMLButtonElement, Props>(
|
|
|
162
162
|
onToggleTree(!showTree);
|
|
163
163
|
}}
|
|
164
164
|
>
|
|
165
|
-
{showTree ? <
|
|
165
|
+
{showTree ? <ArrowUpShortLine /> : <ArrowDownShortLine />}
|
|
166
166
|
</IconButton>
|
|
167
167
|
</StyledRow>
|
|
168
168
|
);
|
|
@@ -11,9 +11,9 @@ import { useTranslation } from "react-i18next";
|
|
|
11
11
|
import styled from "@emotion/styled";
|
|
12
12
|
import { ButtonV2 as Button } from "@ndla/button";
|
|
13
13
|
import { colors, spacing, animations, misc, fonts } from "@ndla/core";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
14
|
+
import { ArrowDownShortLine } from "@ndla/icons/common";
|
|
15
|
+
import { FolderUserFill } from "@ndla/icons/contentType";
|
|
16
|
+
import { CheckLine, FolderLine } from "@ndla/icons/editor";
|
|
17
17
|
import { SafeLink } from "@ndla/safelink";
|
|
18
18
|
import { IFolder } from "@ndla/types-backend/myndla-api";
|
|
19
19
|
import { arrowNavigation } from "./arrowNavigation";
|
|
@@ -103,7 +103,7 @@ const FolderName = styled(Button)`
|
|
|
103
103
|
}
|
|
104
104
|
`;
|
|
105
105
|
|
|
106
|
-
const
|
|
106
|
+
const StyledCheck = styled(CheckLine)`
|
|
107
107
|
color: ${colors.support.green};
|
|
108
108
|
`;
|
|
109
109
|
|
|
@@ -202,7 +202,7 @@ const FolderItem = ({
|
|
|
202
202
|
const isMaxDepth = level > maxLevel;
|
|
203
203
|
const hideArrow = isMaxDepth || emptyFolder;
|
|
204
204
|
|
|
205
|
-
const FolderIcon = folder.status === "shared" ?
|
|
205
|
+
const FolderIcon = folder.status === "shared" ? FolderUserFill : FolderLine;
|
|
206
206
|
|
|
207
207
|
const tabable = selected || focused || (!focusedFolder && !folder.parentId && index === 0);
|
|
208
208
|
|
|
@@ -244,7 +244,7 @@ const FolderItem = ({
|
|
|
244
244
|
}
|
|
245
245
|
}}
|
|
246
246
|
>
|
|
247
|
-
<
|
|
247
|
+
<ArrowDownShortLine />
|
|
248
248
|
</OpenButton>
|
|
249
249
|
<StyledName>{name}</StyledName>
|
|
250
250
|
</FolderNameLink>
|
|
@@ -286,7 +286,7 @@ const FolderItem = ({
|
|
|
286
286
|
}
|
|
287
287
|
}}
|
|
288
288
|
>
|
|
289
|
-
<
|
|
289
|
+
<ArrowDownShortLine />
|
|
290
290
|
</OpenButton>
|
|
291
291
|
<FolderIconWrapper>
|
|
292
292
|
<FolderIcon />
|
|
@@ -294,7 +294,7 @@ const FolderItem = ({
|
|
|
294
294
|
</IconWrapper>
|
|
295
295
|
<StyledName>{name}</StyledName>
|
|
296
296
|
{containsResource && (
|
|
297
|
-
<
|
|
297
|
+
<StyledCheck
|
|
298
298
|
aria-label={t("myNdla.alreadyInFolder")}
|
|
299
299
|
id={`alreadyAdded-${folder.id}`}
|
|
300
300
|
title={t("myNdla.alreadyInFolder")}
|