@ndla/ui 50.9.14 → 50.9.19
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/Embed/ExternalEmbed.js +2 -2
- package/es/Gloss/Gloss.js +50 -42
- package/es/Gloss/GlossExample.js +7 -7
- package/es/locale/messages-en.js +3 -1
- package/es/locale/messages-nb.js +3 -1
- package/es/locale/messages-nn.js +3 -1
- package/es/locale/messages-se.js +3 -1
- package/es/locale/messages-sma.js +3 -1
- package/lib/Embed/ExternalEmbed.js +2 -2
- package/lib/Gloss/Gloss.js +49 -41
- package/lib/Gloss/GlossExample.d.ts +2 -2
- package/lib/Gloss/GlossExample.js +6 -6
- package/lib/locale/messages-en.d.ts +2 -0
- package/lib/locale/messages-en.js +3 -1
- package/lib/locale/messages-nb.d.ts +2 -0
- package/lib/locale/messages-nb.js +3 -1
- package/lib/locale/messages-nn.d.ts +2 -0
- package/lib/locale/messages-nn.js +3 -1
- package/lib/locale/messages-se.d.ts +2 -0
- package/lib/locale/messages-se.js +3 -1
- package/lib/locale/messages-sma.d.ts +2 -0
- package/lib/locale/messages-sma.js +3 -1
- package/package.json +4 -4
- package/src/Embed/ExternalEmbed.tsx +1 -1
- package/src/Gloss/Gloss.tsx +62 -27
- package/src/Gloss/GlossExample.tsx +23 -17
- package/src/locale/messages-en.ts +2 -0
- package/src/locale/messages-nb.ts +2 -0
- package/src/locale/messages-nn.ts +2 -0
- package/src/locale/messages-se.ts +2 -0
- package/src/locale/messages-sma.ts +2 -0
|
@@ -1098,7 +1098,9 @@ const messages = {
|
|
|
1098
1098
|
selectAdministrator: 'Gjør "{{user}}" til administrator.',
|
|
1099
1099
|
enableArena: 'Gi "{{user}}" tilgang til arena.',
|
|
1100
1100
|
noUsers: "Ingen brukarar funne.",
|
|
1101
|
-
search: "Søk etter brukarar"
|
|
1101
|
+
search: "Søk etter brukarar",
|
|
1102
|
+
becameAdmin: "Brukar '{{user}}' har fått administrator tilgong",
|
|
1103
|
+
becameNormalUser: "Brukar '{{user}}' har ikkje lenger administrator tilgong"
|
|
1102
1104
|
},
|
|
1103
1105
|
flags: {
|
|
1104
1106
|
title: "Flagg",
|
|
@@ -1098,7 +1098,9 @@ const messages = {
|
|
|
1098
1098
|
selectAdministrator: 'Gjør "{{user}}" til administrator.',
|
|
1099
1099
|
enableArena: 'Gi "{{user}}" tilgang til arena.',
|
|
1100
1100
|
noUsers: "Ingen brukere funnet.",
|
|
1101
|
-
search: "Søk etter brukere"
|
|
1101
|
+
search: "Søk etter brukere",
|
|
1102
|
+
becameAdmin: "Bruker '{{user}}' har fått administrator tilgang",
|
|
1103
|
+
becameNormalUser: "Bruker '{{user}}' har ikke lenger administrator tilgang"
|
|
1102
1104
|
},
|
|
1103
1105
|
flags: {
|
|
1104
1106
|
title: "Flagg",
|
|
@@ -1098,7 +1098,9 @@ const messages = {
|
|
|
1098
1098
|
selectAdministrator: 'Gjør "{{user}}" til administrator.',
|
|
1099
1099
|
enableArena: 'Gi "{{user}}" tilgang til arena.',
|
|
1100
1100
|
noUsers: "Ingen brukere funnet.",
|
|
1101
|
-
search: "Søk etter brukere"
|
|
1101
|
+
search: "Søk etter brukere",
|
|
1102
|
+
becameAdmin: "Bruker '{{user}}' har fått administrator tilgang",
|
|
1103
|
+
becameNormalUser: "Bruker '{{user}}' har ikke lenger administrator tilgang"
|
|
1102
1104
|
},
|
|
1103
1105
|
flags: {
|
|
1104
1106
|
title: "Flagg",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "50.9.
|
|
3
|
+
"version": "50.9.19",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"types"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/accordion": "^3.0.
|
|
34
|
+
"@ndla/accordion": "^3.0.30",
|
|
35
35
|
"@ndla/button": "^12.0.34",
|
|
36
36
|
"@ndla/carousel": "^4.0.32",
|
|
37
37
|
"@ndla/core": "^4.4.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@ndla/types-backend": "^0.2.21",
|
|
74
|
-
"@ndla/types-embed": "^4.0.
|
|
74
|
+
"@ndla/types-embed": "^4.0.19",
|
|
75
75
|
"css-loader": "^6.7.3",
|
|
76
76
|
"mini-css-extract-plugin": "^2.7.5",
|
|
77
77
|
"sass-loader": "^13.2.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "f4d17b7fb38aae4c322d973328d3c8c6145111f3"
|
|
85
85
|
}
|
|
@@ -47,7 +47,7 @@ const ExternalEmbed = ({ embed, isConcept }: Props) => {
|
|
|
47
47
|
if (embedData.type === "fullscreen") {
|
|
48
48
|
const image = {
|
|
49
49
|
src: data.iframeImage?.image.imageUrl ?? "",
|
|
50
|
-
alt: data.iframeImage?.alttext?.alttext ?? "",
|
|
50
|
+
alt: embedData.alt !== undefined ? embedData.alt : data.iframeImage?.alttext?.alttext ?? "",
|
|
51
51
|
};
|
|
52
52
|
return (
|
|
53
53
|
<Figure type="full">
|
package/src/Gloss/Gloss.tsx
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
import { useMemo } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
11
|
import styled from "@emotion/styled";
|
|
12
|
-
import {
|
|
12
|
+
import { Trigger } from "@radix-ui/react-accordion";
|
|
13
|
+
import { AccordionRoot, AccordionItem, AccordionContent } from "@ndla/accordion";
|
|
13
14
|
import { colors, spacing, misc, fonts } from "@ndla/core";
|
|
15
|
+
import { ChevronDown } from "@ndla/icons/common";
|
|
14
16
|
import { IGlossData, IGlossExample } from "@ndla/types-backend/concept-api";
|
|
15
17
|
import GlossExample from "./GlossExample";
|
|
16
18
|
import SpeechControl from "../AudioPlayer/SpeechControl";
|
|
@@ -29,22 +31,16 @@ export interface Props {
|
|
|
29
31
|
exampleLangs?: string;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
const
|
|
33
|
-
font-family: ${fonts.sans};
|
|
34
|
-
display: flex;
|
|
35
|
-
flex-direction: column;
|
|
34
|
+
const StyledAccordionItem = styled(AccordionItem)`
|
|
36
35
|
background-color: ${colors.background.lightBlue};
|
|
37
|
-
|
|
38
|
-
border: 1px solid ${colors.brand.lighter};
|
|
39
|
-
border-radius: ${misc.borderRadius};
|
|
40
|
-
margin-bottom: ${spacing.xsmall};
|
|
41
|
-
gap: ${spacing.nsmall};
|
|
36
|
+
border: 1px solid ${colors.brand.tertiary};
|
|
42
37
|
`;
|
|
43
38
|
|
|
44
39
|
const Wrapper = styled.div`
|
|
45
40
|
display: flex;
|
|
46
41
|
flex-wrap: wrap;
|
|
47
42
|
justify-content: space-between;
|
|
43
|
+
padding: ${spacing.nsmall} ${spacing.normal} 0 ${spacing.normal};
|
|
48
44
|
`;
|
|
49
45
|
|
|
50
46
|
const GlossContainer = styled.div`
|
|
@@ -53,7 +49,7 @@ const GlossContainer = styled.div`
|
|
|
53
49
|
flex-wrap: wrap;
|
|
54
50
|
gap: ${spacing.nsmall};
|
|
55
51
|
span {
|
|
56
|
-
${fonts.
|
|
52
|
+
${fonts.size.text.metaText.small};
|
|
57
53
|
}
|
|
58
54
|
span[data-pinyin] {
|
|
59
55
|
font-style: italic;
|
|
@@ -64,17 +60,49 @@ const GlossSpan = styled.span`
|
|
|
64
60
|
font-weight: ${fonts.weight.bold};
|
|
65
61
|
`;
|
|
66
62
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
const StyledWrapper = styled.div`
|
|
64
|
+
display: flex;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
align-items: center;
|
|
67
|
+
padding: 0 ${spacing.normal} ${spacing.nsmall} ${spacing.normal};
|
|
71
68
|
background-color: ${colors.background.lightBlue};
|
|
69
|
+
border-radius: ${misc.borderRadius};
|
|
72
70
|
`;
|
|
73
71
|
|
|
74
72
|
const StyledAccordionContent = styled(AccordionContent)`
|
|
75
73
|
padding: 0;
|
|
76
74
|
`;
|
|
77
75
|
|
|
76
|
+
const StyledTrigger = styled(Trigger)`
|
|
77
|
+
background-color: transparent;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
border: none;
|
|
80
|
+
padding: ${spacing.xsmall};
|
|
81
|
+
border-radius: ${misc.borderRadiusLarge};
|
|
82
|
+
color: ${colors.brand.primary};
|
|
83
|
+
&:hover,
|
|
84
|
+
&:focus-visible {
|
|
85
|
+
color: ${colors.white};
|
|
86
|
+
background-color: ${colors.brand.primary};
|
|
87
|
+
}
|
|
88
|
+
&[data-state="open"] {
|
|
89
|
+
background-color: ${colors.brand.lighter};
|
|
90
|
+
&:hover,
|
|
91
|
+
&:focus-visible {
|
|
92
|
+
background-color: ${colors.brand.primary};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
const StyledChevron = styled(ChevronDown)`
|
|
98
|
+
transition: all 200ms ease-in-out;
|
|
99
|
+
[data-styled-trigger][data-state="open"] > & {
|
|
100
|
+
transform: rotate(180deg);
|
|
101
|
+
}
|
|
102
|
+
min-width: ${spacing.normal};
|
|
103
|
+
min-height: ${spacing.normal};
|
|
104
|
+
`;
|
|
105
|
+
|
|
78
106
|
const getFilteredExamples = (
|
|
79
107
|
glossData: IGlossData | undefined,
|
|
80
108
|
exampleIds: string | undefined,
|
|
@@ -106,8 +134,8 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs }: Props) =>
|
|
|
106
134
|
return (
|
|
107
135
|
<>
|
|
108
136
|
{glossData && (
|
|
109
|
-
|
|
110
|
-
<
|
|
137
|
+
<AccordionRoot type="single" collapsible>
|
|
138
|
+
<StyledAccordionItem value="1">
|
|
111
139
|
<Wrapper>
|
|
112
140
|
<GlossContainer>
|
|
113
141
|
<GlossSpan lang={glossData.originalLanguage}>{glossData.gloss}</GlossSpan>
|
|
@@ -136,12 +164,14 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs }: Props) =>
|
|
|
136
164
|
</GlossContainer>
|
|
137
165
|
{audio?.src && <SpeechControl src={audio.src} title={audio.title}></SpeechControl>}
|
|
138
166
|
</Wrapper>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
167
|
+
{filteredExamples.length > 0 ? (
|
|
168
|
+
<>
|
|
169
|
+
<StyledWrapper>
|
|
170
|
+
<span lang={title.language}>{title.title}</span>
|
|
171
|
+
<StyledTrigger data-styled-trigger>
|
|
172
|
+
<StyledChevron />
|
|
173
|
+
</StyledTrigger>
|
|
174
|
+
</StyledWrapper>
|
|
145
175
|
<StyledAccordionContent>
|
|
146
176
|
{filteredExamples.map((examples, index) => (
|
|
147
177
|
<div key={`gloss-example-${index}`}>
|
|
@@ -151,15 +181,20 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs }: Props) =>
|
|
|
151
181
|
example={example}
|
|
152
182
|
originalLanguage={glossData.originalLanguage}
|
|
153
183
|
index={innerIndex}
|
|
184
|
+
lastExampleIndex={examples.length - 1}
|
|
154
185
|
/>
|
|
155
186
|
))}
|
|
156
187
|
</div>
|
|
157
188
|
))}
|
|
158
189
|
</StyledAccordionContent>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
190
|
+
</>
|
|
191
|
+
) : (
|
|
192
|
+
<StyledWrapper>
|
|
193
|
+
<span lang={title.language}>{title.title}</span>
|
|
194
|
+
</StyledWrapper>
|
|
195
|
+
)}
|
|
196
|
+
</StyledAccordionItem>
|
|
197
|
+
</AccordionRoot>
|
|
163
198
|
)}
|
|
164
199
|
</>
|
|
165
200
|
);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import styled from "@emotion/styled";
|
|
10
|
-
import { colors, spacing, fonts } from "@ndla/core";
|
|
10
|
+
import { colors, spacing, fonts, misc } from "@ndla/core";
|
|
11
11
|
import { IGlossExample } from "@ndla/types-backend/concept-api";
|
|
12
12
|
import { Text } from "@ndla/typography";
|
|
13
13
|
|
|
@@ -15,48 +15,54 @@ export interface Props {
|
|
|
15
15
|
example: IGlossExample;
|
|
16
16
|
originalLanguage: string | undefined;
|
|
17
17
|
index: number;
|
|
18
|
-
|
|
18
|
+
lastExampleIndex: number;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const StyledGlossExampleWrapper = styled.div`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
border-top: 1px solid ${colors.brand.lighter};
|
|
25
|
-
}
|
|
22
|
+
&:first-of-type {
|
|
23
|
+
border-top: 1px solid ${colors.brand.primary};
|
|
26
24
|
}
|
|
25
|
+
&:last-of-type {
|
|
26
|
+
border-radius: ${misc.borderRadius};
|
|
27
|
+
}
|
|
28
|
+
background-color: ${colors.background.default};
|
|
27
29
|
`;
|
|
28
|
-
const StyledGlossExample = styled.div`
|
|
29
|
-
padding: ${spacing.small} 0;
|
|
30
|
-
padding-left: ${spacing.normal};
|
|
31
|
-
border: 1px solid ${colors.brand.lighter};
|
|
32
|
-
border-top: none;
|
|
33
30
|
|
|
31
|
+
const StyledGlossExample = styled.div`
|
|
32
|
+
padding: ${spacing.small} ${spacing.normal};
|
|
33
|
+
border-bottom: 1px solid ${colors.brand.lighter};
|
|
34
|
+
background-color: ${colors.background.default};
|
|
34
35
|
&[data-is-first="true"] {
|
|
35
36
|
background-color: ${colors.background.lightBlue};
|
|
37
|
+
border-radius: 0px;
|
|
38
|
+
}
|
|
39
|
+
&[data-is-last="true"] {
|
|
40
|
+
border-radius: ${misc.borderRadius};
|
|
41
|
+
border-bottom: none;
|
|
36
42
|
}
|
|
37
43
|
`;
|
|
44
|
+
|
|
38
45
|
const StyledText = styled(Text)`
|
|
39
46
|
&[data-is-first="true"] {
|
|
40
47
|
font-weight: ${fonts.weight.bold};
|
|
41
|
-
color: ${colors.
|
|
48
|
+
color: ${colors.text.primary};
|
|
42
49
|
}
|
|
43
50
|
&[data-pinyin] {
|
|
44
51
|
font-style: italic;
|
|
45
52
|
}
|
|
46
53
|
`;
|
|
47
54
|
|
|
48
|
-
const GlossExample = ({ example, originalLanguage, index,
|
|
55
|
+
const GlossExample = ({ example, originalLanguage, index, lastExampleIndex }: Props) => {
|
|
49
56
|
return (
|
|
50
|
-
<StyledGlossExampleWrapper
|
|
51
|
-
<StyledGlossExample data-is-first={index === 0} lang={example.language}>
|
|
57
|
+
<StyledGlossExampleWrapper>
|
|
58
|
+
<StyledGlossExample data-is-first={index === 0} data-is-last={index === lastExampleIndex} lang={example.language}>
|
|
52
59
|
<StyledText data-is-first={index === 0} textStyle="meta-text-medium" margin="none">
|
|
53
60
|
{example.example}
|
|
54
61
|
</StyledText>
|
|
55
62
|
</StyledGlossExample>
|
|
56
|
-
|
|
57
63
|
{example.transcriptions.pinyin && (
|
|
58
64
|
<StyledGlossExample lang={originalLanguage}>
|
|
59
|
-
<StyledText data-pinyin
|
|
65
|
+
<StyledText data-pinyin textStyle="meta-text-medium" margin="none">
|
|
60
66
|
{example.transcriptions?.pinyin}
|
|
61
67
|
</StyledText>
|
|
62
68
|
</StyledGlossExample>
|
|
@@ -1110,6 +1110,8 @@ const messages = {
|
|
|
1110
1110
|
enableArena: "Give {{user}} access to the arena.",
|
|
1111
1111
|
noUsers: "No users found.",
|
|
1112
1112
|
search: "Search for users",
|
|
1113
|
+
becameAdmin: "User '{{user}}' was elevated to administrator",
|
|
1114
|
+
becameNormalUser: "User '{{user}}' no longer has administrator access",
|
|
1113
1115
|
},
|
|
1114
1116
|
flags: {
|
|
1115
1117
|
title: "Flag",
|
|
@@ -1110,6 +1110,8 @@ const messages = {
|
|
|
1110
1110
|
enableArena: 'Gi "{{user}}" tilgang til arena.',
|
|
1111
1111
|
noUsers: "Ingen brukere funnet.",
|
|
1112
1112
|
search: "Søk etter brukere",
|
|
1113
|
+
becameAdmin: "Bruker '{{user}}' har fått administrator tilgang",
|
|
1114
|
+
becameNormalUser: "Bruker '{{user}}' har ikke lenger administrator tilgang",
|
|
1113
1115
|
},
|
|
1114
1116
|
flags: {
|
|
1115
1117
|
title: "Flagg",
|
|
@@ -1110,6 +1110,8 @@ const messages = {
|
|
|
1110
1110
|
enableArena: 'Gi "{{user}}" tilgang til arena.',
|
|
1111
1111
|
noUsers: "Ingen brukarar funne.",
|
|
1112
1112
|
search: "Søk etter brukarar",
|
|
1113
|
+
becameAdmin: "Brukar '{{user}}' har fått administrator tilgong",
|
|
1114
|
+
becameNormalUser: "Brukar '{{user}}' har ikkje lenger administrator tilgong",
|
|
1113
1115
|
},
|
|
1114
1116
|
flags: {
|
|
1115
1117
|
title: "Flagg",
|
|
@@ -1112,6 +1112,8 @@ const messages = {
|
|
|
1112
1112
|
enableArena: 'Gi "{{user}}" tilgang til arena.',
|
|
1113
1113
|
noUsers: "Ingen brukere funnet.",
|
|
1114
1114
|
search: "Søk etter brukere",
|
|
1115
|
+
becameAdmin: "Bruker '{{user}}' har fått administrator tilgang",
|
|
1116
|
+
becameNormalUser: "Bruker '{{user}}' har ikke lenger administrator tilgang",
|
|
1115
1117
|
},
|
|
1116
1118
|
flags: {
|
|
1117
1119
|
title: "Flagg",
|
|
@@ -1114,6 +1114,8 @@ const messages = {
|
|
|
1114
1114
|
enableArena: 'Gi "{{user}}" tilgang til arena.',
|
|
1115
1115
|
noUsers: "Ingen brukere funnet.",
|
|
1116
1116
|
search: "Søk etter brukere",
|
|
1117
|
+
becameAdmin: "Bruker '{{user}}' har fått administrator tilgang",
|
|
1118
|
+
becameNormalUser: "Bruker '{{user}}' har ikke lenger administrator tilgang",
|
|
1117
1119
|
},
|
|
1118
1120
|
flags: {
|
|
1119
1121
|
title: "Flagg",
|