@ndla/ui 52.0.0 → 53.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.
- package/es/Article/Article.js +110 -117
- package/es/Article/ArticleHeaderWrapper.js +14 -9
- package/es/all.css +1 -1
- package/es/index.js +0 -1
- package/es/locale/messages-en.js +3 -0
- package/es/locale/messages-nb.js +3 -0
- package/es/locale/messages-nn.js +3 -0
- package/es/locale/messages-se.js +3 -0
- package/es/locale/messages-sma.js +3 -0
- package/lib/Article/Article.d.ts +4 -5
- package/lib/Article/Article.js +108 -115
- package/lib/Article/ArticleHeaderWrapper.js +14 -9
- package/lib/Article/index.d.ts +1 -0
- package/lib/all.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -25
- package/lib/locale/messages-en.d.ts +3 -0
- package/lib/locale/messages-en.js +3 -0
- package/lib/locale/messages-nb.d.ts +3 -0
- package/lib/locale/messages-nb.js +3 -0
- package/lib/locale/messages-nn.d.ts +3 -0
- package/lib/locale/messages-nn.js +3 -0
- package/lib/locale/messages-se.d.ts +3 -0
- package/lib/locale/messages-se.js +3 -0
- package/lib/locale/messages-sma.d.ts +3 -0
- package/lib/locale/messages-sma.js +3 -0
- package/package.json +2 -3
- package/src/Article/Article.tsx +177 -113
- package/src/Article/ArticleHeaderWrapper.tsx +16 -9
- package/src/Article/index.ts +2 -0
- package/src/all.scss +2 -3
- package/src/index.ts +2 -2
- package/src/locale/messages-en.ts +3 -0
- package/src/locale/messages-nb.ts +3 -0
- package/src/locale/messages-nn.ts +3 -0
- package/src/locale/messages-se.ts +3 -0
- package/src/locale/messages-sma.ts +3 -0
- package/es/Article/ArticleNotions.js +0 -90
- package/es/Masthead/Masthead.js +0 -62
- package/es/Masthead/SkipToMainContent.js +0 -30
- package/es/Masthead/index.js +0 -13
- package/es/Masthead/utils.js +0 -38
- package/lib/Article/ArticleNotions.d.ts +0 -14
- package/lib/Article/ArticleNotions.js +0 -96
- package/lib/Masthead/Masthead.d.ts +0 -23
- package/lib/Masthead/Masthead.js +0 -68
- package/lib/Masthead/SkipToMainContent.d.ts +0 -12
- package/lib/Masthead/SkipToMainContent.js +0 -37
- package/lib/Masthead/index.d.ts +0 -12
- package/lib/Masthead/index.js +0 -36
- package/lib/Masthead/utils.d.ts +0 -11
- package/lib/Masthead/utils.js +0 -46
- package/src/Article/ArticleNotions.tsx +0 -139
- package/src/Article/component.article.scss +0 -149
- package/src/Masthead/Masthead.tsx +0 -100
- package/src/Masthead/SkipToMainContent.tsx +0 -54
- package/src/Masthead/index.ts +0 -16
- package/src/Masthead/utils.ts +0 -45
- package/src/main.scss +0 -4
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
** ARTICLE
|
|
3
|
-
** Clean-modifier is used to avoid negative margin (when used in design manual)
|
|
4
|
-
** Title has icon when article is a resource type
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
.c-article {
|
|
8
|
-
font-family: $font-serif;
|
|
9
|
-
background: $white;
|
|
10
|
-
margin-top: $spacing--large;
|
|
11
|
-
margin-right: auto;
|
|
12
|
-
margin-bottom: $spacing;
|
|
13
|
-
margin-left: auto;
|
|
14
|
-
overflow-wrap: break-word;
|
|
15
|
-
@include font-size(18px, 29px);
|
|
16
|
-
position: relative;
|
|
17
|
-
|
|
18
|
-
mjx-stretchy-v > mjx-ext > mjx-c {
|
|
19
|
-
transform: scaleY(100) translateY(0.075em);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
> section > p {
|
|
23
|
-
&:not([class]) {
|
|
24
|
-
margin-bottom: 29px;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@include mq(tablet) {
|
|
29
|
-
@include font-size(18px, 29px);
|
|
30
|
-
|
|
31
|
-
> section > p {
|
|
32
|
-
&:not([class]) {
|
|
33
|
-
margin-bottom: 35px;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
padding: 0 $spacing $spacing;
|
|
38
|
-
margin-bottom: $spacing--large;
|
|
39
|
-
margin-top: -$spacing * 6;
|
|
40
|
-
padding-top: $spacing--large + $spacing;
|
|
41
|
-
&--subject-material {
|
|
42
|
-
border: 2px solid $subject-material-light;
|
|
43
|
-
}
|
|
44
|
-
&--assessment-resources {
|
|
45
|
-
border: 2px solid $assessment-resource-background;
|
|
46
|
-
}
|
|
47
|
-
&--tasks-and-activities {
|
|
48
|
-
border: 2px solid $tasks-and-activities-background;
|
|
49
|
-
}
|
|
50
|
-
&--concept {
|
|
51
|
-
border: 2px solid $concept-light;
|
|
52
|
-
}
|
|
53
|
-
&--source-material {
|
|
54
|
-
border: 2px solid $source-material-light;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
@include mq(desktop) {
|
|
58
|
-
padding-bottom: $spacing--large;
|
|
59
|
-
margin-bottom: $spacing--large;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&:after {
|
|
63
|
-
content: "";
|
|
64
|
-
display: table;
|
|
65
|
-
clear: both;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
p {
|
|
69
|
-
margin-top: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&--multidisciplinary-topic {
|
|
73
|
-
margin-top: 0;
|
|
74
|
-
padding: $spacing--small;
|
|
75
|
-
@include mq(tablet) {
|
|
76
|
-
padding: 0;
|
|
77
|
-
}
|
|
78
|
-
border: none;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
.c-article--clean {
|
|
82
|
-
margin-top: $spacing;
|
|
83
|
-
padding: $spacing--small;
|
|
84
|
-
@include mq(tablet) {
|
|
85
|
-
padding: 0;
|
|
86
|
-
}
|
|
87
|
-
border: none;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.c-article--in-topic {
|
|
91
|
-
margin-top: 0;
|
|
92
|
-
padding: 0;
|
|
93
|
-
padding-left: $spacing--medium;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.c-article__header {
|
|
97
|
-
margin-bottom: $spacing;
|
|
98
|
-
@include mq(tablet) {
|
|
99
|
-
margin-bottom: $spacing--large;
|
|
100
|
-
}
|
|
101
|
-
@include mq(desktop) {
|
|
102
|
-
margin-bottom: $spacing--large;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.c-article__competence {
|
|
107
|
-
margin-top: $spacing;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.c-article__title {
|
|
111
|
-
position: relative;
|
|
112
|
-
|
|
113
|
-
h1 {
|
|
114
|
-
margin: 0;
|
|
115
|
-
@include mq($until: tablet) {
|
|
116
|
-
line-height: 2rem;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
padding: 0 0 $spacing 0;
|
|
121
|
-
|
|
122
|
-
@include mq(tablet) {
|
|
123
|
-
padding: 0 0 $spacing--medium 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
p {
|
|
127
|
-
@include font-size(18px, 24px);
|
|
128
|
-
color: $text-light-color;
|
|
129
|
-
text-transform: uppercase;
|
|
130
|
-
margin-bottom: 0;
|
|
131
|
-
font-family: $font;
|
|
132
|
-
@include mq($until: tablet) {
|
|
133
|
-
margin-bottom: 0;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.c-article__title--icon {
|
|
139
|
-
padding-left: 80px;
|
|
140
|
-
|
|
141
|
-
[data-badge] {
|
|
142
|
-
position: absolute;
|
|
143
|
-
left: 0;
|
|
144
|
-
|
|
145
|
-
@include mq(tablet) {
|
|
146
|
-
top: $spacing--xsmall;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { ReactNode } from "react";
|
|
10
|
-
import { css } from "@emotion/react";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { breakpoints, colors, fonts, mq, spacing, stackOrder } from "@ndla/core";
|
|
13
|
-
import SkipToMainContent from "./SkipToMainContent";
|
|
14
|
-
import { MessageBanner } from "../Messages";
|
|
15
|
-
|
|
16
|
-
const MastheadContent = styled.div`
|
|
17
|
-
justify-content: center;
|
|
18
|
-
align-items: center;
|
|
19
|
-
text-align: center;
|
|
20
|
-
padding: ${spacing.small} ${spacing.normal};
|
|
21
|
-
font-weight: ${fonts.weight.normal};
|
|
22
|
-
display: flex;
|
|
23
|
-
height: 84px;
|
|
24
|
-
justify-content: space-between;
|
|
25
|
-
gap: ${spacing.xsmall};
|
|
26
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
27
|
-
padding: ${spacing.small};
|
|
28
|
-
gap: ${spacing.xsmall};
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
interface StyledMastheadProps {
|
|
33
|
-
fixed: boolean;
|
|
34
|
-
ndlaFilm: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const StyledMasthead = styled.div<StyledMastheadProps>`
|
|
38
|
-
z-index: ${stackOrder.banner};
|
|
39
|
-
position: relative;
|
|
40
|
-
background: white;
|
|
41
|
-
border-bottom: 1px solid ${colors.brand.greyLighter};
|
|
42
|
-
min-height: 84px;
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-flow: column;
|
|
45
|
-
justify-content: flex-end;
|
|
46
|
-
${(p) =>
|
|
47
|
-
p.fixed &&
|
|
48
|
-
css`
|
|
49
|
-
top: 0;
|
|
50
|
-
position: sticky;
|
|
51
|
-
@media print {
|
|
52
|
-
position: relative;
|
|
53
|
-
}
|
|
54
|
-
`};
|
|
55
|
-
${(p) =>
|
|
56
|
-
p.ndlaFilm &&
|
|
57
|
-
css`
|
|
58
|
-
background: ${colors.ndlaFilm.filmColorLight};
|
|
59
|
-
background-image: linear-gradient(0deg, ${colors.ndlaFilm.filmColorLight}, ${colors.ndlaFilm.filmColor});
|
|
60
|
-
border: 0;
|
|
61
|
-
border-bottom: 1px solid #18334c;
|
|
62
|
-
`};
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
interface Alert {
|
|
66
|
-
content: string;
|
|
67
|
-
closable?: boolean;
|
|
68
|
-
number: number;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
interface Props {
|
|
72
|
-
children?: ReactNode;
|
|
73
|
-
fixed?: boolean;
|
|
74
|
-
ndlaFilm?: boolean;
|
|
75
|
-
skipToMainContentId?: string;
|
|
76
|
-
messages?: Alert[];
|
|
77
|
-
onCloseAlert?: (id: number) => void;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const Masthead = ({ children, fixed, ndlaFilm, skipToMainContentId, messages, onCloseAlert }: Props) => {
|
|
81
|
-
return (
|
|
82
|
-
<>
|
|
83
|
-
{skipToMainContentId && <SkipToMainContent skipToMainContentId={skipToMainContentId} />}
|
|
84
|
-
<StyledMasthead fixed={!!fixed} ndlaFilm={!!ndlaFilm} id="masthead">
|
|
85
|
-
{messages?.map((message) => (
|
|
86
|
-
<MessageBanner
|
|
87
|
-
key={message.number}
|
|
88
|
-
showCloseButton={message.closable}
|
|
89
|
-
onClose={() => onCloseAlert?.(message.number)}
|
|
90
|
-
>
|
|
91
|
-
{message.content}
|
|
92
|
-
</MessageBanner>
|
|
93
|
-
))}
|
|
94
|
-
<MastheadContent className="u-1/1">{children}</MastheadContent>
|
|
95
|
-
</StyledMasthead>
|
|
96
|
-
</>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default Masthead;
|
|
@@ -1,54 +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 { useTranslation } from "react-i18next";
|
|
10
|
-
import styled from "@emotion/styled";
|
|
11
|
-
import { colors, stackOrder } from "@ndla/core";
|
|
12
|
-
|
|
13
|
-
interface Props {
|
|
14
|
-
skipToMainContentId: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const StyledSkipToMainContent = styled.a`
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 10px;
|
|
20
|
-
left: 0;
|
|
21
|
-
right: 0;
|
|
22
|
-
margin: 0 auto;
|
|
23
|
-
color: ${colors.white};
|
|
24
|
-
background: ${colors.brand.primary};
|
|
25
|
-
left: auto;
|
|
26
|
-
top: auto;
|
|
27
|
-
width: 30%;
|
|
28
|
-
height: auto;
|
|
29
|
-
overflow: auto;
|
|
30
|
-
margin: 10px 35%;
|
|
31
|
-
padding: 5px;
|
|
32
|
-
border-radius: 15px;
|
|
33
|
-
border: 4px solid ${colors.brand.tertiary};
|
|
34
|
-
text-align: center;
|
|
35
|
-
font-size: 1.2em;
|
|
36
|
-
z-index: ${stackOrder.popover};
|
|
37
|
-
animation-name: fadeIn;
|
|
38
|
-
animation-duration: 0.3s;
|
|
39
|
-
transform: translateY(-150%);
|
|
40
|
-
&:focus {
|
|
41
|
-
transform: translateY(0);
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
const SkipToMainContent = ({ skipToMainContentId }: Props) => {
|
|
46
|
-
const { t } = useTranslation();
|
|
47
|
-
return (
|
|
48
|
-
<StyledSkipToMainContent tabIndex={0} href={`#${skipToMainContentId}`}>
|
|
49
|
-
{t("masthead.skipToContent")}
|
|
50
|
-
</StyledSkipToMainContent>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default SkipToMainContent;
|
package/src/Masthead/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2017-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 Masthead from "./Masthead";
|
|
10
|
-
|
|
11
|
-
import { default as SkipToMainContent } from "./SkipToMainContent";
|
|
12
|
-
import { getMastheadHeight, useMastheadHeight } from "./utils";
|
|
13
|
-
|
|
14
|
-
export { getMastheadHeight, useMastheadHeight, SkipToMainContent };
|
|
15
|
-
|
|
16
|
-
export default Masthead;
|
package/src/Masthead/utils.ts
DELETED
|
@@ -1,45 +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 { useEffect, useState } from "react";
|
|
10
|
-
import { resizeObserver } from "@ndla/util";
|
|
11
|
-
|
|
12
|
-
export const getMastheadHeight = (): number | undefined => {
|
|
13
|
-
if (typeof window !== "undefined") {
|
|
14
|
-
const masthead = document.getElementById("masthead");
|
|
15
|
-
return masthead?.getBoundingClientRect().height;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const useMastheadHeight = () => {
|
|
20
|
-
const [height, setHeight] = useState<number>();
|
|
21
|
-
const [mounted, setMounted] = useState(false);
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
setMounted(true);
|
|
25
|
-
}, []);
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (mounted) {
|
|
29
|
-
const masthead = document.getElementById("masthead");
|
|
30
|
-
|
|
31
|
-
const handleHeightChange = (el: HTMLElement) => {
|
|
32
|
-
const newHeight = el.getBoundingClientRect().height;
|
|
33
|
-
setHeight(newHeight);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
if (masthead) {
|
|
37
|
-
resizeObserver(masthead, handleHeightChange);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, [mounted]);
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
height,
|
|
44
|
-
};
|
|
45
|
-
};
|
package/src/main.scss
DELETED