@ndla/ui 55.0.14-alpha.0 → 55.0.16-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 +40 -13
- package/dist/styles.css +160 -54
- package/es/Article/ArticleByline.js +81 -48
- package/es/Article/ArticleFootNotes.js +31 -19
- package/es/AudioPlayer/AudioPlayer.js +1 -0
- package/es/Concept/Concept.js +2 -2
- package/es/ContactBlock/ContactBlock.js +17 -17
- package/es/ContentTypeBadge/ContentTypeBadgeNew.js +1 -0
- package/es/Embed/BrightcoveEmbed.js +0 -1
- package/es/Embed/CopyrightEmbed.js +1 -2
- package/es/FrontpageArticle/FrontpageArticle.js +1 -2
- package/es/LicenseByline/EmbedByline.js +143 -33
- package/es/LicenseByline/LicenseLink.js +16 -9
- package/es/LicenseByline/index.js +2 -2
- package/es/index.js +0 -2
- package/es/model/ContentType.js +3 -1
- package/es/styles.css +160 -54
- package/lib/Article/ArticleByline.d.ts +1 -3
- package/lib/Article/ArticleByline.js +84 -51
- package/lib/Article/ArticleFootNotes.js +31 -20
- package/lib/AudioPlayer/AudioPlayer.js +1 -0
- package/lib/Concept/Concept.js +1 -1
- package/lib/ContactBlock/ContactBlock.js +18 -18
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +1 -2
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +1 -0
- package/lib/Embed/BrightcoveEmbed.js +0 -1
- package/lib/Embed/CopyrightEmbed.js +1 -2
- package/lib/FrontpageArticle/FrontpageArticle.js +1 -2
- package/lib/LicenseByline/EmbedByline.d.ts +2 -4
- package/lib/LicenseByline/EmbedByline.js +145 -35
- package/lib/LicenseByline/LicenseLink.d.ts +2 -2
- package/lib/LicenseByline/LicenseLink.js +16 -9
- package/lib/LicenseByline/index.d.ts +2 -2
- package/lib/LicenseByline/index.js +4 -5
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -20
- package/lib/model/ContentType.d.ts +1 -0
- package/lib/model/ContentType.js +4 -2
- package/lib/styles.css +160 -54
- package/package.json +5 -6
- package/src/Article/ArticleByline.tsx +83 -70
- package/src/Article/ArticleFootNotes.tsx +32 -36
- package/src/AudioPlayer/AudioPlayer.tsx +1 -0
- package/src/Concept/Concept.tsx +2 -2
- package/src/ContactBlock/ContactBlock.tsx +1 -1
- package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +3 -1
- package/src/Embed/BrightcoveEmbed.tsx +1 -1
- package/src/Embed/CopyrightEmbed.tsx +1 -1
- package/src/FrontpageArticle/FrontpageArticle.tsx +1 -1
- package/src/LicenseByline/EmbedByline.stories.tsx +9 -4
- package/src/LicenseByline/EmbedByline.tsx +139 -53
- package/src/LicenseByline/LicenseLink.tsx +15 -15
- package/src/LicenseByline/index.tsx +2 -2
- package/src/index.ts +0 -3
- package/src/model/ContentType.ts +2 -0
- package/es/CreatedBy/CreatedBy.js +0 -73
- package/es/CreatedBy/index.js +0 -10
- package/es/LicenseByline/LicenseDescription.js +0 -63
- package/es/List/OrderedList.js +0 -41
- package/es/List/UnOrderedList.js +0 -28
- package/es/List/index.js +0 -10
- package/lib/CreatedBy/CreatedBy.d.ts +0 -15
- package/lib/CreatedBy/CreatedBy.js +0 -78
- package/lib/CreatedBy/index.d.ts +0 -9
- package/lib/CreatedBy/index.js +0 -16
- package/lib/LicenseByline/LicenseDescription.d.ts +0 -15
- package/lib/LicenseByline/LicenseDescription.js +0 -70
- package/lib/List/OrderedList.d.ts +0 -16
- package/lib/List/OrderedList.js +0 -48
- package/lib/List/UnOrderedList.d.ts +0 -10
- package/lib/List/UnOrderedList.js +0 -35
- package/lib/List/index.d.ts +0 -9
- package/lib/List/index.js +0 -20
- package/src/CreatedBy/CreatedBy.stories.tsx +0 -36
- package/src/CreatedBy/CreatedBy.tsx +0 -63
- package/src/CreatedBy/index.ts +0 -11
- package/src/LicenseByline/LicenseDescription.tsx +0 -100
- package/src/List/OrderedList.stories.tsx +0 -135
- package/src/List/OrderedList.tsx +0 -158
- package/src/List/UnOrderedList.tsx +0 -43
- package/src/List/UnorderedList.stories.tsx +0 -72
- package/src/List/index.ts +0 -10
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import styled from "@emotion/styled";
|
|
10
|
-
import { colors, fonts } from "@ndla/core";
|
|
11
|
-
import { SafeLink } from "@ndla/safelink";
|
|
12
|
-
import Logo from "../Logo";
|
|
13
|
-
|
|
14
|
-
const Container = styled.div`
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: flex-end;
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
const Wrapper = styled.div`
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
const Text = styled.div`
|
|
25
|
-
color: ${colors.text.light};
|
|
26
|
-
margin-right: 38px;
|
|
27
|
-
font-family: ${fonts.sans};
|
|
28
|
-
${fonts.sizes("20px", "20px")};
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
const StyledSafeLink = styled(SafeLink)`
|
|
32
|
-
color: ${colors.text.light};
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
type Props = {
|
|
36
|
-
name: string;
|
|
37
|
-
description: string;
|
|
38
|
-
url?: string;
|
|
39
|
-
target?: string;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const CreatedBy = ({ name, description, url, target = "_blank" }: Props) => (
|
|
43
|
-
<Container>
|
|
44
|
-
<Wrapper>
|
|
45
|
-
<Text>
|
|
46
|
-
{url ? (
|
|
47
|
-
<StyledSafeLink to={url} target={target}>
|
|
48
|
-
{name}
|
|
49
|
-
</StyledSafeLink>
|
|
50
|
-
) : (
|
|
51
|
-
name
|
|
52
|
-
)}
|
|
53
|
-
{description}
|
|
54
|
-
<StyledSafeLink to={"https://ndla.no"} target={target}>
|
|
55
|
-
NDLA
|
|
56
|
-
</StyledSafeLink>
|
|
57
|
-
</Text>
|
|
58
|
-
<Logo label={"NDLA"} to={"https://ndla.no"} />
|
|
59
|
-
</Wrapper>
|
|
60
|
-
</Container>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
export default CreatedBy;
|
package/src/CreatedBy/index.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
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 { t } from "i18next";
|
|
10
|
-
import { ReactNode, useState } from "react";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { ButtonV2 } from "@ndla/button";
|
|
13
|
-
import { breakpoints, colors, fonts, mq, spacing } from "@ndla/core";
|
|
14
|
-
|
|
15
|
-
interface Props {
|
|
16
|
-
icon?: ReactNode;
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
warningByline?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const StyledFigCaption = styled.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
gap: ${spacing.small};
|
|
24
|
-
align-items: center;
|
|
25
|
-
background: unset;
|
|
26
|
-
padding: unset;
|
|
27
|
-
font-size: unset;
|
|
28
|
-
color: unset;
|
|
29
|
-
p {
|
|
30
|
-
margin: 0;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
const StyledDescription = styled.div`
|
|
35
|
-
display: inline-flex;
|
|
36
|
-
white-space: pre-wrap;
|
|
37
|
-
&[data-warning="false"] {
|
|
38
|
-
${mq.range({ until: breakpoints.mobileWide })} {
|
|
39
|
-
&[data-open="true"] {
|
|
40
|
-
display: inline;
|
|
41
|
-
}
|
|
42
|
-
display: grid;
|
|
43
|
-
grid-template-columns: 1fr auto;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
const TextContent = styled.span`
|
|
50
|
-
&[data-warning="false"] {
|
|
51
|
-
${mq.range({ until: breakpoints.mobileWide })} {
|
|
52
|
-
white-space: nowrap;
|
|
53
|
-
max-height: ${spacing.medium};
|
|
54
|
-
&[data-open="true"] {
|
|
55
|
-
white-space: pre-wrap;
|
|
56
|
-
max-height: none;
|
|
57
|
-
}
|
|
58
|
-
overflow: hidden;
|
|
59
|
-
text-overflow: ellipsis;
|
|
60
|
-
transition: max-height 0.7s ease-in;
|
|
61
|
-
margin: auto 0;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
const Button = styled(ButtonV2)`
|
|
67
|
-
color: ${colors.brand.primary};
|
|
68
|
-
font-weight: ${fonts.weight.semibold};
|
|
69
|
-
min-width: fit-content;
|
|
70
|
-
margin-left: ${spacing.small};
|
|
71
|
-
${mq.range({ from: breakpoints.mobileWide })} {
|
|
72
|
-
display: none;
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
const LicenseDescription = ({ icon, children, warningByline = false }: Props) => {
|
|
77
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
78
|
-
|
|
79
|
-
const handleToggle = () => {
|
|
80
|
-
setIsOpen(!isOpen);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<StyledFigCaption>
|
|
85
|
-
{icon}
|
|
86
|
-
<StyledDescription data-open={isOpen} data-warning={warningByline}>
|
|
87
|
-
<TextContent data-open={isOpen} data-warning={warningByline}>
|
|
88
|
-
{children}
|
|
89
|
-
</TextContent>
|
|
90
|
-
{!warningByline && (
|
|
91
|
-
<Button variant="link" onClick={handleToggle}>
|
|
92
|
-
{isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`}
|
|
93
|
-
</Button>
|
|
94
|
-
)}
|
|
95
|
-
</StyledDescription>
|
|
96
|
-
</StyledFigCaption>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default LicenseDescription;
|
|
@@ -1,135 +0,0 @@
|
|
|
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 { Meta, StoryFn, StoryObj } from "@storybook/react";
|
|
10
|
-
import OrderedList from "./OrderedList";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Lister bør ikke inneholde flere enn 10 punkter. Har du mye mer, bør du vurdere å organisere innholdet annerledes.
|
|
14
|
-
*/
|
|
15
|
-
export default {
|
|
16
|
-
title: "Base Styles/Ordered List",
|
|
17
|
-
tags: ["autodocs"],
|
|
18
|
-
component: OrderedList,
|
|
19
|
-
parameters: {
|
|
20
|
-
inlineStories: true,
|
|
21
|
-
},
|
|
22
|
-
render: ({ ...args }) => (
|
|
23
|
-
<OrderedList {...args}>
|
|
24
|
-
<li>Listepunkt 1</li>
|
|
25
|
-
<li>Listepunkt 2</li>
|
|
26
|
-
<li>
|
|
27
|
-
Listepunkt 3
|
|
28
|
-
<OrderedList {...args}>
|
|
29
|
-
<li>Listepunkt 1</li>
|
|
30
|
-
<li>Listepunkt 2</li>
|
|
31
|
-
<li>
|
|
32
|
-
Listepunkt 3
|
|
33
|
-
<OrderedList {...args}>
|
|
34
|
-
<li>Listepunkt 1</li>
|
|
35
|
-
<li>Listepunkt 2</li>
|
|
36
|
-
<li>Listepunkt 3</li>
|
|
37
|
-
</OrderedList>
|
|
38
|
-
</li>
|
|
39
|
-
</OrderedList>
|
|
40
|
-
</li>
|
|
41
|
-
<li>Listepunkt 4</li>
|
|
42
|
-
</OrderedList>
|
|
43
|
-
),
|
|
44
|
-
} as Meta<typeof OrderedList>;
|
|
45
|
-
|
|
46
|
-
export const Default: StoryObj = {};
|
|
47
|
-
|
|
48
|
-
export const Letters: StoryObj = {
|
|
49
|
-
args: {
|
|
50
|
-
type: "letters",
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const WithNumbersAndLetters: StoryFn = () => (
|
|
55
|
-
<OrderedList>
|
|
56
|
-
<li>Listepunkt 1</li>
|
|
57
|
-
<li>Listepunkt 2</li>
|
|
58
|
-
<li>
|
|
59
|
-
Listepunkt 3
|
|
60
|
-
<OrderedList data-type="letters">
|
|
61
|
-
<li>Listepunkt 1</li>
|
|
62
|
-
<li>Listepunkt 2</li>
|
|
63
|
-
<li>
|
|
64
|
-
Listepunkt 3
|
|
65
|
-
<OrderedList data-type="letters">
|
|
66
|
-
<li>Listepunkt 1</li>
|
|
67
|
-
<li>Listepunkt 2</li>
|
|
68
|
-
<li>
|
|
69
|
-
Listepunkt 3
|
|
70
|
-
<OrderedList>
|
|
71
|
-
<li>Listepunkt 1</li>
|
|
72
|
-
<li>Listepunkt 2</li>
|
|
73
|
-
<li>Listepunkt 3</li>
|
|
74
|
-
</OrderedList>
|
|
75
|
-
</li>
|
|
76
|
-
</OrderedList>
|
|
77
|
-
</li>
|
|
78
|
-
</OrderedList>
|
|
79
|
-
</li>
|
|
80
|
-
<li>Listepunkt 4</li>
|
|
81
|
-
</OrderedList>
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
export const StartingAtFive: StoryFn = () => (
|
|
85
|
-
<OrderedList start={5} data-type="letters">
|
|
86
|
-
<li>Listepunkt 1</li>
|
|
87
|
-
<li>Listepunkt 2</li>
|
|
88
|
-
<li>
|
|
89
|
-
Listepunkt 3
|
|
90
|
-
<OrderedList data-type="letters">
|
|
91
|
-
<li>Listepunkt 1</li>
|
|
92
|
-
<li>Listepunkt 2</li>
|
|
93
|
-
<li>
|
|
94
|
-
Listepunkt 3
|
|
95
|
-
<OrderedList data-type="letters">
|
|
96
|
-
<li>Listepunkt 1</li>
|
|
97
|
-
<li>Listepunkt 2</li>
|
|
98
|
-
<li>
|
|
99
|
-
Listepunkt 3
|
|
100
|
-
<OrderedList start={5}>
|
|
101
|
-
<li>Listepunkt 1</li>
|
|
102
|
-
<li>Listepunkt 2</li>
|
|
103
|
-
<li>Listepunkt 3</li>
|
|
104
|
-
</OrderedList>
|
|
105
|
-
</li>
|
|
106
|
-
</OrderedList>
|
|
107
|
-
</li>
|
|
108
|
-
</OrderedList>
|
|
109
|
-
</li>
|
|
110
|
-
<li>Listepunkt 4</li>
|
|
111
|
-
</OrderedList>
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
export const NoStyle: StoryFn = () => (
|
|
115
|
-
<ol>
|
|
116
|
-
<li>Listepunkt 1</li>
|
|
117
|
-
<li>Listepunkt 2</li>
|
|
118
|
-
<li>
|
|
119
|
-
Listepunkt 3
|
|
120
|
-
<ol>
|
|
121
|
-
<li>Listepunkt 1</li>
|
|
122
|
-
<li>Listepunkt 2</li>
|
|
123
|
-
<li>
|
|
124
|
-
Listepunkt 3
|
|
125
|
-
<ol>
|
|
126
|
-
<li>Listepunkt 1</li>
|
|
127
|
-
<li>Listepunkt 2</li>
|
|
128
|
-
<li>Listepunkt 3</li>
|
|
129
|
-
</ol>
|
|
130
|
-
</li>
|
|
131
|
-
</ol>
|
|
132
|
-
</li>
|
|
133
|
-
<li>Listepunkt 4</li>
|
|
134
|
-
</ol>
|
|
135
|
-
);
|
package/src/List/OrderedList.tsx
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-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 { CSSProperties, forwardRef, HTMLAttributes, useMemo } from "react";
|
|
10
|
-
import { css } from "@emotion/react";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { fonts, spacing } from "@ndla/core";
|
|
13
|
-
|
|
14
|
-
export const LetterCSS = css`
|
|
15
|
-
padding-left: ${spacing.medium};
|
|
16
|
-
> li {
|
|
17
|
-
counter-increment: level1;
|
|
18
|
-
|
|
19
|
-
:before {
|
|
20
|
-
content: counter(level1, upper-alpha) ".";
|
|
21
|
-
}
|
|
22
|
-
> ol[data-type="letters"] {
|
|
23
|
-
> li {
|
|
24
|
-
:before {
|
|
25
|
-
content: counter(level1, lower-alpha) ".";
|
|
26
|
-
}
|
|
27
|
-
> ol[data-type="letters"] {
|
|
28
|
-
padding-left: 0;
|
|
29
|
-
> li {
|
|
30
|
-
padding-left: ${spacing.normal};
|
|
31
|
-
:before {
|
|
32
|
-
left: ${spacing.small};
|
|
33
|
-
position: absolute;
|
|
34
|
-
content: counter(level1, lower-roman) ".";
|
|
35
|
-
transform: translateX(-100%);
|
|
36
|
-
}
|
|
37
|
-
> ol[data-type="letters"] {
|
|
38
|
-
padding-left: 0;
|
|
39
|
-
> li {
|
|
40
|
-
padding-left: ${spacing.normal};
|
|
41
|
-
:before {
|
|
42
|
-
left: ${spacing.small};
|
|
43
|
-
position: absolute;
|
|
44
|
-
content: counter(level1, lower-roman) ".";
|
|
45
|
-
transform: translateX(-100%);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
`;
|
|
55
|
-
|
|
56
|
-
export const NumberCSS = css`
|
|
57
|
-
padding-left: ${spacing.normal};
|
|
58
|
-
> li {
|
|
59
|
-
counter-increment: level1;
|
|
60
|
-
:before {
|
|
61
|
-
content: counter(level1, decimal) ".";
|
|
62
|
-
}
|
|
63
|
-
> ol:not([data-type="letters"]) {
|
|
64
|
-
counter-reset: level2;
|
|
65
|
-
&[data-count="true"] {
|
|
66
|
-
counter-reset: level2 var(--start, 0);
|
|
67
|
-
}
|
|
68
|
-
> li {
|
|
69
|
-
padding-left: ${spacing.nsmall};
|
|
70
|
-
counter-increment: level2;
|
|
71
|
-
:before {
|
|
72
|
-
content: counter(level1, decimal) "." counter(level2, decimal) ".";
|
|
73
|
-
}
|
|
74
|
-
> ol:not([data-type="letters"]) {
|
|
75
|
-
counter-reset: level3;
|
|
76
|
-
&[data-count="true"] {
|
|
77
|
-
counter-reset: level3 var(--start, 0);
|
|
78
|
-
}
|
|
79
|
-
> li {
|
|
80
|
-
padding-left: ${spacing.medium};
|
|
81
|
-
counter-increment: level3;
|
|
82
|
-
:before {
|
|
83
|
-
content: counter(level1, decimal) "." counter(level2, decimal) "." counter(level3, decimal) ".";
|
|
84
|
-
}
|
|
85
|
-
> ol:not([data-type="letters"]) {
|
|
86
|
-
counter-reset: level4;
|
|
87
|
-
&[data-count="true"] {
|
|
88
|
-
counter-reset: level4 var(--start, 0);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
> li {
|
|
92
|
-
padding-left: ${spacing.large};
|
|
93
|
-
counter-increment: level4;
|
|
94
|
-
:before {
|
|
95
|
-
content: counter(level1, decimal) "." counter(level2, decimal) "." counter(level3, decimal) "."
|
|
96
|
-
counter(level4, decimal) ".";
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`;
|
|
106
|
-
|
|
107
|
-
const StyledOl = styled.ol`
|
|
108
|
-
${fonts.sizes("18px", "29px")};
|
|
109
|
-
padding: 0;
|
|
110
|
-
list-style-type: none;
|
|
111
|
-
counter-reset: level1;
|
|
112
|
-
margin: ${spacing.normal} 0 ${spacing.normal} ${spacing.normal};
|
|
113
|
-
|
|
114
|
-
&[data-count="true"] {
|
|
115
|
-
counter-reset: level1 var(--start, 0);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
> li {
|
|
119
|
-
margin-top: ${spacing.nsmall};
|
|
120
|
-
padding-top: 0;
|
|
121
|
-
position: relative;
|
|
122
|
-
::before {
|
|
123
|
-
position: absolute;
|
|
124
|
-
left: -${spacing.normal};
|
|
125
|
-
}
|
|
126
|
-
> ol {
|
|
127
|
-
padding-bottom: 0;
|
|
128
|
-
margin-left: 0;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
&:not([data-type="letters"]) {
|
|
133
|
-
${NumberCSS}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
&[data-type="letters"] {
|
|
137
|
-
${LetterCSS}
|
|
138
|
-
}
|
|
139
|
-
`;
|
|
140
|
-
|
|
141
|
-
interface Props extends HTMLAttributes<HTMLOListElement> {
|
|
142
|
-
type?: "letters";
|
|
143
|
-
start?: number;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const OrderedList = forwardRef<HTMLOListElement, Props>(({ type, children, start, ...rest }, ref) => {
|
|
147
|
-
const style = useMemo(() => {
|
|
148
|
-
return { "--start": start ? start - 1 : undefined } as CSSProperties;
|
|
149
|
-
}, [start]);
|
|
150
|
-
|
|
151
|
-
return (
|
|
152
|
-
<StyledOl data-type={type} data-count={start != null} style={style} ref={ref} {...rest}>
|
|
153
|
-
{children}
|
|
154
|
-
</StyledOl>
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
export default OrderedList;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-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 { forwardRef, HTMLAttributes } from "react";
|
|
10
|
-
import styled from "@emotion/styled";
|
|
11
|
-
import { colors, fonts, spacing } from "@ndla/core";
|
|
12
|
-
|
|
13
|
-
const StyledUl = styled.ul`
|
|
14
|
-
padding-left: ${spacing.nsmall};
|
|
15
|
-
margin: ${spacing.normal} 0 ${spacing.normal} ${spacing.normal};
|
|
16
|
-
${fonts.size.text.content};
|
|
17
|
-
|
|
18
|
-
ul {
|
|
19
|
-
margin: 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
> li {
|
|
23
|
-
::marker {
|
|
24
|
-
color: ${colors.brand.secondary};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// List item
|
|
28
|
-
li {
|
|
29
|
-
padding-top: 0;
|
|
30
|
-
padding-left: ${spacing.nsmall};
|
|
31
|
-
margin-top: ${spacing.nsmall};
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
const UnOrderedList = forwardRef<HTMLUListElement, HTMLAttributes<HTMLUListElement>>(({ children, ...rest }, ref) => {
|
|
36
|
-
return (
|
|
37
|
-
<StyledUl ref={ref} {...rest}>
|
|
38
|
-
{children}
|
|
39
|
-
</StyledUl>
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
export default UnOrderedList;
|
|
@@ -1,72 +0,0 @@
|
|
|
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 { Meta, StoryFn } from "@storybook/react";
|
|
10
|
-
import UnOrderedList from "./UnOrderedList";
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: "Base styles/UnorderedList",
|
|
14
|
-
tags: ["autodocs"],
|
|
15
|
-
parameters: {
|
|
16
|
-
layout: "fullscreen",
|
|
17
|
-
},
|
|
18
|
-
component: UnOrderedList,
|
|
19
|
-
} as Meta<typeof UnOrderedList>;
|
|
20
|
-
|
|
21
|
-
export const Default: StoryFn = () => (
|
|
22
|
-
<UnOrderedList>
|
|
23
|
-
<li>Listepunkt 1</li>
|
|
24
|
-
<li>Listepunkt 2</li>
|
|
25
|
-
<li>
|
|
26
|
-
Listepunkt 3
|
|
27
|
-
<UnOrderedList>
|
|
28
|
-
<li>Listepunkt 1</li>
|
|
29
|
-
<li>Listepunkt 2</li>
|
|
30
|
-
<li>
|
|
31
|
-
Listepunkt 3
|
|
32
|
-
<UnOrderedList>
|
|
33
|
-
<li>Listepunkt 1</li>
|
|
34
|
-
<li>Listepunkt 2</li>
|
|
35
|
-
<li>
|
|
36
|
-
Listepunkt 3
|
|
37
|
-
<UnOrderedList>
|
|
38
|
-
<li>Listepunkt 1</li>
|
|
39
|
-
<li>Listepunkt 2</li>
|
|
40
|
-
<li>Listepunkt 3</li>
|
|
41
|
-
</UnOrderedList>
|
|
42
|
-
</li>
|
|
43
|
-
</UnOrderedList>
|
|
44
|
-
</li>
|
|
45
|
-
</UnOrderedList>
|
|
46
|
-
</li>
|
|
47
|
-
<li>Listepunkt 4</li>
|
|
48
|
-
</UnOrderedList>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
export const NoStyle: StoryFn = () => (
|
|
52
|
-
<ul>
|
|
53
|
-
<li>Listepunkt 1</li>
|
|
54
|
-
<li>Listepunkt 2</li>
|
|
55
|
-
<li>
|
|
56
|
-
Listepunkt 3
|
|
57
|
-
<ul>
|
|
58
|
-
<li>Listepunkt 1</li>
|
|
59
|
-
<li>Listepunkt 2</li>
|
|
60
|
-
<li>
|
|
61
|
-
Listepunkt 3
|
|
62
|
-
<ul>
|
|
63
|
-
<li>Listepunkt 1</li>
|
|
64
|
-
<li>Listepunkt 2</li>
|
|
65
|
-
<li>Listepunkt 3</li>
|
|
66
|
-
</ul>
|
|
67
|
-
</li>
|
|
68
|
-
</ul>
|
|
69
|
-
</li>
|
|
70
|
-
<li>Listepunkt 4</li>
|
|
71
|
-
</ul>
|
|
72
|
-
);
|
package/src/List/index.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export { default as OrderedList } from "./OrderedList";
|
|
10
|
-
export { default as UnOrderedList } from "./UnOrderedList";
|