@ndla/ui 50.1.6 → 50.2.1
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/ConceptEmbed.js +28 -14
- package/es/Embed/FootnoteEmbed.js +7 -2
- package/es/Embed/conceptComponents.js +14 -10
- package/es/Filter/FilterCarousel.js +4 -4
- package/es/FrontpageArticle/FrontpageArticle.js +1 -1
- package/es/Gloss/Gloss.js +39 -34
- package/es/Gloss/GlossExample.js +62 -0
- package/es/Gloss/index.js +2 -1
- package/es/Resource/resourceComponents.js +11 -11
- package/es/ResourceGroup/ResourceItem.js +9 -9
- package/es/SearchTypeResult/ActiveFilters.js +6 -6
- package/es/TreeStructure/AddFolderButton.js +2 -2
- package/es/TreeStructure/FolderItem.js +7 -7
- package/es/TreeStructure/FolderItems.js +2 -2
- package/es/all.css +1 -1
- package/es/index.js +1 -1
- package/es/locale/messages-en.js +10 -5
- package/es/locale/messages-nb.js +10 -4
- package/es/locale/messages-nn.js +10 -4
- package/es/locale/messages-se.js +10 -4
- package/es/locale/messages-sma.js +13 -7
- package/es/model/index.js +1 -3
- package/lib/Embed/ConceptEmbed.d.ts +6 -2
- package/lib/Embed/ConceptEmbed.js +28 -14
- package/lib/Embed/FootnoteEmbed.js +8 -2
- package/lib/Embed/conceptComponents.d.ts +2 -0
- package/lib/Embed/conceptComponents.js +14 -10
- package/lib/Filter/FilterCarousel.js +4 -4
- package/lib/FrontpageArticle/FrontpageArticle.js +1 -1
- package/lib/Gloss/Gloss.d.ts +5 -14
- package/lib/Gloss/Gloss.js +39 -34
- package/lib/Gloss/GlossExample.d.ts +16 -0
- package/lib/Gloss/GlossExample.js +68 -0
- package/lib/Gloss/index.d.ts +1 -0
- package/lib/Gloss/index.js +7 -0
- package/lib/Resource/resourceComponents.js +11 -11
- package/lib/ResourceGroup/ResourceItem.js +9 -9
- package/lib/SearchTypeResult/ActiveFilters.js +6 -6
- package/lib/TreeStructure/AddFolderButton.js +2 -2
- package/lib/TreeStructure/FolderItem.js +7 -7
- package/lib/TreeStructure/FolderItems.js +2 -2
- package/lib/all.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -0
- package/lib/locale/messages-en.d.ts +8 -2
- package/lib/locale/messages-en.js +11 -7
- package/lib/locale/messages-nb.d.ts +7 -1
- package/lib/locale/messages-nb.js +10 -4
- package/lib/locale/messages-nn.d.ts +7 -1
- package/lib/locale/messages-nn.js +10 -4
- package/lib/locale/messages-se.d.ts +7 -1
- package/lib/locale/messages-se.js +10 -4
- package/lib/locale/messages-sma.d.ts +7 -1
- package/lib/locale/messages-sma.js +13 -7
- package/lib/model/index.d.ts +0 -2
- package/lib/model/index.js +1 -3
- package/package.json +5 -5
- package/src/Embed/ConceptEmbed.tsx +18 -0
- package/src/Embed/FootnoteEmbed.tsx +29 -3
- package/src/Embed/conceptComponents.tsx +6 -0
- package/src/Filter/FilterCarousel.tsx +3 -1
- package/src/FrontpageArticle/FrontpageArticle.tsx +1 -1
- package/src/Gloss/Gloss.tsx +41 -57
- package/src/Gloss/GlossExample.tsx +75 -0
- package/src/Gloss/index.tsx +1 -0
- package/src/Resource/resourceComponents.tsx +1 -1
- package/src/ResourceGroup/ResourceItem.tsx +3 -1
- package/src/SearchTypeResult/ActiveFilters.tsx +1 -3
- package/src/TreeStructure/AddFolderButton.tsx +2 -2
- package/src/TreeStructure/FolderItem.tsx +1 -1
- package/src/TreeStructure/FolderItems.tsx +2 -2
- package/src/index.ts +1 -1
- package/src/locale/messages-en.ts +9 -2
- package/src/locale/messages-nb.ts +9 -2
- package/src/locale/messages-nn.ts +9 -2
- package/src/locale/messages-se.ts +9 -2
- package/src/locale/messages-sma.ts +12 -5
- package/src/main.scss +0 -1
- package/src/model/index.ts +0 -2
- package/es/model/Transcriptions.js +0 -1
- package/lib/model/Transcriptions.d.ts +0 -11
- package/lib/model/Transcriptions.js +0 -5
- package/src/Article/component.footnotes.scss +0 -74
- package/src/model/Transcriptions.ts +0 -12
|
@@ -123,6 +123,8 @@ export const ConceptEmbed = ({ embed, fullWidth, heartButton: HeartButton, lang
|
|
|
123
123
|
conceptType={concept.conceptType}
|
|
124
124
|
glossData={concept.glossData}
|
|
125
125
|
lang={lang}
|
|
126
|
+
exampleIds={embed.embedData.exampleIds}
|
|
127
|
+
exampleLangs={embed.embedData.exampleLangs}
|
|
126
128
|
/>
|
|
127
129
|
);
|
|
128
130
|
} else if (embed.embedData.type === 'inline') {
|
|
@@ -140,6 +142,8 @@ export const ConceptEmbed = ({ embed, fullWidth, heartButton: HeartButton, lang
|
|
|
140
142
|
conceptType={concept.conceptType}
|
|
141
143
|
glossData={concept.glossData}
|
|
142
144
|
lang={lang}
|
|
145
|
+
exampleIds={embed.embedData.exampleIds}
|
|
146
|
+
exampleLangs={embed.embedData.exampleLangs}
|
|
143
147
|
/>
|
|
144
148
|
);
|
|
145
149
|
} else {
|
|
@@ -156,6 +160,8 @@ export const ConceptEmbed = ({ embed, fullWidth, heartButton: HeartButton, lang
|
|
|
156
160
|
conceptType={concept.conceptType}
|
|
157
161
|
glossData={concept.glossData}
|
|
158
162
|
lang={lang}
|
|
163
|
+
exampleIds={embed.embedData.exampleIds}
|
|
164
|
+
exampleLangs={embed.embedData.exampleLangs}
|
|
159
165
|
/>
|
|
160
166
|
);
|
|
161
167
|
}
|
|
@@ -166,6 +172,8 @@ interface InlineConceptProps extends ConceptNotionData {
|
|
|
166
172
|
heartButton?: HeartButtonType;
|
|
167
173
|
headerButtons?: ReactNode;
|
|
168
174
|
conceptHeartButton?: ReactNode;
|
|
175
|
+
exampleIds?: string;
|
|
176
|
+
exampleLangs?: string;
|
|
169
177
|
}
|
|
170
178
|
|
|
171
179
|
const BaselineIcon = styled.span`
|
|
@@ -239,6 +247,8 @@ export const InlineConcept = ({
|
|
|
239
247
|
conceptType,
|
|
240
248
|
headerButtons,
|
|
241
249
|
lang,
|
|
250
|
+
exampleIds,
|
|
251
|
+
exampleLangs,
|
|
242
252
|
}: InlineConceptProps) => {
|
|
243
253
|
const { t } = useTranslation();
|
|
244
254
|
const anchorRef = useRef<HTMLDivElement>(null);
|
|
@@ -290,6 +300,8 @@ export const InlineConcept = ({
|
|
|
290
300
|
}
|
|
291
301
|
conceptType={conceptType}
|
|
292
302
|
glossData={glossData}
|
|
303
|
+
exampleIds={exampleIds}
|
|
304
|
+
exampleLangs={exampleLangs}
|
|
293
305
|
/>
|
|
294
306
|
</Content>
|
|
295
307
|
</PopoverWrapper>
|
|
@@ -302,6 +314,8 @@ interface ConceptProps extends ConceptNotionData {
|
|
|
302
314
|
fullWidth?: boolean;
|
|
303
315
|
heartButton?: HeartButtonType;
|
|
304
316
|
conceptHeartButton?: ReactElement;
|
|
317
|
+
exampleIds?: string;
|
|
318
|
+
exampleLangs?: string;
|
|
305
319
|
}
|
|
306
320
|
|
|
307
321
|
export const BlockConcept = ({
|
|
@@ -317,6 +331,8 @@ export const BlockConcept = ({
|
|
|
317
331
|
glossData,
|
|
318
332
|
conceptType,
|
|
319
333
|
lang,
|
|
334
|
+
exampleIds,
|
|
335
|
+
exampleLangs,
|
|
320
336
|
}: ConceptProps) => {
|
|
321
337
|
const { t } = useTranslation();
|
|
322
338
|
const anchorRef = useRef<HTMLDivElement>(null);
|
|
@@ -418,6 +434,8 @@ export const BlockConcept = ({
|
|
|
418
434
|
? { src: visualElement.data.audioFile.url, title: visualElement.data.title.title }
|
|
419
435
|
: undefined
|
|
420
436
|
}
|
|
437
|
+
exampleIds={exampleIds}
|
|
438
|
+
exampleLangs={exampleLangs}
|
|
421
439
|
/>
|
|
422
440
|
)}
|
|
423
441
|
{copyright && conceptType === 'concept' && (
|
|
@@ -6,12 +6,38 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { FootnoteMetaData } from '@ndla/types-embed';
|
|
10
9
|
import { useTranslation } from 'react-i18next';
|
|
10
|
+
import styled from '@emotion/styled';
|
|
11
|
+
import { FootnoteMetaData } from '@ndla/types-embed';
|
|
12
|
+
import { colors, spacing } from '@ndla/core';
|
|
11
13
|
|
|
12
14
|
interface Props {
|
|
13
15
|
embed: FootnoteMetaData;
|
|
14
16
|
}
|
|
17
|
+
|
|
18
|
+
const FootnoteRef = styled.span`
|
|
19
|
+
&:target {
|
|
20
|
+
background-color: ${colors.brand.greyLighter};
|
|
21
|
+
padding: ${spacing.xxsmall} ${spacing.xsmall};
|
|
22
|
+
box-shadow:
|
|
23
|
+
${spacing.xsmall} 0 0 ${colors.brand.greyLighter},
|
|
24
|
+
-${spacing.xsmall} 0 0 ${colors.brand.greyLighter};
|
|
25
|
+
}
|
|
26
|
+
sup {
|
|
27
|
+
a {
|
|
28
|
+
margin-left: -2px;
|
|
29
|
+
padding: ${spacing.small} ${spacing.xsmall};
|
|
30
|
+
box-shadow: none;
|
|
31
|
+
text-decoration: underline;
|
|
32
|
+
}
|
|
33
|
+
a:hover,
|
|
34
|
+
a:focus-within {
|
|
35
|
+
background-color: ${colors.brand.greyLighter};
|
|
36
|
+
text-decoration: underline;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
15
41
|
const FootnoteEmbed = ({ embed }: Props) => {
|
|
16
42
|
const { t } = useTranslation();
|
|
17
43
|
if (embed.status === 'error') {
|
|
@@ -19,11 +45,11 @@ const FootnoteEmbed = ({ embed }: Props) => {
|
|
|
19
45
|
}
|
|
20
46
|
|
|
21
47
|
return (
|
|
22
|
-
<
|
|
48
|
+
<FootnoteRef id={`ref${embed.data.entryNum}`}>
|
|
23
49
|
<sup>
|
|
24
50
|
<a href={`#note${embed.data.entryNum}`} target="_self">{`[${embed.data.entryNum}]`}</a>
|
|
25
51
|
</sup>
|
|
26
|
-
</
|
|
52
|
+
</FootnoteRef>
|
|
27
53
|
);
|
|
28
54
|
};
|
|
29
55
|
|
|
@@ -48,6 +48,8 @@ interface ConceptNotionProps extends RefAttributes<HTMLDivElement>, ConceptNotio
|
|
|
48
48
|
headerButtons?: ReactNode;
|
|
49
49
|
heartButton?: HeartButtonType;
|
|
50
50
|
conceptHeartButton?: ReactNode;
|
|
51
|
+
exampleIds?: string;
|
|
52
|
+
exampleLangs?: string;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
const NotionDialogText = styled.div`
|
|
@@ -181,6 +183,8 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
181
183
|
glossData,
|
|
182
184
|
headerButtons,
|
|
183
185
|
lang,
|
|
186
|
+
exampleIds,
|
|
187
|
+
exampleLangs,
|
|
184
188
|
...rest
|
|
185
189
|
},
|
|
186
190
|
ref,
|
|
@@ -246,6 +250,8 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
246
250
|
? { src: visualElement.data.audioFile.url, title: visualElement.data.title.title }
|
|
247
251
|
: undefined
|
|
248
252
|
}
|
|
253
|
+
exampleIds={exampleIds}
|
|
254
|
+
exampleLangs={exampleLangs}
|
|
249
255
|
/>
|
|
250
256
|
)}
|
|
251
257
|
</ContentPadding>
|
|
@@ -40,7 +40,9 @@ const NavButton = styled('button')<{
|
|
|
40
40
|
border: none;
|
|
41
41
|
box-shadow: none;
|
|
42
42
|
border-radius: 100px;
|
|
43
|
-
transition:
|
|
43
|
+
transition:
|
|
44
|
+
opacity 0.5s ease,
|
|
45
|
+
transform 0.5s ease;
|
|
44
46
|
transform: translate(0px, 0px, 1);
|
|
45
47
|
position: absolute;
|
|
46
48
|
bottom: 0;
|
|
@@ -59,7 +59,7 @@ const StyledArticle = styled.article`
|
|
|
59
59
|
|
|
60
60
|
export const FrontpageArticle = ({ article, id, isWide, licenseBox, lang }: Props) => {
|
|
61
61
|
const { height = 0 } = useMastheadHeight();
|
|
62
|
-
const cssVars = useMemo(() => ({ '--masthead-height': `${height}px` } as unknown as CSSProperties
|
|
62
|
+
const cssVars = useMemo(() => ({ '--masthead-height': `${height}px` }) as unknown as CSSProperties, [height]);
|
|
63
63
|
const { title, introduction, content } = article;
|
|
64
64
|
|
|
65
65
|
if (isWide) {
|
package/src/Gloss/Gloss.tsx
CHANGED
|
@@ -10,31 +10,23 @@ import styled from '@emotion/styled';
|
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import { colors, spacing, misc, fonts } from '@ndla/core';
|
|
12
12
|
import { AccordionRoot, AccordionItem, AccordionHeader, AccordionContent } from '@ndla/accordion';
|
|
13
|
-
import {
|
|
13
|
+
import { IGlossData, IGlossExample } from '@ndla/types-backend/concept-api';
|
|
14
|
+
import { useMemo } from 'react';
|
|
14
15
|
import SpeechControl from '../AudioPlayer/SpeechControl';
|
|
15
|
-
|
|
16
|
-
interface Example {
|
|
17
|
-
example: string;
|
|
18
|
-
language: string;
|
|
19
|
-
transcriptions: Transcription;
|
|
20
|
-
}
|
|
16
|
+
import GlossExample from './GlossExample';
|
|
21
17
|
|
|
22
18
|
export interface Props {
|
|
23
19
|
title: {
|
|
24
20
|
title: string;
|
|
25
21
|
language: string;
|
|
26
22
|
};
|
|
27
|
-
glossData?:
|
|
28
|
-
gloss: string;
|
|
29
|
-
wordClass?: string;
|
|
30
|
-
originalLanguage: string;
|
|
31
|
-
transcriptions: Transcription;
|
|
32
|
-
examples?: Example[][];
|
|
33
|
-
};
|
|
23
|
+
glossData?: IGlossData;
|
|
34
24
|
audio?: {
|
|
35
25
|
title: string;
|
|
36
26
|
src?: string;
|
|
37
27
|
};
|
|
28
|
+
exampleIds?: string;
|
|
29
|
+
exampleLangs?: string;
|
|
38
30
|
}
|
|
39
31
|
|
|
40
32
|
const Container = styled.div`
|
|
@@ -83,26 +75,34 @@ const StyledAccordionContent = styled(AccordionContent)`
|
|
|
83
75
|
padding: 0;
|
|
84
76
|
`;
|
|
85
77
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
color: ${colors.brand.dark};
|
|
95
|
-
font-weight: ${fonts.weight.bold};
|
|
96
|
-
background-color: ${colors.background.lightBlue};
|
|
97
|
-
}
|
|
98
|
-
&[data-pinyin] {
|
|
99
|
-
font-style: italic;
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
78
|
+
const getFilteredExamples = (
|
|
79
|
+
glossData: IGlossData | undefined,
|
|
80
|
+
exampleIds: string | undefined,
|
|
81
|
+
exampleLangs: string | undefined,
|
|
82
|
+
): IGlossExample[][] => {
|
|
83
|
+
if (exampleIds !== undefined || exampleLangs !== undefined) {
|
|
84
|
+
const exampleIdsList = exampleIds?.toString()?.split(',') ?? [];
|
|
85
|
+
const exampleLangsList = exampleLangs?.split(',') ?? [];
|
|
102
86
|
|
|
103
|
-
const
|
|
87
|
+
const filteredExamples =
|
|
88
|
+
glossData?.examples?.map((examples, i) => {
|
|
89
|
+
if (exampleIdsList.includes(i.toString())) {
|
|
90
|
+
return examples.filter((e) => exampleLangsList.includes(e.language));
|
|
91
|
+
} else return [];
|
|
92
|
+
}) ?? [];
|
|
93
|
+
const examplesWithoutEmpty = filteredExamples.filter((el) => !!el.length);
|
|
94
|
+
return examplesWithoutEmpty;
|
|
95
|
+
} else return glossData?.examples ?? [];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs }: Props) => {
|
|
104
99
|
const { t } = useTranslation();
|
|
105
100
|
|
|
101
|
+
const filteredExamples = useMemo(
|
|
102
|
+
() => getFilteredExamples(glossData, exampleIds, exampleLangs),
|
|
103
|
+
[exampleIds, exampleLangs, glossData],
|
|
104
|
+
);
|
|
105
|
+
|
|
106
106
|
return (
|
|
107
107
|
<>
|
|
108
108
|
{glossData && (
|
|
@@ -138,36 +138,20 @@ const Gloss = ({ title, glossData, audio }: Props) => {
|
|
|
138
138
|
</Wrapper>
|
|
139
139
|
<span lang={title.language}>{title.title}</span>
|
|
140
140
|
</Container>
|
|
141
|
-
{
|
|
141
|
+
{filteredExamples.length > 0 && (
|
|
142
142
|
<AccordionRoot type="single" collapsible>
|
|
143
143
|
<AccordionItem value="1">
|
|
144
144
|
<StyledAccordionHeader headingLevel="span">{t('gloss.examples')}</StyledAccordionHeader>
|
|
145
145
|
<StyledAccordionContent>
|
|
146
|
-
{
|
|
147
|
-
<div key={index}>
|
|
148
|
-
{
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
key={t('gloss.transcriptions.pinyin')}
|
|
156
|
-
data-pinyin=""
|
|
157
|
-
lang={glossData.originalLanguage}
|
|
158
|
-
>
|
|
159
|
-
{translation.transcriptions?.pinyin}
|
|
160
|
-
</TranslatedText>
|
|
161
|
-
)}
|
|
162
|
-
{translation.transcriptions.traditional && (
|
|
163
|
-
<TranslatedText
|
|
164
|
-
key={t('gloss.transcriptions.traditional')}
|
|
165
|
-
lang={glossData.originalLanguage}
|
|
166
|
-
>
|
|
167
|
-
{translation.transcriptions?.traditional}
|
|
168
|
-
</TranslatedText>
|
|
169
|
-
)}
|
|
170
|
-
</div>
|
|
146
|
+
{filteredExamples.map((examples, index) => (
|
|
147
|
+
<div key={`gloss-example-${index}`}>
|
|
148
|
+
{examples.map((example, innerIndex) => (
|
|
149
|
+
<GlossExample
|
|
150
|
+
key={`gloss-example-${index}-${innerIndex}`}
|
|
151
|
+
example={example}
|
|
152
|
+
originalLanguage={glossData.originalLanguage}
|
|
153
|
+
index={innerIndex}
|
|
154
|
+
/>
|
|
171
155
|
))}
|
|
172
156
|
</div>
|
|
173
157
|
))}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 styled from '@emotion/styled';
|
|
10
|
+
import { colors, spacing, fonts } from '@ndla/core';
|
|
11
|
+
import { IGlossExample } from '@ndla/types-backend/concept-api';
|
|
12
|
+
import { Text } from '@ndla/typography';
|
|
13
|
+
|
|
14
|
+
export interface Props {
|
|
15
|
+
example: IGlossExample;
|
|
16
|
+
originalLanguage: string | undefined;
|
|
17
|
+
index: number;
|
|
18
|
+
isStandalone?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const StyledGlossExampleWrapper = styled.div`
|
|
22
|
+
&[data-is-standalone='true'] {
|
|
23
|
+
&:first-of-type {
|
|
24
|
+
border-top: 1px solid ${colors.brand.lighter};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
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
|
+
|
|
34
|
+
&[data-is-first='true'] {
|
|
35
|
+
background-color: ${colors.background.lightBlue};
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const StyledText = styled(Text)`
|
|
39
|
+
&[data-is-first='true'] {
|
|
40
|
+
font-weight: ${fonts.weight.bold};
|
|
41
|
+
color: ${colors.brand.dark};
|
|
42
|
+
}
|
|
43
|
+
&[data-pinyin] {
|
|
44
|
+
font-style: italic;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const GlossExample = ({ example, originalLanguage, index, isStandalone = false }: Props) => {
|
|
49
|
+
return (
|
|
50
|
+
<StyledGlossExampleWrapper data-is-standalone={isStandalone}>
|
|
51
|
+
<StyledGlossExample data-is-first={index === 0} lang={example.language}>
|
|
52
|
+
<StyledText data-is-first={index === 0} textStyle="meta-text-medium" margin="none">
|
|
53
|
+
{example.example}
|
|
54
|
+
</StyledText>
|
|
55
|
+
</StyledGlossExample>
|
|
56
|
+
|
|
57
|
+
{example.transcriptions.pinyin && (
|
|
58
|
+
<StyledGlossExample lang={originalLanguage}>
|
|
59
|
+
<StyledText data-pinyin="" textStyle="meta-text-medium" margin="none">
|
|
60
|
+
{example.transcriptions?.pinyin}
|
|
61
|
+
</StyledText>
|
|
62
|
+
</StyledGlossExample>
|
|
63
|
+
)}
|
|
64
|
+
{example.transcriptions.traditional && (
|
|
65
|
+
<StyledGlossExample lang={originalLanguage}>
|
|
66
|
+
<StyledText textStyle="meta-text-medium" margin="none">
|
|
67
|
+
{example.transcriptions?.traditional}
|
|
68
|
+
</StyledText>
|
|
69
|
+
</StyledGlossExample>
|
|
70
|
+
)}
|
|
71
|
+
</StyledGlossExampleWrapper>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default GlossExample;
|
package/src/Gloss/index.tsx
CHANGED
|
@@ -134,7 +134,7 @@ const StyledContentIconWrapper = styled.span`
|
|
|
134
134
|
|
|
135
135
|
export const ContentIconWrapper = ({ contentType, children, ...props }: ContentIconProps) => {
|
|
136
136
|
const contentIconWrapperVars = useMemo(
|
|
137
|
-
() => ({ '--content-background-color': resourceTypeColor(contentType) } as unknown as CSSProperties
|
|
137
|
+
() => ({ '--content-background-color': resourceTypeColor(contentType) }) as unknown as CSSProperties,
|
|
138
138
|
[contentType],
|
|
139
139
|
);
|
|
140
140
|
return (
|
|
@@ -156,9 +156,7 @@ const ActiveFilters = ({
|
|
|
156
156
|
</Tooltip>
|
|
157
157
|
</StyledActiveFilterWrapper>
|
|
158
158
|
)}
|
|
159
|
-
{customElements?.map((item, index) =>
|
|
160
|
-
<StyledActiveFilterWrapper key={index}>{item}</StyledActiveFilterWrapper>
|
|
161
|
-
))}
|
|
159
|
+
{customElements?.map((item, index) => <StyledActiveFilterWrapper key={index}>{item}</StyledActiveFilterWrapper>)}
|
|
162
160
|
</StyledActiveFilters>
|
|
163
161
|
);
|
|
164
162
|
};
|
|
@@ -46,8 +46,8 @@ const AddFolderButton = ({
|
|
|
46
46
|
const tooltip = loading
|
|
47
47
|
? t('loading')
|
|
48
48
|
: canAddFolder
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
? t('myNdla.newFolderUnder', { folderName: focusedFolder?.name })
|
|
50
|
+
: t('treeStructure.maxFoldersAlreadyAdded');
|
|
51
51
|
return (
|
|
52
52
|
<Tooltip tooltip={tooltip}>
|
|
53
53
|
<StyledAddFolderButton
|
|
@@ -163,7 +163,7 @@ const FolderItem = ({
|
|
|
163
163
|
const ref = useRef<HTMLButtonElement & HTMLAnchorElement>(null);
|
|
164
164
|
const selected = selectedFolder ? selectedFolder.id === id : false;
|
|
165
165
|
|
|
166
|
-
const levelVariable = useMemo(() => ({ '--level': level } as unknown as CSSProperties
|
|
166
|
+
const levelVariable = useMemo(() => ({ '--level': level }) as unknown as CSSProperties, [level]);
|
|
167
167
|
|
|
168
168
|
const focused = focusedFolder?.id === id;
|
|
169
169
|
|
|
@@ -65,8 +65,8 @@ const FolderItems = ({
|
|
|
65
65
|
level === 0 && type === 'picker'
|
|
66
66
|
? treestructureId(type, 'popup')
|
|
67
67
|
: parentFolder
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
? treestructureId(type, `subfolders-${parentFolder.id}`)
|
|
69
|
+
: undefined
|
|
70
70
|
}
|
|
71
71
|
tabIndex={-1}
|
|
72
72
|
aria-labelledby={level === 0 && type === 'picker' ? treestructureId(type, 'label') : undefined}
|
package/src/index.ts
CHANGED
|
@@ -224,6 +224,6 @@ export {
|
|
|
224
224
|
export { DefinitionTerm, DefinitionDescription } from './DefinitionList';
|
|
225
225
|
export type { ProgrammeV2 } from './ProgrammeCard';
|
|
226
226
|
|
|
227
|
-
export { Gloss } from './Gloss';
|
|
227
|
+
export { Gloss, GlossExample } from './Gloss';
|
|
228
228
|
|
|
229
229
|
export { LinkBlock, LinkBlockSection } from './LinkBlock';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { contributorTypes } from '@ndla/licenses';
|
|
10
10
|
import constants from '../model';
|
|
11
11
|
|
|
12
|
-
export const { contentTypes, subjectCategories, subjectTypes, wordClass
|
|
12
|
+
export const { contentTypes, subjectCategories, subjectTypes, wordClass } = constants;
|
|
13
13
|
|
|
14
14
|
const titleTemplate = ' - NDLA';
|
|
15
15
|
|
|
@@ -1139,7 +1139,9 @@ const messages = {
|
|
|
1139
1139
|
folder: {
|
|
1140
1140
|
folder: 'Folder',
|
|
1141
1141
|
delete: 'Delete folder',
|
|
1142
|
+
deleteShort: 'Delete',
|
|
1142
1143
|
edit: 'Edit folder',
|
|
1144
|
+
editShort: 'Edit',
|
|
1143
1145
|
copy: 'Copy folder',
|
|
1144
1146
|
open: 'Open folder',
|
|
1145
1147
|
close: 'Close folder',
|
|
@@ -1181,11 +1183,15 @@ const messages = {
|
|
|
1181
1183
|
},
|
|
1182
1184
|
button: {
|
|
1183
1185
|
share: 'Share folder',
|
|
1186
|
+
shareShort: 'Share',
|
|
1184
1187
|
preview: 'Preview folder',
|
|
1188
|
+
previewShort: 'Preview',
|
|
1185
1189
|
goTo: 'Go to shared folder',
|
|
1186
1190
|
unShare: 'Stop sharing',
|
|
1187
1191
|
shareLink: 'Copy link',
|
|
1188
1192
|
},
|
|
1193
|
+
previewInformation:
|
|
1194
|
+
'Preview of shared folder. The folder is not available to others until you update its status to shared.',
|
|
1189
1195
|
},
|
|
1190
1196
|
},
|
|
1191
1197
|
arena: {
|
|
@@ -1259,9 +1265,9 @@ const messages = {
|
|
|
1259
1265
|
'Welcome to NDLA Arena. Here you can discuss, share and cooperate with other teachers from all of Norway. You will find forums for the different subjects and themes.',
|
|
1260
1266
|
myNotification: 'My notifications',
|
|
1261
1267
|
markAll: 'Mark all as read',
|
|
1262
|
-
commentedOn: 'commented on your post',
|
|
1263
1268
|
subscribe: 'You will now be notified of new replies to this topic',
|
|
1264
1269
|
unsubscribe: 'You have turned off notification of new replies to this topic',
|
|
1270
|
+
commentedOn: 'commented on the post <i>{{title}}</i> which you follow',
|
|
1265
1271
|
},
|
|
1266
1272
|
topicsBy: 'Topics by',
|
|
1267
1273
|
},
|
|
@@ -1285,6 +1291,7 @@ const messages = {
|
|
|
1285
1291
|
myTags: 'My tags',
|
|
1286
1292
|
mySubjects: 'My subjects',
|
|
1287
1293
|
newFolder: 'New folder',
|
|
1294
|
+
newFolderShort: 'New',
|
|
1288
1295
|
newFolderUnder: 'Create new folder under {{folderName}}',
|
|
1289
1296
|
myAccount: 'My account',
|
|
1290
1297
|
favourites: 'Favourites',
|
|
@@ -1138,7 +1138,9 @@ const messages = {
|
|
|
1138
1138
|
folder: {
|
|
1139
1139
|
folder: 'Mappe',
|
|
1140
1140
|
delete: 'Slett mappe',
|
|
1141
|
+
deleteShort: 'Slett',
|
|
1141
1142
|
edit: 'Rediger mappe',
|
|
1143
|
+
editShort: 'Rediger',
|
|
1142
1144
|
copy: 'Kopier mappe',
|
|
1143
1145
|
open: 'Åpne mappe',
|
|
1144
1146
|
close: 'Lukk mappe',
|
|
@@ -1154,7 +1156,7 @@ const messages = {
|
|
|
1154
1156
|
onDragEndMissingOver: 'Mappen {{name}} ble sluppet',
|
|
1155
1157
|
onDragCancel: 'Flytting avbrutt. Mappen {{name}} ble sluppet',
|
|
1156
1158
|
dragHandle: 'Sorter mappen {{name}}',
|
|
1157
|
-
sharedWarning: 'Navn og beskrivelse blir synlig for alle du deler mappen med',
|
|
1159
|
+
sharedWarning: 'Navn og beskrivelse blir synlig for alle du deler mappen med.',
|
|
1158
1160
|
sharing: {
|
|
1159
1161
|
share: 'Del mappe',
|
|
1160
1162
|
shared: 'Delt',
|
|
@@ -1179,11 +1181,15 @@ const messages = {
|
|
|
1179
1181
|
},
|
|
1180
1182
|
button: {
|
|
1181
1183
|
share: 'Del mappe',
|
|
1184
|
+
shareShort: 'Del',
|
|
1182
1185
|
preview: 'Forhåndsvis mappe',
|
|
1186
|
+
previewShort: 'Forhåndsvis',
|
|
1183
1187
|
goTo: 'Gå til delt mappe',
|
|
1184
1188
|
unShare: 'Avslutt deling',
|
|
1185
1189
|
shareLink: 'Kopier lenke',
|
|
1186
1190
|
},
|
|
1191
|
+
previewInformation:
|
|
1192
|
+
'Forhåndsvisning av delt mappe. Mappa blir ikke tilgjengelig for andre før du setter den som delt.',
|
|
1187
1193
|
},
|
|
1188
1194
|
},
|
|
1189
1195
|
arena: {
|
|
@@ -1257,9 +1263,9 @@ const messages = {
|
|
|
1257
1263
|
'Velkommen til NDLA Arena. Her kan du diskutere, dele og samarbeide med andre lærere fra hele Norge. Du finner forum for ulike fag og tema.',
|
|
1258
1264
|
myNotification: 'Mine varsler',
|
|
1259
1265
|
markAll: 'Merk alle som lest',
|
|
1260
|
-
commentedOn: 'svarte på ditt innlegg',
|
|
1261
1266
|
subscribe: 'Du får nå varsling om nye svar på dette innlegget',
|
|
1262
1267
|
unsubscribe: 'Du har skrudd av varsling om nye svar på dette innlegget',
|
|
1268
|
+
commentedOn: 'svarte på innlegget <i>{{title}}</i> som du følger',
|
|
1263
1269
|
},
|
|
1264
1270
|
topicsBy: 'Innlegg av',
|
|
1265
1271
|
},
|
|
@@ -1282,6 +1288,7 @@ const messages = {
|
|
|
1282
1288
|
myTags: 'Mine emneknagger',
|
|
1283
1289
|
mySubjects: 'Mine fag',
|
|
1284
1290
|
newFolder: 'Ny mappe',
|
|
1291
|
+
newFolderShort: 'Ny',
|
|
1285
1292
|
newFolderUnder: 'Lag ny mappe under {{folderName}}',
|
|
1286
1293
|
myAccount: 'Min konto',
|
|
1287
1294
|
favourites: 'Favoritter',
|
|
@@ -1138,7 +1138,9 @@ const messages = {
|
|
|
1138
1138
|
folder: {
|
|
1139
1139
|
folder: 'Mappe',
|
|
1140
1140
|
delete: 'Slett mappe',
|
|
1141
|
+
deleteShort: 'Slett',
|
|
1141
1142
|
edit: 'Rediger mappe',
|
|
1143
|
+
editShort: 'Rediger',
|
|
1142
1144
|
copy: 'Kopier mappe',
|
|
1143
1145
|
open: 'Åpne mappe',
|
|
1144
1146
|
close: 'Lukk mappe',
|
|
@@ -1154,7 +1156,7 @@ const messages = {
|
|
|
1154
1156
|
onDragEndMissingOver: 'Mappa blei sleppt',
|
|
1155
1157
|
onDragCancel: 'Flytting avbrutt. Mappa {{name}} blei sleppt',
|
|
1156
1158
|
dragHandle: 'Sorter mappa {{name}}',
|
|
1157
|
-
sharedWarning: 'Namn og beskriving blir synleg for alle du deler mappa med',
|
|
1159
|
+
sharedWarning: 'Namn og beskriving blir synleg for alle du deler mappa med.',
|
|
1158
1160
|
sharing: {
|
|
1159
1161
|
share: 'Del mappe',
|
|
1160
1162
|
shared: 'Delt',
|
|
@@ -1179,11 +1181,15 @@ const messages = {
|
|
|
1179
1181
|
},
|
|
1180
1182
|
button: {
|
|
1181
1183
|
share: 'Del mappe',
|
|
1184
|
+
shareShort: 'Del',
|
|
1182
1185
|
preview: 'Førehandsvis mappe',
|
|
1186
|
+
previewShort: 'Førehandsvis',
|
|
1183
1187
|
goTo: 'Gå til delt mappe',
|
|
1184
1188
|
unShare: 'Avslutt deling',
|
|
1185
1189
|
shareLink: 'Kopier lenke',
|
|
1186
1190
|
},
|
|
1191
|
+
previewInformation:
|
|
1192
|
+
'Førehandsvising av delt mappe. Mappa blir ikkje tilgjengeleg for andre før du set ho som delt.',
|
|
1187
1193
|
},
|
|
1188
1194
|
},
|
|
1189
1195
|
arena: {
|
|
@@ -1257,9 +1263,9 @@ const messages = {
|
|
|
1257
1263
|
'Velkomen til NDLA Arena. Her kan du diskutere, dele og samarbeide med andre lærarar frå heile Noreg. Du finn forum for ulike fag og tema.',
|
|
1258
1264
|
myNotification: 'Mine varsler',
|
|
1259
1265
|
markAll: 'Merk alle som lest',
|
|
1260
|
-
commentedOn: 'svarte på ditt innlegg',
|
|
1261
1266
|
subscribe: 'Du får no varsling om nye svar på dette innlegget',
|
|
1262
1267
|
unsubscribe: 'Du har skrudd av varsling om nye svar på dette innlegget',
|
|
1268
|
+
commentedOn: 'svarte på innlegget <i>{{title}}</i> som du følger',
|
|
1263
1269
|
},
|
|
1264
1270
|
topicsBy: 'Innlegg av',
|
|
1265
1271
|
},
|
|
@@ -1282,6 +1288,7 @@ const messages = {
|
|
|
1282
1288
|
myTags: 'Mine emneknaggar',
|
|
1283
1289
|
mySubjects: 'Mine fag',
|
|
1284
1290
|
newFolder: 'Ny mappe',
|
|
1291
|
+
newFolderShort: 'Ny',
|
|
1285
1292
|
newFolderUnder: 'Lag ny mappe under {{folderName}}',
|
|
1286
1293
|
myAccount: 'Min konto',
|
|
1287
1294
|
favourites: 'Favorittar',
|