@ndla/ui 3.2.1 → 3.2.5
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/ArticleAuthorContent.js +1 -2
- package/es/Article/ArticleSideBar.js +42 -14
- package/es/BackgroundImage/BackgroundImage.js +27 -0
- package/es/BackgroundImage/index.js +2 -0
- package/es/ContentLoader/index.js +83 -0
- package/es/Dialog/Dialog.js +64 -0
- package/es/Dialog/index.js +10 -0
- package/es/FactBox/FactBox.js +7 -11
- package/es/Figure/Figure.js +97 -0
- package/es/Figure/FigureExpandButton.js +28 -0
- package/es/Figure/FigureLicense.js +54 -0
- package/es/Figure/FigureLicenseDialog.js +43 -0
- package/es/Figure/index.js +12 -0
- package/es/FileList/File.js +48 -0
- package/es/FileList/FileList.js +20 -0
- package/es/FileList/index.js +3 -0
- package/es/Hero/Hero.js +64 -0
- package/es/Hero/index.js +8 -0
- package/es/Image/Image.js +96 -0
- package/es/Image/ImageLink.js +46 -0
- package/es/Image/LazyLoadImage.js +47 -0
- package/es/Image/index.js +11 -0
- package/es/InfoBox/InfoBox.js +11 -0
- package/es/InfoBox/index.js +1 -0
- package/es/InfoWidget/InfoWidget.js +57 -0
- package/es/InfoWidget/index.js +2 -0
- package/es/Logo/Logo.js +51 -0
- package/es/Logo/SvgLogo.js +54 -0
- package/es/Logo/index.js +9 -0
- package/es/Masthead/Masthead.js +67 -0
- package/es/Masthead/index.js +10 -0
- package/es/NoContentBox/NoContentBox.js +26 -0
- package/es/NoContentBox/index.js +9 -0
- package/es/Portrait/Portrait.js +30 -0
- package/es/Portrait/index.js +9 -0
- package/es/RelatedArticleList/RelatedArticleList.js +4 -23
- package/es/ResourcesWrapper/ResourcesTitle.js +0 -4
- package/es/ResourcesWrapper/ResourcesTopicTitle.js +12 -25
- package/es/ResourcesWrapper/ResourcesWrapper.js +2 -11
- package/es/Topic/Topic.js +21 -22
- package/es/Translation/Translation.js +22 -0
- package/es/Translation/TranslationBox.js +17 -0
- package/es/Translation/TranslationLine.js +37 -0
- package/es/Translation/index.js +3 -0
- package/es/index-javascript.js +1 -19
- package/es/index.js +18 -0
- package/es/locale/messages-en.js +4 -0
- package/es/locale/messages-nb.js +5 -1
- package/es/locale/messages-nn.js +5 -1
- package/lib/Article/ArticleSideBar.d.ts +2 -1
- package/lib/Article/ArticleSideBar.js +43 -14
- package/lib/BackgroundImage/BackgroundImage.js +40 -0
- package/lib/BackgroundImage/index.js +13 -0
- package/lib/ContentLoader/index.js +88 -0
- package/lib/Dialog/Dialog.d.ts +1 -1
- package/lib/Dialog/Dialog.js +70 -0
- package/lib/Dialog/index.js +24 -0
- package/lib/FactBox/FactBox.d.ts +16 -0
- package/lib/FactBox/FactBox.js +5 -11
- package/lib/FactBox/index.d.ts +2 -0
- package/lib/Figure/Figure.d.ts +3 -4
- package/lib/Figure/Figure.js +109 -0
- package/lib/Figure/FigureExpandButton.js +41 -0
- package/lib/Figure/FigureLicense.js +66 -0
- package/lib/Figure/FigureLicenseDialog.js +48 -0
- package/lib/Figure/index.js +49 -0
- package/lib/FileList/File.js +63 -0
- package/lib/FileList/FileList.js +34 -0
- package/lib/FileList/index.js +21 -0
- package/lib/Hero/Hero.d.ts +2 -1
- package/lib/Hero/Hero.js +100 -0
- package/lib/Hero/index.d.ts +1 -0
- package/lib/Hero/index.js +55 -0
- package/lib/Image/Image.d.ts +10 -1
- package/lib/Image/Image.js +105 -0
- package/lib/Image/ImageLink.d.ts +1 -1
- package/lib/Image/ImageLink.js +50 -0
- package/lib/Image/LazyLoadImage.js +51 -0
- package/lib/Image/index.d.ts +1 -0
- package/lib/Image/index.js +38 -0
- package/lib/InfoBox/InfoBox.js +24 -0
- package/lib/InfoBox/index.js +15 -0
- package/lib/InfoWidget/InfoWidget.js +73 -0
- package/lib/InfoWidget/index.js +13 -0
- package/lib/Logo/Logo.js +70 -0
- package/lib/Logo/SvgLogo.js +59 -0
- package/lib/Logo/index.js +20 -0
- package/lib/Masthead/Masthead.js +82 -0
- package/lib/Masthead/index.js +30 -0
- package/lib/NoContentBox/NoContentBox.js +43 -0
- package/lib/NoContentBox/index.js +20 -0
- package/lib/Portrait/Portrait.js +43 -0
- package/lib/Portrait/index.js +20 -0
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +25 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +2 -23
- package/lib/RelatedArticleList/index.d.ts +10 -0
- package/lib/ResourcesWrapper/ResourcesTitle.d.ts +13 -0
- package/lib/ResourcesWrapper/ResourcesTitle.js +0 -5
- package/lib/ResourcesWrapper/ResourcesTopicTitle.d.ts +13 -0
- package/lib/ResourcesWrapper/ResourcesTopicTitle.js +11 -26
- package/lib/ResourcesWrapper/ResourcesWrapper.d.ts +18 -0
- package/lib/ResourcesWrapper/ResourcesWrapper.js +2 -12
- package/lib/ResourcesWrapper/index.d.ts +11 -0
- package/lib/Topic/Topic.d.ts +1 -1
- package/lib/Topic/Topic.js +20 -20
- package/lib/Translation/Translation.js +35 -0
- package/lib/Translation/TranslationBox.d.ts +1 -1
- package/lib/Translation/TranslationBox.js +29 -0
- package/lib/Translation/TranslationLine.js +42 -0
- package/lib/Translation/index.js +31 -0
- package/lib/index-javascript.js +0 -250
- package/lib/index.d.ts +4 -0
- package/lib/index.js +286 -0
- package/lib/locale/messages-en.js +4 -0
- package/lib/locale/messages-nb.js +5 -1
- package/lib/locale/messages-nn.js +5 -1
- package/lib/types.d.ts +0 -10
- package/lib/utils/createUniversalPortal.d.ts +9 -0
- package/package.json +6 -6
- package/src/Article/ArticleSideBar.tsx +31 -3
- package/src/FactBox/{FactBox.jsx → FactBox.tsx} +12 -14
- package/src/FactBox/{index.js → index.ts} +0 -0
- package/src/Figure/Figure.tsx +7 -4
- package/src/Figure/FigureLicense.tsx +1 -1
- package/src/Hero/Hero.tsx +14 -12
- package/src/Hero/index.ts +2 -0
- package/src/Image/Image.tsx +11 -1
- package/src/Image/ImageLink.tsx +1 -1
- package/src/Image/index.ts +1 -0
- package/src/RelatedArticleList/{RelatedArticleList.jsx → RelatedArticleList.tsx} +43 -30
- package/src/RelatedArticleList/{index.js → index.ts} +0 -0
- package/src/ResourcesWrapper/{ResourcesTitle.jsx → ResourcesTitle.tsx} +5 -7
- package/src/ResourcesWrapper/{ResourcesTopicTitle.jsx → ResourcesTopicTitle.tsx} +23 -22
- package/src/ResourcesWrapper/{ResourcesWrapper.jsx → ResourcesWrapper.tsx} +9 -14
- package/src/ResourcesWrapper/{index.js → index.ts} +0 -0
- package/src/Topic/Topic.tsx +1 -3
- package/src/Translation/TranslationBox.tsx +1 -1
- package/src/index-javascript.js +0 -4
- package/src/index.ts +8 -0
- package/src/types.ts +0 -12
- package/src/utils/{createUniversalPortal.jsx → createUniversalPortal.tsx} +3 -3
package/src/Hero/Hero.tsx
CHANGED
|
@@ -16,20 +16,22 @@ const classes = new BEMHelper({
|
|
|
16
16
|
prefix: 'c-',
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
export type HeroContentType =
|
|
20
|
+
| 'subject-material'
|
|
21
|
+
| 'tasks-and-activities'
|
|
22
|
+
| 'assessment-resources'
|
|
23
|
+
| 'subject'
|
|
24
|
+
| 'external-learning-resources'
|
|
25
|
+
| 'source-material'
|
|
26
|
+
| 'learning-path'
|
|
27
|
+
| 'topic'
|
|
28
|
+
| 'beta'
|
|
29
|
+
| 'ndla-film'
|
|
30
|
+
| 'ndla-film has-image';
|
|
31
|
+
|
|
19
32
|
interface HeroProps {
|
|
20
33
|
children?: ReactNode;
|
|
21
|
-
contentType
|
|
22
|
-
| 'subject-material'
|
|
23
|
-
| 'tasks-and-activities'
|
|
24
|
-
| 'assessment-resources'
|
|
25
|
-
| 'subject'
|
|
26
|
-
| 'external-learning-resources'
|
|
27
|
-
| 'source-material'
|
|
28
|
-
| 'learning-path'
|
|
29
|
-
| 'topic'
|
|
30
|
-
| 'beta'
|
|
31
|
-
| 'ndla-film'
|
|
32
|
-
| 'ndla-film has-image';
|
|
34
|
+
contentType?: HeroContentType;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export const Hero = ({ children, contentType }: HeroProps) => (
|
package/src/Hero/index.ts
CHANGED
package/src/Image/Image.tsx
CHANGED
|
@@ -10,7 +10,17 @@ import React, { ReactNode } from 'react';
|
|
|
10
10
|
import defined from 'defined';
|
|
11
11
|
import styled from '@emotion/styled';
|
|
12
12
|
import LazyLoadImage from './LazyLoadImage';
|
|
13
|
-
|
|
13
|
+
export interface ImageCrop {
|
|
14
|
+
startX: number;
|
|
15
|
+
startY: number;
|
|
16
|
+
endX: number;
|
|
17
|
+
endY: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ImageFocalPoint {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
}
|
|
14
24
|
|
|
15
25
|
export const makeSrcQueryString = (width: number | undefined, crop?: ImageCrop, focalPoint?: ImageFocalPoint) => {
|
|
16
26
|
const widthParams = width && `width=${width}`;
|
package/src/Image/ImageLink.tsx
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import React, { ReactNode } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { makeSrcQueryString } from './Image';
|
|
12
|
-
import { ImageCrop, ImageFocalPoint } from '
|
|
12
|
+
import { ImageCrop, ImageFocalPoint } from '.';
|
|
13
13
|
|
|
14
14
|
const StyledLink = styled.a`
|
|
15
15
|
box-shadow: inset 0 0;
|
package/src/Image/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { cloneElement } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { cloneElement, ReactElement } from 'react';
|
|
3
2
|
import BEMHelper from 'react-bem-helper';
|
|
3
|
+
//@ts-ignore
|
|
4
4
|
import Button from '@ndla/button';
|
|
5
5
|
import SafeLink from '@ndla/safelink';
|
|
6
6
|
import SectionHeading from '../SectionHeading';
|
|
@@ -10,14 +10,32 @@ const classes = new BEMHelper({
|
|
|
10
10
|
prefix: 'c-',
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
interface RelatedArticleProps {
|
|
14
|
+
icon: ReactElement;
|
|
15
|
+
title: string;
|
|
16
|
+
modifier?: string;
|
|
17
|
+
introduction: string;
|
|
18
|
+
to: string;
|
|
19
|
+
linkInfo?: string;
|
|
20
|
+
target?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const RelatedArticle = ({
|
|
24
|
+
title,
|
|
25
|
+
introduction,
|
|
26
|
+
icon,
|
|
27
|
+
modifier,
|
|
28
|
+
to,
|
|
29
|
+
linkInfo = '',
|
|
30
|
+
target = '',
|
|
31
|
+
}: RelatedArticleProps) => {
|
|
14
32
|
const iconWithClass = cloneElement(icon, { className: 'c-icon--medium' });
|
|
15
33
|
return (
|
|
16
34
|
<article {...classes('item', modifier)}>
|
|
17
35
|
<h1 {...classes('title')}>
|
|
18
36
|
{iconWithClass}
|
|
19
37
|
<span {...classes('link-wrapper')}>
|
|
20
|
-
<SafeLink to={to} {...classes('link')} target={target} rel={linkInfo ? 'noopener noreferrer' :
|
|
38
|
+
<SafeLink to={to} {...classes('link')} target={target} rel={linkInfo ? 'noopener noreferrer' : undefined}>
|
|
21
39
|
{title}
|
|
22
40
|
</SafeLink>
|
|
23
41
|
</span>
|
|
@@ -28,24 +46,27 @@ export const RelatedArticle = ({ title, introduction, icon, modifier, to, linkIn
|
|
|
28
46
|
);
|
|
29
47
|
};
|
|
30
48
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
interface Props {
|
|
50
|
+
messages: {
|
|
51
|
+
title: string;
|
|
52
|
+
showMore: string;
|
|
53
|
+
showLess: string;
|
|
54
|
+
};
|
|
55
|
+
children?: ReactElement;
|
|
56
|
+
dangerouslySetInnerHTML?: {
|
|
57
|
+
__html: string;
|
|
58
|
+
};
|
|
59
|
+
articleCount?: number;
|
|
60
|
+
}
|
|
61
|
+
const RelatedArticleList = ({ messages, children, articleCount, dangerouslySetInnerHTML }: Props) => {
|
|
62
|
+
const clonedChildren =
|
|
63
|
+
!dangerouslySetInnerHTML && children
|
|
64
|
+
? React.Children.map(children, (article, i) =>
|
|
65
|
+
React.cloneElement(article, {
|
|
66
|
+
modifier: i >= 2 ? `${article.props.modifier} hidden` : article.props.modifier,
|
|
67
|
+
}),
|
|
68
|
+
)
|
|
69
|
+
: null;
|
|
49
70
|
const childrenCount = articleCount || React.Children.count(children);
|
|
50
71
|
|
|
51
72
|
return (
|
|
@@ -67,12 +88,4 @@ const RelatedArticleList = ({ messages, children, articleCount, dangerouslySetIn
|
|
|
67
88
|
);
|
|
68
89
|
};
|
|
69
90
|
|
|
70
|
-
RelatedArticleList.propTypes = {
|
|
71
|
-
children: PropTypes.node,
|
|
72
|
-
messages: PropTypes.shape({ title: PropTypes.string.isRequired }),
|
|
73
|
-
dangerouslySetInnerHTML: PropTypes.shape({
|
|
74
|
-
__html: PropTypes.string.isRequired,
|
|
75
|
-
}),
|
|
76
|
-
articleCount: PropTypes.number,
|
|
77
|
-
};
|
|
78
91
|
export default RelatedArticleList;
|
|
File without changes
|
|
@@ -6,20 +6,18 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
9
|
+
import React, { ReactNode } from 'react';
|
|
11
10
|
import { classes } from './ResourcesWrapper';
|
|
12
11
|
import { SubjectBadge } from '../ContentTypeBadge';
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
interface Props {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
const ResourceTitle = ({ children }: Props) => (
|
|
15
17
|
<div {...classes('title-wrapper')}>
|
|
16
18
|
<SubjectBadge size="large" background />
|
|
17
19
|
<h1 {...classes('title')}>{children}</h1>
|
|
18
20
|
</div>
|
|
19
21
|
);
|
|
20
22
|
|
|
21
|
-
ResourceTitle.propTypes = {
|
|
22
|
-
children: PropTypes.node.isRequired,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
23
|
export default ResourceTitle;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { Fragment } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { Fragment, ReactNode } from 'react';
|
|
3
2
|
import { css } from '@emotion/core';
|
|
4
3
|
import styled from '@emotion/styled';
|
|
5
4
|
import { spacing } from '@ndla/core';
|
|
6
5
|
import { HelpCircleDual } from '@ndla/icons/common';
|
|
6
|
+
//@ts-ignore
|
|
7
7
|
import Modal, { ModalBody, ModalHeader, ModalCloseButton } from '@ndla/modal';
|
|
8
8
|
import Tooltip from '@ndla/tooltip';
|
|
9
9
|
import { Switch } from '@ndla/switch';
|
|
@@ -11,7 +11,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
11
11
|
|
|
12
12
|
import { classes } from './ResourcesWrapper';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
interface HelpIconProps {
|
|
15
|
+
invertedStyle: boolean;
|
|
16
|
+
}
|
|
17
|
+
const HelpIcon = ({ invertedStyle }: HelpIconProps) => (
|
|
15
18
|
<div {...classes('topic-title-icon', { invertedStyle })}>
|
|
16
19
|
<HelpCircleDual className={`c-icon--22 u-margin-left-tiny ${classes('icon').className}`} />
|
|
17
20
|
</div>
|
|
@@ -37,14 +40,25 @@ const TooltipButton = styled.button`
|
|
|
37
40
|
cursor: pointer;
|
|
38
41
|
`;
|
|
39
42
|
|
|
43
|
+
interface Props {
|
|
44
|
+
title?: string;
|
|
45
|
+
toggleAdditionalResources: () => void;
|
|
46
|
+
hasAdditionalResources: boolean;
|
|
47
|
+
showAdditionalResources: boolean;
|
|
48
|
+
invertedStyle?: boolean;
|
|
49
|
+
messages: {
|
|
50
|
+
label: string;
|
|
51
|
+
additionalFilterLabel: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
40
54
|
const ResourcesTopicTitle = ({
|
|
41
55
|
title,
|
|
42
56
|
hasAdditionalResources,
|
|
43
57
|
toggleAdditionalResources,
|
|
44
58
|
showAdditionalResources,
|
|
45
59
|
messages,
|
|
46
|
-
invertedStyle,
|
|
47
|
-
}) => {
|
|
60
|
+
invertedStyle = false,
|
|
61
|
+
}: Props) => {
|
|
48
62
|
const { t } = useTranslation();
|
|
49
63
|
// Fix for heading while title not required when ready.
|
|
50
64
|
let heading;
|
|
@@ -70,7 +84,7 @@ const ResourcesTopicTitle = ({
|
|
|
70
84
|
/>
|
|
71
85
|
<Modal
|
|
72
86
|
narrow
|
|
73
|
-
wrapperFunctionForButton={(activateButton) => (
|
|
87
|
+
wrapperFunctionForButton={(activateButton: ReactNode) => (
|
|
74
88
|
<TooltipWrapper>
|
|
75
89
|
<Tooltip tooltip={t('resource.dialogTooltip')}>{activateButton}</Tooltip>
|
|
76
90
|
</TooltipWrapper>
|
|
@@ -80,8 +94,8 @@ const ResourcesTopicTitle = ({
|
|
|
80
94
|
<HelpIcon invertedStyle={invertedStyle} />
|
|
81
95
|
</TooltipButton>
|
|
82
96
|
}>
|
|
83
|
-
{(onClose) => (
|
|
84
|
-
|
|
97
|
+
{(onClose: () => void) => (
|
|
98
|
+
<>
|
|
85
99
|
<ModalHeader>
|
|
86
100
|
<ModalCloseButton title={t('modal.closeModal')} onClick={onClose} />
|
|
87
101
|
</ModalHeader>
|
|
@@ -91,7 +105,7 @@ const ResourcesTopicTitle = ({
|
|
|
91
105
|
<p>{t('resource.dialogText1')}</p>
|
|
92
106
|
<p>{t('resource.dialogText2')}</p>
|
|
93
107
|
</ModalBody>
|
|
94
|
-
|
|
108
|
+
</>
|
|
95
109
|
)}
|
|
96
110
|
</Modal>
|
|
97
111
|
</div>
|
|
@@ -100,17 +114,4 @@ const ResourcesTopicTitle = ({
|
|
|
100
114
|
);
|
|
101
115
|
};
|
|
102
116
|
|
|
103
|
-
/* eslint-disable no-console */
|
|
104
|
-
ResourcesTopicTitle.propTypes = {
|
|
105
|
-
title: PropTypes.string, // Should be required
|
|
106
|
-
toggleAdditionalResources: PropTypes.func.isRequired,
|
|
107
|
-
hasAdditionalResources: PropTypes.bool.isRequired,
|
|
108
|
-
showAdditionalResources: PropTypes.bool.isRequired,
|
|
109
|
-
invertedStyle: PropTypes.bool,
|
|
110
|
-
messages: PropTypes.shape({
|
|
111
|
-
label: PropTypes.string.isRequired,
|
|
112
|
-
additionalFilterLabel: PropTypes.string.isRequired,
|
|
113
|
-
}).isRequired,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
117
|
export default ResourcesTopicTitle;
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
9
|
+
import React, { ReactNode } from 'react';
|
|
11
10
|
import BEMHelper from 'react-bem-helper';
|
|
12
11
|
|
|
13
12
|
export const classes = new BEMHelper({
|
|
@@ -15,22 +14,18 @@ export const classes = new BEMHelper({
|
|
|
15
14
|
prefix: 'c-',
|
|
16
15
|
});
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
interface Props {
|
|
18
|
+
header?: ReactNode;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
subjectPage?: boolean;
|
|
21
|
+
id?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const ResourcesWrapper = ({ children, header, subjectPage = false, id }: Props) => (
|
|
19
25
|
<section {...classes('', { subjectPage })} id={id}>
|
|
20
26
|
{header}
|
|
21
27
|
<div {...classes('content')}>{children}</div>
|
|
22
28
|
</section>
|
|
23
29
|
);
|
|
24
30
|
|
|
25
|
-
ResourcesWrapper.propTypes = {
|
|
26
|
-
header: PropTypes.node,
|
|
27
|
-
children: PropTypes.node.isRequired,
|
|
28
|
-
subjectPage: PropTypes.bool,
|
|
29
|
-
id: PropTypes.string,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
ResourcesWrapper.defaultProps = {
|
|
33
|
-
subjectPage: false,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
31
|
export default ResourcesWrapper;
|
|
File without changes
|
package/src/Topic/Topic.tsx
CHANGED
|
@@ -22,9 +22,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
22
22
|
import Loader from './Loader';
|
|
23
23
|
import { ItemProps } from '../Navigation/NavigationBox';
|
|
24
24
|
import { NavigationBox } from '../Navigation';
|
|
25
|
-
|
|
26
|
-
import { makeSrcQueryString } from '../Image';
|
|
27
|
-
import { ImageCrop, ImageFocalPoint } from '../types';
|
|
25
|
+
import { makeSrcQueryString, ImageCrop, ImageFocalPoint } from '../Image';
|
|
28
26
|
|
|
29
27
|
type InvertItProps = {
|
|
30
28
|
invertedStyle?: boolean;
|
package/src/index-javascript.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
export { default as Table } from './Table';
|
|
10
10
|
export { FilterList, FilterListPhone, FilterButtons } from './Filter';
|
|
11
|
-
export { default as FactBox } from './FactBox';
|
|
12
11
|
|
|
13
12
|
export {
|
|
14
13
|
SearchOverlay,
|
|
@@ -35,10 +34,8 @@ export {
|
|
|
35
34
|
ExternalLearningResourcesBadge,
|
|
36
35
|
SourceMaterialBadge,
|
|
37
36
|
} from './ContentTypeBadge';
|
|
38
|
-
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
39
37
|
export { default as TopicIntroductionList } from './TopicIntroductionList';
|
|
40
38
|
export { default as TopicMenu, TopicMenuButton } from './TopicMenu';
|
|
41
|
-
export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
|
|
42
39
|
export {
|
|
43
40
|
default as CompetenceGoals,
|
|
44
41
|
CompetenceGoalList,
|
|
@@ -47,7 +44,6 @@ export {
|
|
|
47
44
|
CompetenceGoalsDialog,
|
|
48
45
|
} from './CompetenceGoals';
|
|
49
46
|
|
|
50
|
-
export { default as ResourcesWrapper, ResourcesTitle, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
51
47
|
export {
|
|
52
48
|
MediaList,
|
|
53
49
|
MediaListItem,
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,10 @@ export {
|
|
|
24
24
|
default as Article,
|
|
25
25
|
} from './Article';
|
|
26
26
|
|
|
27
|
+
export { default as ResourcesWrapper, ResourcesTitle, ResourcesTopicTitle } from './ResourcesWrapper';
|
|
28
|
+
|
|
29
|
+
export { createUniversalPortal } from './utils/createUniversalPortal';
|
|
30
|
+
|
|
27
31
|
export { default as NoContentBox } from './NoContentBox';
|
|
28
32
|
|
|
29
33
|
export { default as Masthead, MastheadItem } from './Masthead';
|
|
@@ -32,6 +36,8 @@ export { default as Portrait } from './Portrait';
|
|
|
32
36
|
|
|
33
37
|
export { default as ContentLoader } from './ContentLoader';
|
|
34
38
|
|
|
39
|
+
export { default as RelatedArticleList, RelatedArticle } from './RelatedArticleList';
|
|
40
|
+
|
|
35
41
|
export { ErrorResourceAccessDenied, default as ErrorMessage } from './ErrorMessage';
|
|
36
42
|
|
|
37
43
|
export { default as FileList, File } from './FileList';
|
|
@@ -55,6 +61,8 @@ export {
|
|
|
55
61
|
FrontpageProgramMenu,
|
|
56
62
|
} from './Frontpage';
|
|
57
63
|
|
|
64
|
+
export { default as FactBox } from './FactBox';
|
|
65
|
+
|
|
58
66
|
export { default as Image, ImageLink } from './Image';
|
|
59
67
|
export { makeSrcQueryString } from './Image';
|
|
60
68
|
|
package/src/types.ts
CHANGED
|
@@ -45,18 +45,6 @@ export interface License {
|
|
|
45
45
|
license: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export interface ImageCrop {
|
|
49
|
-
startX: number;
|
|
50
|
-
startY: number;
|
|
51
|
-
endX: number;
|
|
52
|
-
endY: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ImageFocalPoint {
|
|
56
|
-
x: number;
|
|
57
|
-
y: number;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
48
|
export interface Copyright {
|
|
61
49
|
license: License;
|
|
62
50
|
creators: Array<Contributor>;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
// N.B This helper is intended to be used in https://github.com/ndlano/article-converter. It is not a general soultion for using portals in SSR applications.
|
|
10
10
|
|
|
11
|
-
import React from 'react';
|
|
11
|
+
import React, { ReactNode } from 'react';
|
|
12
12
|
import ReactDOM from 'react-dom';
|
|
13
13
|
|
|
14
14
|
function canUseDOM() {
|
|
@@ -20,9 +20,9 @@ function canUseDOM() {
|
|
|
20
20
|
); // window.document.hidden === jsdom check
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export function createUniversalPortal(children, selector) {
|
|
23
|
+
export function createUniversalPortal(children: ReactNode, selector: string) {
|
|
24
24
|
if (!canUseDOM()) {
|
|
25
25
|
return <div data-react-universal-portal>{children}</div>;
|
|
26
26
|
}
|
|
27
|
-
return ReactDOM.createPortal(children, document.querySelector(selector));
|
|
27
|
+
return ReactDOM.createPortal(children, document.querySelector(selector) as Element);
|
|
28
28
|
}
|