@ndla/ui 41.2.6 → 41.3.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/index.js +1 -2
- package/es/ContentTypeBadge/ContentTypeBadge.js +2 -2
- package/es/Embed/ImageEmbed.js +4 -1
- package/es/FrontpageArticle/FrontpageArticle.js +78 -0
- package/es/FrontpageArticle/index.js +10 -0
- package/es/Hero/Hero.js +25 -15
- package/es/Hero/HeroContent.js +16 -0
- package/es/Hero/index.js +2 -1
- package/es/Image/Image.js +42 -35
- package/es/Layout/LayoutItem.js +15 -4
- package/es/LearningPaths/LearningPathWrapper.js +4 -9
- package/es/LicenseByline/EmbedByline.js +11 -6
- package/es/all.css +1 -1
- package/es/index.js +3 -2
- package/es/locale/messages-en.js +1 -1
- package/es/locale/messages-nb.js +1 -1
- package/es/locale/messages-nn.js +1 -1
- package/es/locale/messages-se.js +1 -1
- package/es/locale/messages-sma.js +1 -1
- package/lib/Article/index.d.ts +1 -2
- package/lib/Article/index.js +0 -7
- package/lib/ContentTypeBadge/ContentTypeBadge.js +1 -1
- package/lib/Embed/ImageEmbed.d.ts +2 -1
- package/lib/Embed/ImageEmbed.js +4 -1
- package/lib/FrontpageArticle/FrontpageArticle.d.ts +17 -0
- package/lib/FrontpageArticle/FrontpageArticle.js +84 -0
- package/lib/FrontpageArticle/index.d.ts +9 -0
- package/lib/FrontpageArticle/index.js +17 -0
- package/lib/Hero/Hero.d.ts +5 -7
- package/lib/Hero/Hero.js +25 -17
- package/lib/Hero/HeroContent.d.ts +12 -0
- package/lib/Hero/HeroContent.js +24 -0
- package/lib/Hero/index.d.ts +1 -0
- package/lib/Hero/index.js +8 -1
- package/lib/Image/Image.d.ts +2 -1
- package/lib/Image/Image.js +42 -35
- package/lib/Layout/LayoutItem.d.ts +3 -3
- package/lib/Layout/LayoutItem.js +16 -6
- package/lib/LearningPaths/LearningPathWrapper.js +4 -9
- package/lib/LicenseByline/EmbedByline.d.ts +2 -1
- package/lib/LicenseByline/EmbedByline.js +11 -6
- package/lib/all.css +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.js +13 -6
- package/lib/locale/messages-en.js +1 -1
- package/lib/locale/messages-nb.js +1 -1
- package/lib/locale/messages-nn.js +1 -1
- package/lib/locale/messages-se.js +1 -1
- package/lib/locale/messages-sma.js +1 -1
- package/package.json +3 -3
- package/src/Article/index.ts +0 -2
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +2 -2
- package/src/Embed/ImageEmbed.tsx +4 -1
- package/src/FrontpageArticle/FrontpageArticle.tsx +76 -0
- package/src/FrontpageArticle/index.ts +11 -0
- package/src/Hero/Hero.stories.tsx +38 -0
- package/src/Hero/Hero.tsx +94 -22
- package/src/Hero/HeroContent.tsx +43 -0
- package/src/Hero/index.ts +1 -0
- package/src/Image/Image.tsx +29 -19
- package/src/Image/__tests__/__snapshots__/Image-test.jsx.snap +73 -0
- package/src/Layout/LayoutItem.tsx +8 -4
- package/src/LearningPaths/LearningPathWrapper.tsx +6 -20
- package/src/LicenseByline/EmbedByline.tsx +15 -4
- package/src/index.ts +3 -1
- package/src/locale/messages-en.ts +1 -1
- package/src/locale/messages-nb.ts +1 -1
- package/src/locale/messages-nn.ts +1 -1
- package/src/locale/messages-se.ts +1 -1
- package/src/locale/messages-sma.ts +1 -1
- package/src/main.scss +0 -1
- package/es/Article/ArticleSideBar.js +0 -78
- package/lib/Article/ArticleSideBar.d.ts +0 -7
- package/lib/Article/ArticleSideBar.js +0 -84
- package/src/Article/ArticleSideBar.tsx +0 -73
- package/src/Hero/component.hero.scss +0 -122
|
@@ -5,8 +5,34 @@ exports[`Image renderers correctly 1`] = `
|
|
|
5
5
|
position: relative;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
.emotion-0[data-svg='true'] {
|
|
9
|
+
display: -webkit-box;
|
|
10
|
+
display: -webkit-flex;
|
|
11
|
+
display: -ms-flexbox;
|
|
12
|
+
display: flex;
|
|
13
|
+
-webkit-box-pack: center;
|
|
14
|
+
-ms-flex-pack: center;
|
|
15
|
+
-webkit-justify-content: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.emotion-0[data-in-grid='true'] {
|
|
20
|
+
border: 1px solid #a5bcd3;
|
|
21
|
+
border-bottom: 0;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
border-bottom-left-radius: 0;
|
|
24
|
+
border-bottom-right-radius: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.emotion-1[data-in-grid='true'] {
|
|
28
|
+
border-radius: 3px;
|
|
29
|
+
border-bottom-left-radius: 0;
|
|
30
|
+
border-bottom-right-radius: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
8
33
|
<div
|
|
9
34
|
class="emotion-0"
|
|
35
|
+
data-svg="false"
|
|
10
36
|
>
|
|
11
37
|
<picture>
|
|
12
38
|
<source
|
|
@@ -15,6 +41,7 @@ exports[`Image renderers correctly 1`] = `
|
|
|
15
41
|
/>
|
|
16
42
|
<img
|
|
17
43
|
alt="example"
|
|
44
|
+
class="emotion-1"
|
|
18
45
|
src="https://example.com/image.png?width=1024"
|
|
19
46
|
/>
|
|
20
47
|
</picture>
|
|
@@ -26,8 +53,34 @@ exports[`Image with crop and focalpoint props renderers correctly 1`] = `
|
|
|
26
53
|
position: relative;
|
|
27
54
|
}
|
|
28
55
|
|
|
56
|
+
.emotion-0[data-svg='true'] {
|
|
57
|
+
display: -webkit-box;
|
|
58
|
+
display: -webkit-flex;
|
|
59
|
+
display: -ms-flexbox;
|
|
60
|
+
display: flex;
|
|
61
|
+
-webkit-box-pack: center;
|
|
62
|
+
-ms-flex-pack: center;
|
|
63
|
+
-webkit-justify-content: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.emotion-0[data-in-grid='true'] {
|
|
68
|
+
border: 1px solid #a5bcd3;
|
|
69
|
+
border-bottom: 0;
|
|
70
|
+
border-radius: 4px;
|
|
71
|
+
border-bottom-left-radius: 0;
|
|
72
|
+
border-bottom-right-radius: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.emotion-1[data-in-grid='true'] {
|
|
76
|
+
border-radius: 3px;
|
|
77
|
+
border-bottom-left-radius: 0;
|
|
78
|
+
border-bottom-right-radius: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
29
81
|
<div
|
|
30
82
|
class="emotion-0"
|
|
83
|
+
data-svg="false"
|
|
31
84
|
>
|
|
32
85
|
<picture>
|
|
33
86
|
<source
|
|
@@ -36,6 +89,7 @@ exports[`Image with crop and focalpoint props renderers correctly 1`] = `
|
|
|
36
89
|
/>
|
|
37
90
|
<img
|
|
38
91
|
alt="example"
|
|
92
|
+
class="emotion-1"
|
|
39
93
|
src="https://example.com/image.png?width=1024&cropStartX=14.59&cropEndX=79.63&cropStartY=20&cropEndY=100&focalX=65.08&focalY=45.28"
|
|
40
94
|
/>
|
|
41
95
|
</picture>
|
|
@@ -47,6 +101,25 @@ exports[`Lazyloaded image renderers correctly 1`] = `
|
|
|
47
101
|
position: relative;
|
|
48
102
|
}
|
|
49
103
|
|
|
104
|
+
.emotion-0[data-svg='true'] {
|
|
105
|
+
display: -webkit-box;
|
|
106
|
+
display: -webkit-flex;
|
|
107
|
+
display: -ms-flexbox;
|
|
108
|
+
display: flex;
|
|
109
|
+
-webkit-box-pack: center;
|
|
110
|
+
-ms-flex-pack: center;
|
|
111
|
+
-webkit-justify-content: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.emotion-0[data-in-grid='true'] {
|
|
116
|
+
border: 1px solid #a5bcd3;
|
|
117
|
+
border-bottom: 0;
|
|
118
|
+
border-radius: 4px;
|
|
119
|
+
border-bottom-left-radius: 0;
|
|
120
|
+
border-bottom-right-radius: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
50
123
|
<div
|
|
51
124
|
class="emotion-0"
|
|
52
125
|
>
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, { ReactNode } from 'react';
|
|
9
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
10
10
|
|
|
11
|
-
interface Props {
|
|
11
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
layout?: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export const LayoutItem = ({ children, layout }: Props) => {
|
|
16
|
+
export const LayoutItem = ({ children, layout, ...rest }: Props) => {
|
|
17
17
|
switch (layout) {
|
|
18
18
|
case 'extend': {
|
|
19
19
|
return (
|
|
@@ -29,7 +29,11 @@ export const LayoutItem = ({ children, layout }: Props) => {
|
|
|
29
29
|
return <section className="u-1/1@desktop">{children}</section>;
|
|
30
30
|
}
|
|
31
31
|
default: {
|
|
32
|
-
return
|
|
32
|
+
return (
|
|
33
|
+
<section className="o-layout__item" {...rest}>
|
|
34
|
+
{children}
|
|
35
|
+
</section>
|
|
36
|
+
);
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
};
|
|
@@ -8,14 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
import React, { ReactNode } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
|
-
import { css } from '@emotion/react';
|
|
12
11
|
import { spacing, spacingUnit, breakpoints, mq } from '@ndla/core';
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
invertedStyle?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const StyledWrapper = styled.section<PropStyledWrapper>`
|
|
13
|
+
const StyledWrapper = styled.section`
|
|
19
14
|
max-width: ${1402 + spacingUnit}px;
|
|
20
15
|
padding: 0 ${spacing.normal};
|
|
21
16
|
margin: 0 auto;
|
|
@@ -23,21 +18,12 @@ const StyledWrapper = styled.section<PropStyledWrapper>`
|
|
|
23
18
|
padding-right: 0;
|
|
24
19
|
padding-left: 0;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.c-hero__content {
|
|
31
|
-
display: flex;
|
|
21
|
+
|
|
22
|
+
&[data-inverted='true'] {
|
|
23
|
+
${mq.range({ until: breakpoints.tablet })} {
|
|
24
|
+
background: #fff;
|
|
32
25
|
}
|
|
33
26
|
}
|
|
34
|
-
${(props) =>
|
|
35
|
-
props.invertedStyle &&
|
|
36
|
-
css`
|
|
37
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
38
|
-
background: #fff;
|
|
39
|
-
}
|
|
40
|
-
`}
|
|
41
27
|
`;
|
|
42
28
|
|
|
43
29
|
interface Props {
|
|
@@ -46,5 +32,5 @@ interface Props {
|
|
|
46
32
|
}
|
|
47
33
|
|
|
48
34
|
export const LearningPathWrapper = ({ children, invertedStyle }: Props) => (
|
|
49
|
-
<StyledWrapper
|
|
35
|
+
<StyledWrapper data-inverted={!!invertedStyle}>{children}</StyledWrapper>
|
|
50
36
|
);
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { ReactNode } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import styled from '@emotion/styled';
|
|
12
|
+
import { css } from '@emotion/react';
|
|
12
13
|
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
13
14
|
import { getLicenseByAbbreviation, getLicenseCredits } from '@ndla/licenses';
|
|
14
15
|
import { ICopyright as ImageCopyright } from '@ndla/types-backend/image-api';
|
|
@@ -27,6 +28,7 @@ interface BaseProps {
|
|
|
27
28
|
visibleAlt?: string;
|
|
28
29
|
error?: true | false;
|
|
29
30
|
first?: boolean;
|
|
31
|
+
inGrid?: boolean;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export interface EmbedBylineErrorProps extends BaseProps {
|
|
@@ -95,15 +97,23 @@ const BylineWrapper = styled.div`
|
|
|
95
97
|
}
|
|
96
98
|
`;
|
|
97
99
|
|
|
100
|
+
const mobileStyling = css`
|
|
101
|
+
align-items: flex-start;
|
|
102
|
+
gap: ${spacing.xsmall};
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
`;
|
|
105
|
+
|
|
98
106
|
const RightsWrapper = styled.div`
|
|
99
107
|
display: flex;
|
|
100
108
|
align-items: center;
|
|
101
109
|
gap: ${spacing.nsmall};
|
|
102
110
|
|
|
111
|
+
&[data-grid='true'] {
|
|
112
|
+
${mobileStyling}
|
|
113
|
+
}
|
|
114
|
+
|
|
103
115
|
${mq.range({ until: breakpoints.tablet })} {
|
|
104
|
-
|
|
105
|
-
gap: ${spacing.xsmall};
|
|
106
|
-
flex-direction: column;
|
|
116
|
+
${mobileStyling}
|
|
107
117
|
}
|
|
108
118
|
`;
|
|
109
119
|
|
|
@@ -125,6 +135,7 @@ const EmbedByline = ({
|
|
|
125
135
|
children,
|
|
126
136
|
visibleAlt,
|
|
127
137
|
first = true,
|
|
138
|
+
inGrid = false,
|
|
128
139
|
...props
|
|
129
140
|
}: Props) => {
|
|
130
141
|
const { t, i18n } = useTranslation();
|
|
@@ -149,7 +160,7 @@ const EmbedByline = ({
|
|
|
149
160
|
<BylineWrapper data-top-rounded={topRounded} data-bottom-rounded={bottomRounded} data-first={first}>
|
|
150
161
|
{!!strippedDescription?.length && description && <LicenseDescription description={description} />}
|
|
151
162
|
{visibleAlt ? <StyledSpan>{`Alt: ${visibleAlt}`}</StyledSpan> : null}
|
|
152
|
-
<RightsWrapper>
|
|
163
|
+
<RightsWrapper data-grid={inGrid}>
|
|
153
164
|
<LicenseLink license={license} asLink={!!license.url.length} />
|
|
154
165
|
<LicenseInformationWrapper>
|
|
155
166
|
<span>
|
package/src/index.ts
CHANGED
|
@@ -34,7 +34,6 @@ export {
|
|
|
34
34
|
ArticleTitle,
|
|
35
35
|
ArticleWrapper,
|
|
36
36
|
ArticleHeaderWrapper,
|
|
37
|
-
ArticleSideBar,
|
|
38
37
|
default as Article,
|
|
39
38
|
} from './Article';
|
|
40
39
|
|
|
@@ -90,6 +89,7 @@ export {
|
|
|
90
89
|
SourceMaterialHero,
|
|
91
90
|
Hero,
|
|
92
91
|
NdlaFilmHero,
|
|
92
|
+
HeroContent,
|
|
93
93
|
} from './Hero';
|
|
94
94
|
|
|
95
95
|
export { FilterList, FilterListPhone, FilterButtons, ToggleItem } from './Filter';
|
|
@@ -268,4 +268,6 @@ export { Grid } from './Grid';
|
|
|
268
268
|
export type { GridType } from './Grid';
|
|
269
269
|
export { Heading } from './Typography';
|
|
270
270
|
export type { HeadingLevel } from './types';
|
|
271
|
+
|
|
272
|
+
export { default as FrontpageArticle } from './FrontpageArticle';
|
|
271
273
|
export { DefinitionTerm, DefinitionDescription } from './DefinitionList';
|
|
@@ -1215,7 +1215,7 @@ const messages = {
|
|
|
1215
1215
|
'In order to use the My NDLA service you have to be a student or work at a school in a county that partakes in the NDLA collaboration. We ask you not to write offensive or personally sensitive information in text fields. Read our ',
|
|
1216
1216
|
loginTextLink: 'privacy policy here',
|
|
1217
1217
|
loginTerms: 'Log in with Feide to receive access. By logging on your accept your terms of service',
|
|
1218
|
-
loginResourcePitch: 'Do you want to favorite this
|
|
1218
|
+
loginResourcePitch: 'Do you want to favorite this resource?',
|
|
1219
1219
|
loginWelcome: 'Welcome to My NDLA! This page allows you to organize your articles in your <i>own</i> way!',
|
|
1220
1220
|
deleteAccount: 'Delete My NDLA',
|
|
1221
1221
|
welcome:
|
|
@@ -1213,7 +1213,7 @@ const messages = {
|
|
|
1213
1213
|
'For å kunne bruke tjenesten Min NDLA må du være elev eller jobbe på en skole i et fylke som er med i NDLA-samarbeidet. Vi ber om at du ikke skriver noe støtende, personsensitiv informasjon eller andre persondata i tekstfelt. Les vår ',
|
|
1214
1214
|
loginTextLink: 'personvernerklæring her',
|
|
1215
1215
|
loginTerms: 'Logg på med Feide for å få tilgang. Ved å logge på godkjenner du våre vilkår for bruk',
|
|
1216
|
-
loginResourcePitch: 'Ønsker du å favorittmerke denne
|
|
1216
|
+
loginResourcePitch: 'Ønsker du å favorittmerke denne ressursen?',
|
|
1217
1217
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1218
1218
|
welcome:
|
|
1219
1219
|
'Velkommen til Min NDLA! Nå kan du lagre favorittressursene dine fra NDLA og organisere dem i mapper og med emneknagger.',
|
|
@@ -1213,7 +1213,7 @@ const messages = {
|
|
|
1213
1213
|
'For å kunne bruke tjenesten Min NDLA må du vere elev eller jobbe på ein skule i eit fylke som er med i NDLA-samarbeidet. Vi ber om at du ikkje skriv noko støtande, personsensitiv informasjon eller andre persondata i tekstfelt. Les vår ',
|
|
1214
1214
|
loginTextLink: 'personvernerklæring her',
|
|
1215
1215
|
loginTerms: 'Logg på med Feide for å få tilgang. Ved å logge på godkjennar du våre vilkår for bruk',
|
|
1216
|
-
loginResourcePitch: 'Ønsker du å favorittmerke denne
|
|
1216
|
+
loginResourcePitch: 'Ønsker du å favorittmerke denne resursen?',
|
|
1217
1217
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1218
1218
|
welcome:
|
|
1219
1219
|
'Velkommen til Min NDLA! No kan du lagre favorittressursane dine frå NDLA og organisere dei i mapper og med emneknaggar.',
|
|
@@ -1215,7 +1215,7 @@ const messages = {
|
|
|
1215
1215
|
'Jus galggat sáhttit geavahit bálvalusa Mu NDLA fertet leat oahppi dahje bargat muhtin skuvllas fylkkas mii lea mielde NDLA-ovttasbarggus. Mii bivdit ahte it čále maidege unohasaid, persovdnasensitiivvalaš dieđuid dahje eará persovdnadáhtaid min teakstagieddái. Loga min ',
|
|
1216
1216
|
loginTextLink: 'personsuodjalusjulggaštusa dákko',
|
|
1217
1217
|
loginTerms: 'Logge Feide bokte vai oaččut beassanlobi. Go logget sisa de dohkkehat min geavahaneavttuid.',
|
|
1218
|
-
loginResourcePitch: '
|
|
1218
|
+
loginResourcePitch: 'Ønsker du å favorittmerke denne ressursen?',
|
|
1219
1219
|
loginWelcome: 'Bures boahtin NDLA:ii! Dáppe sáhtát fágaávdnasiid ordnet iežat vuogi mielde',
|
|
1220
1220
|
welcome:
|
|
1221
1221
|
'Bures boahtin Mu NDLA:ii! Dál sáhtát vurket iežat oiddotresurssaid NDLA:s ja ordnet daid nu go dáhtut máhpaide ja fáddágilkoriiguin.',
|
|
@@ -1218,7 +1218,7 @@ const messages = {
|
|
|
1218
1218
|
'For å kunne bruke tjenesten Min NDLA må du vere elev eller jobbe på ein skule i eit fylke som er med i NDLA-samarbeidet. Vi ber om at du ikkje skriv noko støtande, personsensitiv informasjon eller andre persondata i tekstfelt. Les vår ',
|
|
1219
1219
|
loginTextLink: 'personvernerklæring her',
|
|
1220
1220
|
loginTerms: 'Logg på med Feide for å få tilgang. Ved å logge på godkjenner du våre vilkår for bruk',
|
|
1221
|
-
loginResourcePitch: 'Ønsker du å favorittmerke denne
|
|
1221
|
+
loginResourcePitch: 'Ønsker du å favorittmerke denne ressursen?',
|
|
1222
1222
|
loginWelcome: 'Velkommen til NDLA! Her kan du organisere fagstoffet på <i>din</i> måte!',
|
|
1223
1223
|
welcome:
|
|
1224
1224
|
'Velkommen til Min NDLA! Nå kan du lagre favorittressursene dine fra NDLA og organisere dem i mapper og med emneknagger.',
|
package/src/main.scss
CHANGED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import _styled from "@emotion/styled/base";
|
|
2
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { CopyButton, ButtonV2 } from '@ndla/button';
|
|
5
|
-
import { ModalHeader, ModalBody, ModalCloseButton, Modal } from '@ndla/modal';
|
|
6
|
-
import { copyTextToClipboard } from '@ndla/util';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
9
|
-
import { Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
10
|
-
import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
11
|
-
var Wrapper = /*#__PURE__*/_styled("div", {
|
|
12
|
-
target: "e1vl4tfq1",
|
|
13
|
-
label: "Wrapper"
|
|
14
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
15
|
-
name: "ngugnp",
|
|
16
|
-
styles: "width:160px;margin:6px 10px;display:flex;flex-direction:column;align-items:center"
|
|
17
|
-
} : {
|
|
18
|
-
name: "ngugnp",
|
|
19
|
-
styles: "width:160px;margin:6px 10px;display:flex;flex-direction:column;align-items:center",
|
|
20
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFydGljbGVTaWRlQmFyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPMEIiLCJmaWxlIjoiQXJ0aWNsZVNpZGVCYXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IFJlYWN0Tm9kZSB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IENvcHlCdXR0b24sIEJ1dHRvblYyIH0gZnJvbSAnQG5kbGEvYnV0dG9uJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IE1vZGFsSGVhZGVyLCBNb2RhbEJvZHksIE1vZGFsQ2xvc2VCdXR0b24sIE1vZGFsIH0gZnJvbSAnQG5kbGEvbW9kYWwnO1xuaW1wb3J0IHsgY29weVRleHRUb0NsaXBib2FyZCB9IGZyb20gJ0BuZGxhL3V0aWwnO1xuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tICdyZWFjdC1pMThuZXh0JztcblxuY29uc3QgV3JhcHBlciA9IHN0eWxlZC5kaXZgXG4gIHdpZHRoOiAxNjBweDtcbiAgbWF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ICAgPlxuICAgICAgICAgICAge3QoJ2FydGljbGUuY29weVBhZ2VMaW5rJyl9XG4gICAgICAgICAgPC9Db3B5QnV0dG9uPlxuICAgICAgICA8L0J1dHRvbldyYXBwZXI+XG4gICAgICApfVxuICAgICAge2xpY2Vuc2VCb3ggJiYgKFxuICAgICAgICA8TW9kYWxcbiAgICAgICAgICBhY3RpdmF0ZUJ1dHRvbj17XG4gICAgICAgICAgICA8QnV0dG9uVjIgc2l6ZT1cInNtYWxsXCIgdmFyaWFudD1cIm91dGxpbmVcIj5cbiAgICAgICAgICAgICAge3QoJ2FydGljbGUudXNlQ29udGVudCcpfVxuICAgICAgICAgICAgPC9CdXR0b25WMj5cbiAgICAgICAgICB9XG4gICAgICAgICAgc2l6ZT1cIm5vcm1hbFwiXG4gICAgICAgID5cbiAgICAgICAgICB7KG9uQ2xvc2U6ICgpID0+IHZvaWQpID0+IChcbiAgICAgICAgICAgIDw+XG4gICAgICAgICAgICAgIDxNb2RhbEhlYWRlcj5cbiAgICAgICAgICAgICAgICA8TW9kYWxDbG9zZUJ1dHRvbiBvbkNsaWNrPXtvbkNsb3NlfSB0aXRsZT17dCgnYXJ0aWNsZS5jbG9zZUxhYmVsJyl9IC8+XG4gICAgICAgICAgICAgIDwvTW9kYWxIZWFkZXI+XG4gICAgICAgICAgICAgIDxNb2RhbEJvZHk+e2xpY2Vuc2VCb3h9PC9Nb2RhbEJvZHk+XG4gICAgICAgICAgICA8Lz5cbiAgICAgICAgICApfVxuICAgICAgICA8L01vZGFsPlxuICAgICAgKX1cbiAgICA8L1dyYXBwZXI+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBBcnRpY2xlU2lkZUJhcjtcbiJdfQ== */",
|
|
21
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
-
});
|
|
23
|
-
var ButtonWrapper = /*#__PURE__*/_styled("div", {
|
|
24
|
-
target: "e1vl4tfq0",
|
|
25
|
-
label: "ButtonWrapper"
|
|
26
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
27
|
-
name: "zdttou",
|
|
28
|
-
styles: "margin-bottom:8px;width:100%"
|
|
29
|
-
} : {
|
|
30
|
-
name: "zdttou",
|
|
31
|
-
styles: "margin-bottom:8px;width:100%",
|
|
32
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFydGljbGVTaWRlQmFyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlZ0MiLCJmaWxlIjoiQXJ0aWNsZVNpZGVCYXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IFJlYWN0Tm9kZSB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IENvcHlCdXR0b24sIEJ1dHRvblYyIH0gZnJvbSAnQG5kbGEvYnV0dG9uJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IE1vZGFsSGVhZGVyLCBNb2RhbEJvZHksIE1vZGFsQ2xvc2VCdXR0b24sIE1vZGFsIH0gZnJvbSAnQG5kbGEvbW9kYWwnO1xuaW1wb3J0IHsgY29weVRleHRUb0NsaXBib2FyZCB9IGZyb20gJ0BuZGxhL3V0aWwnO1xuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tICdyZWFjdC1pMThuZXh0JztcblxuY29uc3QgV3JhcHBlciA9IHN0eWxlZC5kaXZgXG4gIHdpZHRoOiAxNjBweDtcbiAgbWFyZ2luOiA2cHggMTBweDtcbiAgZGlzcGxheTogZmxleDtcbiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbmA7XG5cbmNvbnN0IEJ1dHRvbldyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICBtYXJnaW4tYm90dG9tOiA4cHg7XG4gIHdpZHRoOiAxMDAlO1xuY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AgICAgICAgICA8QnV0dG9uVjIgc2l6ZT1cInNtYWxsXCIgdmFyaWFudD1cIm91dGxpbmVcIj5cbiAgICAgICAgICAgICAge3QoJ2FydGljbGUudXNlQ29udGVudCcpfVxuICAgICAgICAgICAgPC9CdXR0b25WMj5cbiAgICAgICAgICB9XG4gICAgICAgICAgc2l6ZT1cIm5vcm1hbFwiXG4gICAgICAgID5cbiAgICAgICAgICB7KG9uQ2xvc2U6ICgpID0+IHZvaWQpID0+IChcbiAgICAgICAgICAgIDw+XG4gICAgICAgICAgICAgIDxNb2RhbEhlYWRlcj5cbiAgICAgICAgICAgICAgICA8TW9kYWxDbG9zZUJ1dHRvbiBvbkNsaWNrPXtvbkNsb3NlfSB0aXRsZT17dCgnYXJ0aWNsZS5jbG9zZUxhYmVsJyl9IC8+XG4gICAgICAgICAgICAgIDwvTW9kYWxIZWFkZXI+XG4gICAgICAgICAgICAgIDxNb2RhbEJvZHk+e2xpY2Vuc2VCb3h9PC9Nb2RhbEJvZHk+XG4gICAgICAgICAgICA8Lz5cbiAgICAgICAgICApfVxuICAgICAgICA8L01vZGFsPlxuICAgICAgKX1cbiAgICA8L1dyYXBwZXI+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBBcnRpY2xlU2lkZUJhcjtcbiJdfQ== */",
|
|
33
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
34
|
-
});
|
|
35
|
-
var ArticleSideBar = function ArticleSideBar(_ref) {
|
|
36
|
-
var copyPageUrlLink = _ref.copyPageUrlLink,
|
|
37
|
-
licenseBox = _ref.licenseBox;
|
|
38
|
-
var _useTranslation = useTranslation(),
|
|
39
|
-
t = _useTranslation.t;
|
|
40
|
-
var copyLinkHandler = function copyLinkHandler() {
|
|
41
|
-
if (copyPageUrlLink) {
|
|
42
|
-
copyTextToClipboard(copyPageUrlLink);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return _jsxs(Wrapper, {
|
|
46
|
-
children: [copyPageUrlLink && _jsx(ButtonWrapper, {
|
|
47
|
-
children: _jsx(CopyButton, {
|
|
48
|
-
onClick: copyLinkHandler,
|
|
49
|
-
size: "small",
|
|
50
|
-
variant: "outline",
|
|
51
|
-
"aria-live": "assertive",
|
|
52
|
-
copyNode: t('article.copyPageLinkCopied'),
|
|
53
|
-
"data-copy-string": copyPageUrlLink,
|
|
54
|
-
children: t('article.copyPageLink')
|
|
55
|
-
})
|
|
56
|
-
}), licenseBox && _jsx(Modal, {
|
|
57
|
-
activateButton: _jsx(ButtonV2, {
|
|
58
|
-
size: "small",
|
|
59
|
-
variant: "outline",
|
|
60
|
-
children: t('article.useContent')
|
|
61
|
-
}),
|
|
62
|
-
size: "normal",
|
|
63
|
-
children: function children(onClose) {
|
|
64
|
-
return _jsxs(_Fragment, {
|
|
65
|
-
children: [_jsx(ModalHeader, {
|
|
66
|
-
children: _jsx(ModalCloseButton, {
|
|
67
|
-
onClick: onClose,
|
|
68
|
-
title: t('article.closeLabel')
|
|
69
|
-
})
|
|
70
|
-
}), _jsx(ModalBody, {
|
|
71
|
-
children: licenseBox
|
|
72
|
-
})]
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
})]
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
export default ArticleSideBar;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
interface Props {
|
|
3
|
-
copyPageUrlLink?: string;
|
|
4
|
-
licenseBox?: ReactNode;
|
|
5
|
-
}
|
|
6
|
-
declare const ArticleSideBar: ({ copyPageUrlLink, licenseBox }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default ArticleSideBar;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _button = require("@ndla/button");
|
|
10
|
-
var _modal = require("@ndla/modal");
|
|
11
|
-
var _util = require("@ndla/util");
|
|
12
|
-
var _reactI18next = require("react-i18next");
|
|
13
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
16
|
-
var Wrapper = /*#__PURE__*/(0, _base.default)("div", {
|
|
17
|
-
target: "e1vl4tfq1",
|
|
18
|
-
label: "Wrapper"
|
|
19
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
20
|
-
name: "ngugnp",
|
|
21
|
-
styles: "width:160px;margin:6px 10px;display:flex;flex-direction:column;align-items:center"
|
|
22
|
-
} : {
|
|
23
|
-
name: "ngugnp",
|
|
24
|
-
styles: "width:160px;margin:6px 10px;display:flex;flex-direction:column;align-items:center",
|
|
25
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFydGljbGVTaWRlQmFyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPMEIiLCJmaWxlIjoiQXJ0aWNsZVNpZGVCYXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IFJlYWN0Tm9kZSB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IENvcHlCdXR0b24sIEJ1dHRvblYyIH0gZnJvbSAnQG5kbGEvYnV0dG9uJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IE1vZGFsSGVhZGVyLCBNb2Rh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W5rSGFuZGxlcn1cbiAgICAgICAgICAgIHNpemU9XCJzbWFsbFwiXG4gICAgICAgICAgICB2YXJpYW50PVwib3V0bGluZVwiXG4gICAgICAgICAgICBhcmlhLWxpdmU9XCJhc3NlcnRpdmVcIlxuICAgICAgICAgICAgY29weU5vZGU9e3QoJ2FydGljbGUuY29weVBhZ2VMaW5rQ29waWVkJyl9XG4gICAgICAgICAgICBkYXRhLWNvcHktc3RyaW5nPXtjb3B5UGFnZVVybExpbmt9XG4gICAgICAgICAgPlxuICAgICAgICAgICAge3QoJ2FydGljbGUuY29weVBhZ2VMaW5rJyl9XG4gICAgICAgICAgPC9Db3B5QnV0dG9uPlxuICAgICAgICA8L0J1dHRvbldyYXBwZXI+XG4gICAgICApfVxuICAgICAge2xpY2Vuc2VCb3ggJiYgKFxuICAgICAgICA8TW9kYWxcbiAgICAgICAgICBhY3RpdmF0ZUJ1dHRvbj17XG4gICAgICAgICAgICA8QnV0dG9uVjIgc2l6ZT1cInNtYWxsXCIgdmFyaWFudD1cIm91dGxpbmVcIj5cbiAgICAgICAgICAgICAge3QoJ2FydGljbGUudXNlQ29udGVudCcpfVxuICAgICAgICAgICAgPC9CdXR0b25WMj5cbiAgICAgICAgICB9XG4gICAgICAgICAgc2l6ZT1cIm5vcm1hbFwiXG4gICAgICAgID5cbiAgICAgICAgICB7KG9uQ2xvc2U6ICgpID0+IHZvaWQpID0+IChcbiAgICAgICAgICAgIDw+XG4gICAgICAgICAgICAgIDxNb2RhbEhlYWRlcj5cbiAgICAgICAgICAgICAgICA8TW9kYWxDbG9zZUJ1dHRvbiBvbkNsaWNrPXtvbkNsb3NlfSB0aXRsZT17dCgnYXJ0aWNsZS5jbG9zZUxhYmVsJyl9IC8+XG4gICAgICAgICAgICAgIDwvTW9kYWxIZWFkZXI+XG4gICAgICAgICAgICAgIDxNb2RhbEJvZHk+e2xpY2Vuc2VCb3h9PC9Nb2RhbEJvZHk+XG4gICAgICAgICAgICA8Lz5cbiAgICAgICAgICApfVxuICAgICAgICA8L01vZGFsPlxuICAgICAgKX1cbiAgICA8L1dyYXBwZXI+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBBcnRpY2xlU2lkZUJhcjtcbiJdfQ== */",
|
|
26
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
27
|
-
});
|
|
28
|
-
var ButtonWrapper = /*#__PURE__*/(0, _base.default)("div", {
|
|
29
|
-
target: "e1vl4tfq0",
|
|
30
|
-
label: "ButtonWrapper"
|
|
31
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
32
|
-
name: "zdttou",
|
|
33
|
-
styles: "margin-bottom:8px;width:100%"
|
|
34
|
-
} : {
|
|
35
|
-
name: "zdttou",
|
|
36
|
-
styles: "margin-bottom:8px;width:100%",
|
|
37
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkFydGljbGVTaWRlQmFyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFlZ0MiLCJmaWxlIjoiQXJ0aWNsZVNpZGVCYXIudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0LCB7IFJlYWN0Tm9kZSB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IENvcHlCdXR0b24sIEJ1dHRvblYyIH0gZnJvbSAnQG5kbGEvYnV0dG9uJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IE1vZGFsSGVhZGVyLCBNb2RhbEJvZHksIE1vZGFsQ2xvc2VCdXR0b24sIE1vZGFsIH0gZnJvbSAnQG5kbGEvbW9kYWwnO1xuaW1wb3J0IHsgY29weVRleHRUb0NsaXBib2FyZCB9IGZyb20gJ0BuZGxhL3V0aWwnO1xuaW1wb3J0IHsgdXNlVHJhbnNsYXRpb24gfSBmcm9tICdyZWFjdC1pMThuZXh0JztcblxuY29uc3QgV3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gICBkYXRhLWNvcHktc3RyaW5nPXtjb3B5UGFnZVVybExpbmt9XG4gICAgICAgICAgPlxuICAgICAgICAgICAge3QoJ2FydGljbGUuY29weVBhZ2VMaW5rJyl9XG4gICAgICAgICAgPC9Db3B5QnV0dG9uPlxuICAgICAgICA8L0J1dHRvbldyYXBwZXI+XG4gICAgICApfVxuICAgICAge2xpY2Vuc2VCb3ggJiYgKFxuICAgICAgICA8TW9kYWxcbiAgICAgICAgICBhY3RpdmF0ZUJ1dHRvbj17XG4gICAgICAgICAgICA8QnV0dG9uVjIgc2l6ZT1cInNtYWxsXCIgdmFyaWFudD1cIm91dGxpbmVcIj5cbiAgICAgICAgICAgICAge3QoJ2FydGljbGUudXNlQ29udGVudCcpfVxuICAgICAgICAgICAgPC9CdXR0b25WMj5cbiAgICAgICAgICB9XG4gICAgICAgICAgc2l6ZT1cIm5vcm1hbFwiXG4gICAgICAgID5cbiAgICAgICAgICB7KG9uQ2xvc2U6ICgpID0+IHZvaWQpID0+IChcbiAgICAgICAgICAgIDw+XG4gICAgICAgICAgICAgIDxNb2RhbEhlYWRlcj5cbiAgICAgICAgICAgICAgICA8TW9kYWxDbG9zZUJ1dHRvbiBvbkNsaWNrPXtvbkNsb3NlfSB0aXRsZT17dCgnYXJ0aWNsZS5jbG9zZUxhYmVsJyl9IC8+XG4gICAgICAgICAgICAgIDwvTW9kYWxIZWFkZXI+XG4gICAgICAgICAgICAgIDxNb2RhbEJvZHk+e2xpY2Vuc2VCb3h9PC9Nb2RhbEJvZHk+XG4gICAgICAgICAgICA8Lz5cbiAgICAgICAgICApfVxuICAgICAgICA8L01vZGFsPlxuICAgICAgKX1cbiAgICA8L1dyYXBwZXI+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBBcnRpY2xlU2lkZUJhcjtcbiJdfQ== */",
|
|
38
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
39
|
-
});
|
|
40
|
-
var ArticleSideBar = function ArticleSideBar(_ref) {
|
|
41
|
-
var copyPageUrlLink = _ref.copyPageUrlLink,
|
|
42
|
-
licenseBox = _ref.licenseBox;
|
|
43
|
-
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
44
|
-
t = _useTranslation.t;
|
|
45
|
-
var copyLinkHandler = function copyLinkHandler() {
|
|
46
|
-
if (copyPageUrlLink) {
|
|
47
|
-
(0, _util.copyTextToClipboard)(copyPageUrlLink);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
return (0, _jsxRuntime.jsxs)(Wrapper, {
|
|
51
|
-
children: [copyPageUrlLink && (0, _jsxRuntime.jsx)(ButtonWrapper, {
|
|
52
|
-
children: (0, _jsxRuntime.jsx)(_button.CopyButton, {
|
|
53
|
-
onClick: copyLinkHandler,
|
|
54
|
-
size: "small",
|
|
55
|
-
variant: "outline",
|
|
56
|
-
"aria-live": "assertive",
|
|
57
|
-
copyNode: t('article.copyPageLinkCopied'),
|
|
58
|
-
"data-copy-string": copyPageUrlLink,
|
|
59
|
-
children: t('article.copyPageLink')
|
|
60
|
-
})
|
|
61
|
-
}), licenseBox && (0, _jsxRuntime.jsx)(_modal.Modal, {
|
|
62
|
-
activateButton: (0, _jsxRuntime.jsx)(_button.ButtonV2, {
|
|
63
|
-
size: "small",
|
|
64
|
-
variant: "outline",
|
|
65
|
-
children: t('article.useContent')
|
|
66
|
-
}),
|
|
67
|
-
size: "normal",
|
|
68
|
-
children: function children(onClose) {
|
|
69
|
-
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
70
|
-
children: [(0, _jsxRuntime.jsx)(_modal.ModalHeader, {
|
|
71
|
-
children: (0, _jsxRuntime.jsx)(_modal.ModalCloseButton, {
|
|
72
|
-
onClick: onClose,
|
|
73
|
-
title: t('article.closeLabel')
|
|
74
|
-
})
|
|
75
|
-
}), (0, _jsxRuntime.jsx)(_modal.ModalBody, {
|
|
76
|
-
children: licenseBox
|
|
77
|
-
})]
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
})]
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
var _default = ArticleSideBar;
|
|
84
|
-
exports.default = _default;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { CopyButton, ButtonV2 } from '@ndla/button';
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import { ModalHeader, ModalBody, ModalCloseButton, Modal } from '@ndla/modal';
|
|
5
|
-
import { copyTextToClipboard } from '@ndla/util';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
|
|
8
|
-
const Wrapper = styled.div`
|
|
9
|
-
width: 160px;
|
|
10
|
-
margin: 6px 10px;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
align-items: center;
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
const ButtonWrapper = styled.div`
|
|
17
|
-
margin-bottom: 8px;
|
|
18
|
-
width: 100%;
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
interface Props {
|
|
22
|
-
copyPageUrlLink?: string;
|
|
23
|
-
licenseBox?: ReactNode;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const ArticleSideBar = ({ copyPageUrlLink, licenseBox }: Props) => {
|
|
27
|
-
const { t } = useTranslation();
|
|
28
|
-
const copyLinkHandler = () => {
|
|
29
|
-
if (copyPageUrlLink) {
|
|
30
|
-
copyTextToClipboard(copyPageUrlLink);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Wrapper>
|
|
36
|
-
{copyPageUrlLink && (
|
|
37
|
-
<ButtonWrapper>
|
|
38
|
-
<CopyButton
|
|
39
|
-
onClick={copyLinkHandler}
|
|
40
|
-
size="small"
|
|
41
|
-
variant="outline"
|
|
42
|
-
aria-live="assertive"
|
|
43
|
-
copyNode={t('article.copyPageLinkCopied')}
|
|
44
|
-
data-copy-string={copyPageUrlLink}
|
|
45
|
-
>
|
|
46
|
-
{t('article.copyPageLink')}
|
|
47
|
-
</CopyButton>
|
|
48
|
-
</ButtonWrapper>
|
|
49
|
-
)}
|
|
50
|
-
{licenseBox && (
|
|
51
|
-
<Modal
|
|
52
|
-
activateButton={
|
|
53
|
-
<ButtonV2 size="small" variant="outline">
|
|
54
|
-
{t('article.useContent')}
|
|
55
|
-
</ButtonV2>
|
|
56
|
-
}
|
|
57
|
-
size="normal"
|
|
58
|
-
>
|
|
59
|
-
{(onClose: () => void) => (
|
|
60
|
-
<>
|
|
61
|
-
<ModalHeader>
|
|
62
|
-
<ModalCloseButton onClick={onClose} title={t('article.closeLabel')} />
|
|
63
|
-
</ModalHeader>
|
|
64
|
-
<ModalBody>{licenseBox}</ModalBody>
|
|
65
|
-
</>
|
|
66
|
-
)}
|
|
67
|
-
</Modal>
|
|
68
|
-
)}
|
|
69
|
-
</Wrapper>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export default ArticleSideBar;
|