@ndla/ui 37.0.2 → 37.0.4
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/ArticleByline.js +7 -5
- package/es/AudioPlayer/SpeechControl.js +13 -13
- package/es/Embed/AudioEmbed.js +3 -2
- package/es/Embed/BrightcoveEmbed.js +5 -4
- package/es/Embed/ConceptEmbed.js +11 -10
- package/es/Embed/ImageEmbed.js +2 -1
- package/es/Embed/conceptComponents.js +9 -7
- package/es/List/OrderedList.js +2 -6
- package/es/List/UnOrderedList.js +1 -1
- package/es/NDLAFilm/FilmMovieSearch.js +10 -8
- package/es/Typography/Heading.js +17 -7
- package/es/index.js +2 -1
- 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/Article/ArticleByline.js +7 -5
- package/lib/AudioPlayer/SpeechControl.js +14 -14
- package/lib/Embed/AudioEmbed.js +3 -2
- package/lib/Embed/BrightcoveEmbed.js +5 -4
- package/lib/Embed/ConceptEmbed.js +11 -10
- package/lib/Embed/ImageEmbed.js +2 -1
- package/lib/Embed/conceptComponents.js +9 -7
- package/lib/List/OrderedList.js +1 -5
- package/lib/List/UnOrderedList.js +1 -1
- package/lib/NDLAFilm/FilmMovieSearch.js +10 -8
- package/lib/Typography/Heading.d.ts +4 -5
- package/lib/Typography/Heading.js +17 -8
- package/lib/index.d.ts +2 -0
- package/lib/index.js +7 -0
- 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 +3 -3
- package/src/Article/ArticleByline.tsx +2 -2
- package/src/AudioPlayer/SpeechControl.tsx +9 -26
- package/src/Embed/AudioEmbed.tsx +7 -2
- package/src/Embed/BrightcoveEmbed.tsx +2 -1
- package/src/Embed/ConceptEmbed.tsx +2 -1
- package/src/Embed/ImageEmbed.tsx +2 -1
- package/src/Embed/conceptComponents.tsx +2 -1
- package/src/List/OrderedList.tsx +15 -16
- package/src/List/UnOrderedList.tsx +9 -2
- package/src/NDLAFilm/FilmMovieSearch.tsx +24 -25
- package/src/Typography/Heading.tsx +8 -8
- package/src/index.ts +2 -0
- 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
|
@@ -715,6 +715,7 @@ declare const messages: {
|
|
|
715
715
|
onlyTeacher: string;
|
|
716
716
|
};
|
|
717
717
|
possiblyOutdated: string;
|
|
718
|
+
references: string;
|
|
718
719
|
};
|
|
719
720
|
competenceGoals: {
|
|
720
721
|
competenceGoal: string;
|
|
@@ -1228,6 +1229,7 @@ declare const messages: {
|
|
|
1228
1229
|
};
|
|
1229
1230
|
};
|
|
1230
1231
|
audio: {
|
|
1232
|
+
play: string;
|
|
1231
1233
|
download: string;
|
|
1232
1234
|
reuse: string;
|
|
1233
1235
|
error: {
|
|
@@ -443,7 +443,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
443
443
|
access: {
|
|
444
444
|
onlyTeacher: 'This resource is accessible only to teachers who are logged in with Feide.'
|
|
445
445
|
},
|
|
446
|
-
possiblyOutdated: 'The article is outdated'
|
|
446
|
+
possiblyOutdated: 'The article is outdated',
|
|
447
|
+
references: 'References'
|
|
447
448
|
},
|
|
448
449
|
competenceGoals: {
|
|
449
450
|
competenceGoal: 'competence-goal',
|
|
@@ -957,6 +958,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
957
958
|
}
|
|
958
959
|
},
|
|
959
960
|
audio: {
|
|
961
|
+
play: 'Play',
|
|
960
962
|
download: 'Download audio',
|
|
961
963
|
reuse: 'Use audio',
|
|
962
964
|
error: {
|
|
@@ -715,6 +715,7 @@ declare const messages: {
|
|
|
715
715
|
onlyTeacher: string;
|
|
716
716
|
};
|
|
717
717
|
possiblyOutdated: string;
|
|
718
|
+
references: string;
|
|
718
719
|
};
|
|
719
720
|
competenceGoals: {
|
|
720
721
|
competenceGoal: string;
|
|
@@ -1228,6 +1229,7 @@ declare const messages: {
|
|
|
1228
1229
|
};
|
|
1229
1230
|
};
|
|
1230
1231
|
audio: {
|
|
1232
|
+
play: string;
|
|
1231
1233
|
download: string;
|
|
1232
1234
|
reuse: string;
|
|
1233
1235
|
error: {
|
|
@@ -443,7 +443,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
443
443
|
access: {
|
|
444
444
|
onlyTeacher: 'Denne ressursen er bare tilgjengelig for lærere som er pålogget med Feide.'
|
|
445
445
|
},
|
|
446
|
-
possiblyOutdated: 'Artikkelen er foreldet.'
|
|
446
|
+
possiblyOutdated: 'Artikkelen er foreldet.',
|
|
447
|
+
references: 'Referanser'
|
|
447
448
|
},
|
|
448
449
|
competenceGoals: {
|
|
449
450
|
competenceGoal: 'kompetansemål',
|
|
@@ -957,6 +958,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
957
958
|
}
|
|
958
959
|
},
|
|
959
960
|
audio: {
|
|
961
|
+
play: 'Spill av',
|
|
960
962
|
download: 'Last ned lydfil',
|
|
961
963
|
reuse: 'Bruk lydfil',
|
|
962
964
|
error: {
|
|
@@ -715,6 +715,7 @@ declare const messages: {
|
|
|
715
715
|
onlyTeacher: string;
|
|
716
716
|
};
|
|
717
717
|
possiblyOutdated: string;
|
|
718
|
+
references: string;
|
|
718
719
|
};
|
|
719
720
|
competenceGoals: {
|
|
720
721
|
competenceGoal: string;
|
|
@@ -1228,6 +1229,7 @@ declare const messages: {
|
|
|
1228
1229
|
};
|
|
1229
1230
|
};
|
|
1230
1231
|
audio: {
|
|
1232
|
+
play: string;
|
|
1231
1233
|
download: string;
|
|
1232
1234
|
reuse: string;
|
|
1233
1235
|
error: {
|
|
@@ -443,7 +443,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
443
443
|
access: {
|
|
444
444
|
onlyTeacher: 'Denne ressursen er berre tilgjengeleg for lærarar som er pålogga med Feide.'
|
|
445
445
|
},
|
|
446
|
-
possiblyOutdated: 'Artikkelen er foreldet.'
|
|
446
|
+
possiblyOutdated: 'Artikkelen er foreldet.',
|
|
447
|
+
references: 'Referanser'
|
|
447
448
|
},
|
|
448
449
|
competenceGoals: {
|
|
449
450
|
competenceGoal: 'kompetansemål',
|
|
@@ -957,6 +958,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
957
958
|
}
|
|
958
959
|
},
|
|
959
960
|
audio: {
|
|
961
|
+
play: 'Spill av',
|
|
960
962
|
download: 'Last ned lydfil',
|
|
961
963
|
reuse: 'Bruk lydfil',
|
|
962
964
|
error: {
|
|
@@ -715,6 +715,7 @@ declare const messages: {
|
|
|
715
715
|
onlyTeacher: string;
|
|
716
716
|
};
|
|
717
717
|
possiblyOutdated: string;
|
|
718
|
+
references: string;
|
|
718
719
|
};
|
|
719
720
|
competenceGoals: {
|
|
720
721
|
competenceGoal: string;
|
|
@@ -1228,6 +1229,7 @@ declare const messages: {
|
|
|
1228
1229
|
};
|
|
1229
1230
|
};
|
|
1230
1231
|
audio: {
|
|
1232
|
+
play: string;
|
|
1231
1233
|
download: string;
|
|
1232
1234
|
reuse: string;
|
|
1233
1235
|
error: {
|
|
@@ -443,7 +443,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
443
443
|
access: {
|
|
444
444
|
onlyTeacher: 'Dát resursa lea dušše olamuttus oahpaheddjiide geat leat Feide bokte sisaloggejuvvon.'
|
|
445
445
|
},
|
|
446
|
-
possiblyOutdated: 'Artihkal lea boarásmuvvan.'
|
|
446
|
+
possiblyOutdated: 'Artihkal lea boarásmuvvan.',
|
|
447
|
+
references: 'Referanser'
|
|
447
448
|
},
|
|
448
449
|
competenceGoals: {
|
|
449
450
|
competenceGoal: 'Gealbomihttomearri',
|
|
@@ -957,6 +958,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
957
958
|
}
|
|
958
959
|
},
|
|
959
960
|
audio: {
|
|
961
|
+
play: 'Spill av',
|
|
960
962
|
download: 'Viečča jietnafiilla',
|
|
961
963
|
reuse: 'Geavat jietnafiilla',
|
|
962
964
|
error: {
|
|
@@ -715,6 +715,7 @@ declare const messages: {
|
|
|
715
715
|
onlyTeacher: string;
|
|
716
716
|
};
|
|
717
717
|
possiblyOutdated: string;
|
|
718
|
+
references: string;
|
|
718
719
|
};
|
|
719
720
|
competenceGoals: {
|
|
720
721
|
competenceGoal: string;
|
|
@@ -1228,6 +1229,7 @@ declare const messages: {
|
|
|
1228
1229
|
};
|
|
1229
1230
|
};
|
|
1230
1231
|
audio: {
|
|
1232
|
+
play: string;
|
|
1231
1233
|
download: string;
|
|
1232
1234
|
reuse: string;
|
|
1233
1235
|
error: {
|
|
@@ -443,7 +443,8 @@ var messages = _objectSpread(_objectSpread({
|
|
|
443
443
|
access: {
|
|
444
444
|
onlyTeacher: 'Daate vierhtie ajve dïllesisnie lohkehtæjjide mah tjaangeme Feidine.'
|
|
445
445
|
},
|
|
446
|
-
possiblyOutdated: 'Artikkelen er foreldet.'
|
|
446
|
+
possiblyOutdated: 'Artikkelen er foreldet.',
|
|
447
|
+
references: 'Referanser'
|
|
447
448
|
},
|
|
448
449
|
competenceGoals: {
|
|
449
450
|
competenceGoal: 'maahtoe-ulmie',
|
|
@@ -957,6 +958,7 @@ var messages = _objectSpread(_objectSpread({
|
|
|
957
958
|
}
|
|
958
959
|
},
|
|
959
960
|
audio: {
|
|
961
|
+
play: 'Spill av',
|
|
960
962
|
download: 'Veedtjh tjoeje-fijlem',
|
|
961
963
|
reuse: 'Nuhtjh tjoeje-fijlem',
|
|
962
964
|
error: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "37.0.
|
|
3
|
+
"version": "37.0.4",
|
|
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": "^2.2.
|
|
34
|
+
"@ndla/accordion": "^2.2.1",
|
|
35
35
|
"@ndla/article-scripts": "^3.0.17",
|
|
36
36
|
"@ndla/button": "^10.1.0",
|
|
37
37
|
"@ndla/carousel": "^3.1.0",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "db2b4d8eda31595ec90f1e2fc26972382214cad9"
|
|
90
90
|
}
|
|
@@ -149,14 +149,14 @@ const ArticleByline = ({
|
|
|
149
149
|
<AccordionRoot type="multiple" onValueChange={setOpenAccordions} value={openAccordions}>
|
|
150
150
|
{licenseBox && (
|
|
151
151
|
<AccordionItem value="rulesForUse">
|
|
152
|
-
<AccordionHeader>{t('article.useContent')}</AccordionHeader>
|
|
152
|
+
<AccordionHeader headingLevel="h2">{t('article.useContent')}</AccordionHeader>
|
|
153
153
|
<AccordionContent>{licenseBox}</AccordionContent>
|
|
154
154
|
</AccordionItem>
|
|
155
155
|
)}
|
|
156
156
|
|
|
157
157
|
{!!footnotes?.length && (
|
|
158
158
|
<AccordionItem value={referencesAccordionId}>
|
|
159
|
-
<AccordionHeader>
|
|
159
|
+
<AccordionHeader headingLevel="h2">{t('article.references')}</AccordionHeader>
|
|
160
160
|
<AccordionContent forceMount>
|
|
161
161
|
<ArticleFootNotes footNotes={footnotes} />
|
|
162
162
|
</AccordionContent>
|
|
@@ -7,30 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React, { useRef } from 'react';
|
|
10
|
-
import
|
|
11
|
-
import { colors } from '@ndla/core';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
12
11
|
import { VolumeUp } from '@ndla/icons/common';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
background: none;
|
|
16
|
-
border: none;
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
padding: 0;
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
color: ${colors.brand.primary};
|
|
22
|
-
margin-right: 0;
|
|
23
|
-
|
|
24
|
-
&:hover,
|
|
25
|
-
&:active,
|
|
26
|
-
&:focus {
|
|
27
|
-
color: ${colors.brand.secondary};
|
|
28
|
-
}
|
|
29
|
-
.c-icon {
|
|
30
|
-
width: 24px;
|
|
31
|
-
height: 24px;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
12
|
+
import Tooltip from '@ndla/tooltip';
|
|
13
|
+
import { IconButtonV2 } from '@ndla/button';
|
|
34
14
|
|
|
35
15
|
type Props = {
|
|
36
16
|
src: string;
|
|
@@ -38,6 +18,7 @@ type Props = {
|
|
|
38
18
|
};
|
|
39
19
|
|
|
40
20
|
const SpeechControl = ({ src, title }: Props) => {
|
|
21
|
+
const { t } = useTranslation();
|
|
41
22
|
const audioRef = useRef<HTMLAudioElement>(null);
|
|
42
23
|
|
|
43
24
|
const togglePlay = () => {
|
|
@@ -54,9 +35,11 @@ const SpeechControl = ({ src, title }: Props) => {
|
|
|
54
35
|
<div>
|
|
55
36
|
{/* eslint-disable-next-line jsx-a11y/media-has-caption */}
|
|
56
37
|
<audio ref={audioRef} src={src} title={title} preload="metadata" />
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
|
|
38
|
+
<Tooltip tooltip={t('audio.play')}>
|
|
39
|
+
<IconButtonV2 type="button" onClick={togglePlay} aria-label={t('audio.play')} variant="ghost">
|
|
40
|
+
<VolumeUp />
|
|
41
|
+
</IconButtonV2>
|
|
42
|
+
</Tooltip>
|
|
60
43
|
</div>
|
|
61
44
|
);
|
|
62
45
|
};
|
package/src/Embed/AudioEmbed.tsx
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { AudioMetaData, ImageMetaData } from '@ndla/types-embed';
|
|
10
|
+
import { COPYRIGHTED } from '@ndla/licenses';
|
|
10
11
|
//@ts-ignore
|
|
11
12
|
import { Remarkable } from 'remarkable';
|
|
12
13
|
import AudioPlayer from '../AudioPlayer';
|
|
@@ -87,7 +88,9 @@ const AudioEmbed = ({ embed, heartButton: HeartButton }: Props) => {
|
|
|
87
88
|
bottomRounded={!data.imageMeta}
|
|
88
89
|
copyright={embed.data.copyright}
|
|
89
90
|
>
|
|
90
|
-
{HeartButton &&
|
|
91
|
+
{HeartButton && embed.data.copyright.license.license.toLowerCase() !== COPYRIGHTED && (
|
|
92
|
+
<HeartButton embed={embed} />
|
|
93
|
+
)}
|
|
91
94
|
</EmbedByline>
|
|
92
95
|
{data.imageMeta && (
|
|
93
96
|
<EmbedByline
|
|
@@ -98,7 +101,9 @@ const AudioEmbed = ({ embed, heartButton: HeartButton }: Props) => {
|
|
|
98
101
|
bottomRounded
|
|
99
102
|
copyright={data.imageMeta.copyright}
|
|
100
103
|
>
|
|
101
|
-
{HeartButton &&
|
|
104
|
+
{HeartButton && data.imageMeta.copyright.license.license.toLowerCase() !== COPYRIGHTED && (
|
|
105
|
+
<HeartButton embed={imageMetaToMockEmbed(embed)} />
|
|
106
|
+
)}
|
|
102
107
|
</EmbedByline>
|
|
103
108
|
)}
|
|
104
109
|
</Figure>
|
|
@@ -10,6 +10,7 @@ import sortBy from 'lodash/sortBy';
|
|
|
10
10
|
import isNumber from 'lodash/isNumber';
|
|
11
11
|
import styled from '@emotion/styled';
|
|
12
12
|
import { spacing } from '@ndla/core';
|
|
13
|
+
import { COPYRIGHTED } from '@ndla/licenses';
|
|
13
14
|
import { useEffect, useRef, useState } from 'react';
|
|
14
15
|
import { BrightcoveEmbedData, BrightcoveMetaData, BrightcoveVideoSource } from '@ndla/types-embed';
|
|
15
16
|
import { useTranslation } from 'react-i18next';
|
|
@@ -125,7 +126,7 @@ const BrightcoveEmbed = ({ embed, isConcept, heartButton: HeartButton }: Props)
|
|
|
125
126
|
{t(`figure.button.${!showOriginalVideo ? 'original' : 'alternative'}`)}
|
|
126
127
|
</LinkedVideoButton>
|
|
127
128
|
)}
|
|
128
|
-
{HeartButton && <HeartButton embed={embed} />}
|
|
129
|
+
{HeartButton && data.copyright?.license.license.toLowerCase() !== COPYRIGHTED && <HeartButton embed={embed} />}
|
|
129
130
|
</EmbedByline>
|
|
130
131
|
</Figure>
|
|
131
132
|
);
|
|
@@ -16,6 +16,7 @@ import { Cross } from '@ndla/icons/action';
|
|
|
16
16
|
import { breakpoints, colors, mq, spacing } from '@ndla/core';
|
|
17
17
|
import { ConceptMetaData } from '@ndla/types-embed';
|
|
18
18
|
import Tooltip from '@ndla/tooltip';
|
|
19
|
+
import { COPYRIGHTED } from '@ndla/licenses';
|
|
19
20
|
import { Notion as UINotion } from '../Notion';
|
|
20
21
|
import { Figure } from '../Figure';
|
|
21
22
|
import { NotionImage } from '../Notion/NotionImage';
|
|
@@ -382,7 +383,7 @@ export const BlockConcept = ({
|
|
|
382
383
|
/>
|
|
383
384
|
{copyright ? (
|
|
384
385
|
<EmbedByline copyright={copyright} bottomRounded topRounded type="concept">
|
|
385
|
-
{conceptHeartButton}
|
|
386
|
+
{copyright.license?.license.toLowerCase() !== COPYRIGHTED && conceptHeartButton}
|
|
386
387
|
</EmbedByline>
|
|
387
388
|
) : (
|
|
388
389
|
<BottomBorder />
|
package/src/Embed/ImageEmbed.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { ImageEmbedData, ImageMetaData } from '@ndla/types-embed';
|
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
12
|
import { MouseEventHandler, useState } from 'react';
|
|
13
13
|
import { ExpandTwoArrows } from '@ndla/icons/action';
|
|
14
|
+
import { COPYRIGHTED } from '@ndla/licenses';
|
|
14
15
|
import { ArrowCollapse, ChevronDown, ChevronUp } from '@ndla/icons/common';
|
|
15
16
|
import { Figure, FigureType } from '../Figure';
|
|
16
17
|
import Image, { ImageLink } from '../Image';
|
|
@@ -152,7 +153,7 @@ const ImageEmbed = ({ embed, previewAlt, heartButton: HeartButton }: Props) => {
|
|
|
152
153
|
bottomRounded
|
|
153
154
|
visibleAlt={previewAlt ? embed.embedData.alt : ''}
|
|
154
155
|
>
|
|
155
|
-
{HeartButton && <HeartButton embed={embed} />}
|
|
156
|
+
{HeartButton && data.copyright.license.license.toLowerCase() !== COPYRIGHTED && <HeartButton embed={embed} />}
|
|
156
157
|
</EmbedByline>
|
|
157
158
|
)}
|
|
158
159
|
</Figure>
|
|
@@ -14,6 +14,7 @@ import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
|
14
14
|
import { parseMarkdown } from '@ndla/util';
|
|
15
15
|
import styled from '@emotion/styled';
|
|
16
16
|
import { NotionDialogContent, NotionDialogText } from '@ndla/notion';
|
|
17
|
+
import { COPYRIGHTED } from '@ndla/licenses';
|
|
17
18
|
import { Copyright } from '../types';
|
|
18
19
|
import ImageEmbed from './ImageEmbed';
|
|
19
20
|
import BrightcoveEmbed from './BrightcoveEmbed';
|
|
@@ -202,7 +203,7 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
202
203
|
</ContentPadding>
|
|
203
204
|
{copyright && (
|
|
204
205
|
<EmbedByline copyright={copyright} type="concept">
|
|
205
|
-
{conceptHeartButton}
|
|
206
|
+
{copyright.license?.license.toLowerCase() !== COPYRIGHTED && conceptHeartButton}
|
|
206
207
|
</EmbedByline>
|
|
207
208
|
)}
|
|
208
209
|
</div>
|
package/src/List/OrderedList.tsx
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
|
-
import { fonts, spacing
|
|
10
|
+
import { fonts, spacing } from '@ndla/core';
|
|
11
11
|
import { forwardRef, HTMLAttributes } from 'react';
|
|
12
12
|
|
|
13
13
|
export const generateListResets = () => {
|
|
@@ -21,24 +21,25 @@ export const generateListResets = () => {
|
|
|
21
21
|
return styles;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const listSpacing = {
|
|
25
|
-
xlarge: `${spacingUnit * 2.5}px`,
|
|
26
|
-
xxlarge: `${spacingUnit * 3}px`,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
24
|
const StyledOl = styled.ol`
|
|
30
25
|
margin-top: 0;
|
|
31
|
-
margin-left:
|
|
26
|
+
margin-left: ${spacing.medium};
|
|
32
27
|
${fonts.sizes('18px', '29px')};
|
|
33
28
|
list-style-type: none;
|
|
29
|
+
padding-left: ${spacing.medium} !important;
|
|
34
30
|
|
|
35
31
|
// Child ordered lists
|
|
36
32
|
ol {
|
|
37
|
-
padding-left: ${spacing.
|
|
33
|
+
padding-left: ${spacing.medium};
|
|
34
|
+
margin-left: 0;
|
|
38
35
|
}
|
|
39
36
|
// List item
|
|
40
37
|
li {
|
|
41
38
|
margin-top: ${spacing.normal};
|
|
39
|
+
|
|
40
|
+
p {
|
|
41
|
+
margin-bottom: ${spacing.normal} !important;
|
|
42
|
+
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
&[data-type='letters'] {
|
|
@@ -49,7 +50,7 @@ const StyledOl = styled.ol`
|
|
|
49
50
|
position: absolute;
|
|
50
51
|
transform: translateX(-100%);
|
|
51
52
|
content: counter(item, upper-alpha) '.';
|
|
52
|
-
padding-right:
|
|
53
|
+
padding-right: ${spacing.nsmall};
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
> ol[data-type='letters'] {
|
|
@@ -57,7 +58,6 @@ const StyledOl = styled.ol`
|
|
|
57
58
|
content: counter(item, lower-alpha) '.';
|
|
58
59
|
}
|
|
59
60
|
ol[data-type='letters'] {
|
|
60
|
-
padding-left: ${spacing.normal};
|
|
61
61
|
> li:before {
|
|
62
62
|
content: counter(item, lower-roman) '.';
|
|
63
63
|
}
|
|
@@ -73,20 +73,19 @@ const StyledOl = styled.ol`
|
|
|
73
73
|
&:before {
|
|
74
74
|
position: absolute;
|
|
75
75
|
transform: translateX(-100%);
|
|
76
|
-
padding-right: 0.25em;
|
|
77
76
|
content: counters(item, '.') '.';
|
|
77
|
+
padding-right: ${spacing.nsmall};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
> ol:not([data-type='letters']) {
|
|
81
|
-
padding-left: ${spacing.medium};
|
|
82
81
|
> li {
|
|
82
|
+
padding-left: ${spacing.nsmall};
|
|
83
83
|
> ol:not([data-type='letters']) {
|
|
84
|
-
padding-left: ${spacing.large};
|
|
85
84
|
> li {
|
|
85
|
+
padding-left: ${spacing.medium};
|
|
86
86
|
> ol:not([data-type='letters']) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
padding-left: ${listSpacing.xxlarge};
|
|
87
|
+
> li {
|
|
88
|
+
padding-left: ${spacing.large};
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
}
|
|
@@ -12,6 +12,8 @@ import { forwardRef, HTMLAttributes } from 'react';
|
|
|
12
12
|
import { generateListResets } from './OrderedList';
|
|
13
13
|
|
|
14
14
|
const StyledUl = styled.ul`
|
|
15
|
+
padding-left: ${spacing.small} !important;
|
|
16
|
+
margin-left: ${spacing.medium} !important;
|
|
15
17
|
> li {
|
|
16
18
|
::marker {
|
|
17
19
|
color: ${colors.brand.secondary};
|
|
@@ -19,15 +21,20 @@ const StyledUl = styled.ul`
|
|
|
19
21
|
}
|
|
20
22
|
ul {
|
|
21
23
|
list-style-image: none;
|
|
22
|
-
padding-left: ${spacing.
|
|
24
|
+
padding-left: ${spacing.small};
|
|
25
|
+
|
|
26
|
+
margin-left: 0 !important;
|
|
23
27
|
}
|
|
24
28
|
margin-top: 0;
|
|
25
|
-
margin-left: 0;
|
|
26
29
|
${fonts.sizes('18px', '29px')};
|
|
27
30
|
|
|
28
31
|
// List item
|
|
29
32
|
li {
|
|
33
|
+
padding-left: ${spacing.nsmall};
|
|
30
34
|
margin-top: ${spacing.normal};
|
|
35
|
+
p {
|
|
36
|
+
margin-bottom: ${spacing.normal} !important;
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
// Child unordered lists
|
|
@@ -27,32 +27,31 @@ const TopicNavigation = styled.div`
|
|
|
27
27
|
align-items: flex-start;
|
|
28
28
|
padding: 0 ${spacing.normal};
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
width: 50%;
|
|
46
|
-
}
|
|
47
|
-
a {
|
|
48
|
-
color: #fff;
|
|
49
|
-
&:hover,
|
|
50
|
-
&:focus {
|
|
51
|
-
color: ${colors.brand.light};
|
|
52
|
-
}
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
const StyledUl = styled.ul`
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
list-style-type: none;
|
|
36
|
+
list-style-image: none;
|
|
37
|
+
li {
|
|
38
|
+
flex: 1;
|
|
39
|
+
width: 100%;
|
|
40
|
+
a {
|
|
41
|
+
color: ${colors.white};
|
|
42
|
+
&:hover,
|
|
43
|
+
&:focus-within {
|
|
44
|
+
color: ${colors.brand.light};
|
|
53
45
|
}
|
|
54
46
|
}
|
|
55
47
|
}
|
|
48
|
+
${mq.range({ from: breakpoints.tablet })} {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-template-rows: auto auto auto auto;
|
|
51
|
+
grid-template-columns: 1fr;
|
|
52
|
+
grid-auto-flow: column;
|
|
53
|
+
column-gap: ${spacing.normal};
|
|
54
|
+
}
|
|
56
55
|
`;
|
|
57
56
|
|
|
58
57
|
interface Props {
|
|
@@ -81,7 +80,7 @@ const FilmMovieSearch = ({
|
|
|
81
80
|
{`${t('ndlaFilm.subjectsInMovies')}:`}
|
|
82
81
|
</StyledHeadingH2>
|
|
83
82
|
<nav className="u-12/12 u-8/12@tablet" aria-labelledby={skipToContentId}>
|
|
84
|
-
<
|
|
83
|
+
<StyledUl>
|
|
85
84
|
{topics.map((topic) => (
|
|
86
85
|
<li key={topic.id}>
|
|
87
86
|
<SafeLink to={topic.path} key={topic.id}>
|
|
@@ -89,7 +88,7 @@ const FilmMovieSearch = ({
|
|
|
89
88
|
</SafeLink>
|
|
90
89
|
</li>
|
|
91
90
|
))}
|
|
92
|
-
</
|
|
91
|
+
</StyledUl>
|
|
93
92
|
</nav>
|
|
94
93
|
</TopicNavigation>
|
|
95
94
|
<CategorySelect
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
10
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
11
|
-
import {
|
|
11
|
+
import { ComponentProps, ElementType, ReactNode } from 'react';
|
|
12
12
|
import { HeadingLevel } from '../types';
|
|
13
13
|
|
|
14
14
|
const style = css`
|
|
@@ -63,8 +63,8 @@ const style = css`
|
|
|
63
63
|
|
|
64
64
|
type AllowedElements = HeadingLevel | 'p' | 'span';
|
|
65
65
|
|
|
66
|
-
interface Props<T extends AllowedElements>
|
|
67
|
-
element:
|
|
66
|
+
interface Props<T extends AllowedElements> {
|
|
67
|
+
element: T;
|
|
68
68
|
headingStyle: 'h1' | 'h2' | 'h3' | 'list-title' | 'default';
|
|
69
69
|
serif?: boolean;
|
|
70
70
|
/**
|
|
@@ -75,19 +75,19 @@ interface Props<T extends AllowedElements> extends HTMLAttributes<T> {
|
|
|
75
75
|
*/
|
|
76
76
|
margin?: 'xlarge' | 'large' | 'normal' | 'small' | 'none';
|
|
77
77
|
children: ReactNode;
|
|
78
|
-
className?: string;
|
|
79
78
|
}
|
|
80
79
|
|
|
81
80
|
const Heading = <T extends AllowedElements>({
|
|
82
|
-
element
|
|
81
|
+
element,
|
|
83
82
|
children,
|
|
84
83
|
headingStyle,
|
|
85
84
|
margin = 'normal',
|
|
86
85
|
serif,
|
|
87
|
-
|
|
88
|
-
}: Props<T>) => {
|
|
86
|
+
...rest
|
|
87
|
+
}: Props<T> & ComponentProps<T>) => {
|
|
88
|
+
const Element = element as ElementType;
|
|
89
89
|
return (
|
|
90
|
-
<Element css={style} data-serif={serif} data-style={headingStyle} data-margin={margin}
|
|
90
|
+
<Element css={style} data-serif={serif} data-style={headingStyle} data-margin={margin} {...rest}>
|
|
91
91
|
{children}
|
|
92
92
|
</Element>
|
|
93
93
|
);
|
package/src/index.ts
CHANGED
|
@@ -277,3 +277,5 @@ export { KeyFigure } from './KeyFigure';
|
|
|
277
277
|
export { default as ContactBlock } from './ContactBlock';
|
|
278
278
|
export type { HeartButtonType } from './Embed';
|
|
279
279
|
export { CampaignBlock } from './CampaignBlock';
|
|
280
|
+
export { Heading } from './Typography';
|
|
281
|
+
export type { HeadingLevel } from './types';
|
|
@@ -478,6 +478,7 @@ const messages = {
|
|
|
478
478
|
onlyTeacher: 'This resource is accessible only to teachers who are logged in with Feide.',
|
|
479
479
|
},
|
|
480
480
|
possiblyOutdated: 'The article is outdated',
|
|
481
|
+
references: 'References',
|
|
481
482
|
},
|
|
482
483
|
competenceGoals: {
|
|
483
484
|
competenceGoal: 'competence-goal',
|
|
@@ -996,6 +997,7 @@ const messages = {
|
|
|
996
997
|
},
|
|
997
998
|
},
|
|
998
999
|
audio: {
|
|
1000
|
+
play: 'Play',
|
|
999
1001
|
download: 'Download audio',
|
|
1000
1002
|
reuse: 'Use audio',
|
|
1001
1003
|
error: {
|
|
@@ -477,6 +477,7 @@ const messages = {
|
|
|
477
477
|
onlyTeacher: 'Denne ressursen er bare tilgjengelig for lærere som er pålogget med Feide.',
|
|
478
478
|
},
|
|
479
479
|
possiblyOutdated: 'Artikkelen er foreldet.',
|
|
480
|
+
references: 'Referanser',
|
|
480
481
|
},
|
|
481
482
|
competenceGoals: {
|
|
482
483
|
competenceGoal: 'kompetansemål',
|
|
@@ -995,6 +996,7 @@ const messages = {
|
|
|
995
996
|
},
|
|
996
997
|
},
|
|
997
998
|
audio: {
|
|
999
|
+
play: 'Spill av',
|
|
998
1000
|
download: 'Last ned lydfil',
|
|
999
1001
|
reuse: 'Bruk lydfil',
|
|
1000
1002
|
error: {
|
|
@@ -477,6 +477,7 @@ const messages = {
|
|
|
477
477
|
onlyTeacher: 'Denne ressursen er berre tilgjengeleg for lærarar som er pålogga med Feide.',
|
|
478
478
|
},
|
|
479
479
|
possiblyOutdated: 'Artikkelen er foreldet.',
|
|
480
|
+
references: 'Referanser',
|
|
480
481
|
},
|
|
481
482
|
competenceGoals: {
|
|
482
483
|
competenceGoal: 'kompetansemål',
|
|
@@ -995,6 +996,7 @@ const messages = {
|
|
|
995
996
|
},
|
|
996
997
|
},
|
|
997
998
|
audio: {
|
|
999
|
+
play: 'Spill av',
|
|
998
1000
|
download: 'Last ned lydfil',
|
|
999
1001
|
reuse: 'Bruk lydfil',
|
|
1000
1002
|
error: {
|