@ndla/ui 3.1.0 → 3.1.1-alpha.8
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.
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
+
import { ReactNode } from 'react';
|
|
8
9
|
interface Props {
|
|
9
10
|
title?: string | null;
|
|
11
|
+
children: ReactNode;
|
|
10
12
|
}
|
|
11
|
-
declare const CopyParagraphButton: ({ title }: Props) => JSX.Element | null;
|
|
13
|
+
declare const CopyParagraphButton: ({ title, children }: Props) => JSX.Element | null;
|
|
12
14
|
export default CopyParagraphButton;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1-alpha.8+b6417b53b",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "b6417b53b0435caa66e40eef727e26c7724f7ba6"
|
|
96
96
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, { useEffect, useState } from 'react';
|
|
9
|
+
import React, { ReactNode, useEffect, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
import styled from '@emotion/styled';
|
|
12
12
|
import { Link } from '@ndla/icons/common';
|
|
@@ -46,9 +46,10 @@ const ContainerDiv = styled.div`
|
|
|
46
46
|
|
|
47
47
|
interface Props {
|
|
48
48
|
title?: string | null;
|
|
49
|
+
children: ReactNode;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
const CopyParagraphButton = ({ title }: Props) => {
|
|
52
|
+
const CopyParagraphButton = ({ title, children }: Props) => {
|
|
52
53
|
const { t } = useTranslation();
|
|
53
54
|
const [hasCopied, setHasCopied] = useState(false);
|
|
54
55
|
useEffect(() => {
|
|
@@ -80,7 +81,7 @@ const CopyParagraphButton = ({ title }: Props) => {
|
|
|
80
81
|
</Tooltip>
|
|
81
82
|
</IconButton>
|
|
82
83
|
<h2 id={sanitizedTitle} tabIndex={0}>
|
|
83
|
-
{
|
|
84
|
+
{children}
|
|
84
85
|
</h2>
|
|
85
86
|
</ContainerDiv>
|
|
86
87
|
);
|
|
@@ -19,7 +19,8 @@ const forEachElement = (selector: string, callback: Function) => {
|
|
|
19
19
|
const initCopyParagraphButtons = () => {
|
|
20
20
|
forEachElement('[data-header-copy-container]', (el: HTMLElement) => {
|
|
21
21
|
const title = el.getAttribute('data-title');
|
|
22
|
-
|
|
22
|
+
const children = el.children;
|
|
23
|
+
ReactDOM.hydrate(<CopyParagraphButton title={title}>{children}</CopyParagraphButton>, el);
|
|
23
24
|
});
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -134,7 +134,7 @@ const messages = {
|
|
|
134
134
|
showingCompetenceGoalSearchPhrase: 'Showing results for competence goals {text}',
|
|
135
135
|
searchPhraseSuggestion: 'Search instead for:',
|
|
136
136
|
notionLabels: 'Used in',
|
|
137
|
-
notionsHeading: '
|
|
137
|
+
notionsHeading: 'Explanations',
|
|
138
138
|
notionsRemove: 'Remove',
|
|
139
139
|
showVideo: 'Watch video',
|
|
140
140
|
showNotion: 'Show notion',
|
|
@@ -765,8 +765,8 @@ const messages = {
|
|
|
765
765
|
showLongerDescription: 'Vis hele emnebeskrivelsen',
|
|
766
766
|
showShorterDescription: 'Skjul emnebeskrivelsen',
|
|
767
767
|
topics: 'Emner',
|
|
768
|
-
additionalTopic: '
|
|
769
|
-
additionalTopics: '
|
|
768
|
+
additionalTopic: 'Tilleggsemne',
|
|
769
|
+
additionalTopics: 'Tilleggsemner',
|
|
770
770
|
loadingText: 'Laster emne',
|
|
771
771
|
},
|
|
772
772
|
multidisciplinarySubject: {
|