@ndla/ui 45.0.16 → 46.0.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.
Files changed (99) hide show
  1. package/es/Article/Article.js +3 -3
  2. package/es/AudioPlayer/index.js +0 -2
  3. package/es/Embed/conceptComponents.js +15 -8
  4. package/es/Figure/Figure.js +11 -89
  5. package/es/Figure/index.js +1 -3
  6. package/es/Notion/index.js +1 -3
  7. package/es/all.css +1 -1
  8. package/es/index.js +3 -4
  9. package/es/locale/messages-en.js +7 -2
  10. package/es/locale/messages-nb.js +7 -2
  11. package/es/locale/messages-nn.js +7 -2
  12. package/es/locale/messages-se.js +7 -2
  13. package/es/locale/messages-sma.js +7 -2
  14. package/lib/Article/Article.js +3 -3
  15. package/lib/AudioPlayer/index.d.ts +0 -2
  16. package/lib/AudioPlayer/index.js +0 -7
  17. package/lib/Embed/conceptComponents.js +17 -10
  18. package/lib/Figure/Figure.d.ts +0 -38
  19. package/lib/Figure/Figure.js +20 -96
  20. package/lib/Figure/index.d.ts +1 -3
  21. package/lib/Figure/index.js +2 -17
  22. package/lib/Notion/index.d.ts +0 -4
  23. package/lib/Notion/index.js +0 -14
  24. package/lib/all.css +1 -1
  25. package/lib/index.d.ts +3 -5
  26. package/lib/index.js +1 -32
  27. package/lib/locale/messages-en.d.ts +5 -0
  28. package/lib/locale/messages-en.js +7 -2
  29. package/lib/locale/messages-nb.d.ts +5 -0
  30. package/lib/locale/messages-nb.js +7 -2
  31. package/lib/locale/messages-nn.d.ts +5 -0
  32. package/lib/locale/messages-nn.js +7 -2
  33. package/lib/locale/messages-se.d.ts +5 -0
  34. package/lib/locale/messages-se.js +7 -2
  35. package/lib/locale/messages-sma.d.ts +5 -0
  36. package/lib/locale/messages-sma.js +7 -2
  37. package/package.json +18 -22
  38. package/src/Article/Article.tsx +1 -1
  39. package/src/AudioPlayer/AudiPlayer.stories.tsx +88 -0
  40. package/src/AudioPlayer/index.ts +0 -2
  41. package/src/Embed/IframeEmbed.stories.tsx +15 -0
  42. package/src/Embed/ImageEmbed.stories.tsx +169 -2
  43. package/src/Embed/RelatedContentEmbed.stories.tsx +438 -0
  44. package/src/Embed/conceptComponents.tsx +13 -1
  45. package/src/Figure/Figure.tsx +1 -120
  46. package/src/Figure/index.ts +1 -3
  47. package/src/Notion/index.ts +0 -4
  48. package/src/index.ts +3 -13
  49. package/src/locale/messages-en.ts +7 -2
  50. package/src/locale/messages-nb.ts +7 -2
  51. package/src/locale/messages-nn.ts +7 -2
  52. package/src/locale/messages-se.ts +7 -2
  53. package/src/locale/messages-sma.ts +7 -2
  54. package/src/main.scss +0 -1
  55. package/es/Animation/Fade.js +0 -62
  56. package/es/Animation/index.js +0 -1
  57. package/es/AudioPlayer/initAudioPlayers.js +0 -60
  58. package/es/Dialog/Dialog.js +0 -70
  59. package/es/Dialog/index.js +0 -11
  60. package/es/Figure/FigureLicense.js +0 -72
  61. package/es/Figure/FigureLicenseDialog.js +0 -54
  62. package/es/Notion/ConceptNotion.js +0 -135
  63. package/es/Notion/FigureNotion.js +0 -93
  64. package/es/Notion/NotionVisualElement.js +0 -68
  65. package/es/utils/createUniversalPortal.js +0 -25
  66. package/lib/Animation/Fade.d.ts +0 -17
  67. package/lib/Animation/Fade.js +0 -70
  68. package/lib/Animation/index.d.ts +0 -1
  69. package/lib/Animation/index.js +0 -13
  70. package/lib/AudioPlayer/initAudioPlayers.d.ts +0 -11
  71. package/lib/AudioPlayer/initAudioPlayers.js +0 -69
  72. package/lib/Dialog/Dialog.d.ts +0 -23
  73. package/lib/Dialog/Dialog.js +0 -75
  74. package/lib/Dialog/index.d.ts +0 -10
  75. package/lib/Dialog/index.js +0 -22
  76. package/lib/Figure/FigureLicense.d.ts +0 -33
  77. package/lib/Figure/FigureLicense.js +0 -76
  78. package/lib/Figure/FigureLicenseDialog.d.ts +0 -29
  79. package/lib/Figure/FigureLicenseDialog.js +0 -57
  80. package/lib/Notion/ConceptNotion.d.ts +0 -24
  81. package/lib/Notion/ConceptNotion.js +0 -141
  82. package/lib/Notion/FigureNotion.d.ts +0 -27
  83. package/lib/Notion/FigureNotion.js +0 -97
  84. package/lib/Notion/NotionVisualElement.d.ts +0 -22
  85. package/lib/Notion/NotionVisualElement.js +0 -75
  86. package/lib/utils/createUniversalPortal.d.ts +0 -9
  87. package/lib/utils/createUniversalPortal.js +0 -32
  88. package/src/Animation/Fade.tsx +0 -46
  89. package/src/Animation/index.ts +0 -1
  90. package/src/AudioPlayer/initAudioPlayers.tsx +0 -57
  91. package/src/Dialog/Dialog.tsx +0 -80
  92. package/src/Dialog/component.dialog.scss +0 -144
  93. package/src/Dialog/index.ts +0 -13
  94. package/src/Figure/FigureLicense.tsx +0 -75
  95. package/src/Figure/FigureLicenseDialog.tsx +0 -51
  96. package/src/Notion/ConceptNotion.tsx +0 -170
  97. package/src/Notion/FigureNotion.tsx +0 -104
  98. package/src/Notion/NotionVisualElement.tsx +0 -80
  99. package/src/utils/createUniversalPortal.tsx +0 -23
@@ -1,22 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { Copyright } from '../types';
3
- export type NotionVisualElementType = {
4
- element?: ReactNode;
5
- type?: 'video' | 'image' | 'h5p' | 'iframe';
6
- resource?: string;
7
- title?: string;
8
- url?: string;
9
- copyright?: Partial<Copyright>;
10
- image?: {
11
- src: string;
12
- alt?: string;
13
- };
14
- licenseButtons?: ReactNode;
15
- };
16
- interface Props {
17
- visualElement: NotionVisualElementType;
18
- id: string;
19
- figureId: string;
20
- }
21
- declare const NotionVisualElement: ({ visualElement, id, figureId }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
22
- export default NotionVisualElement;
@@ -1,75 +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 = require("@emotion/react");
9
- var _FigureNotion = _interopRequireDefault(require("./FigureNotion"));
10
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- 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)."; } /**
13
- * Copyright (c) 2022-present, NDLA.
14
- *
15
- * This source code is licensed under the GPLv3 license found in the
16
- * LICENSE file in the root directory of this source tree. *
17
- */
18
- var _ref = process.env.NODE_ENV === "production" ? {
19
- name: "1xdnj1g-StyledIframe",
20
- styles: "min-height:400px;label:StyledIframe;"
21
- } : {
22
- name: "1xdnj1g-StyledIframe",
23
- styles: "min-height:400px;label:StyledIframe;",
24
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk5vdGlvblZpc3VhbEVsZW1lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWVXIiwiZmlsZSI6Ik5vdGlvblZpc3VhbEVsZW1lbnQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMjItcHJlc2VudCwgTkRMQS5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBHUEx2MyBsaWNlbnNlIGZvdW5kIGluIHRoZVxuICogTElDRU5TRSBmaWxlIGluIHRoZSByb290IGRpcmVjdG9yeSBvZiB0aGlzIHNvdXJjZSB0cmVlLiAqXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IFJlYWN0Tm9kZSB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCB7IENvcHlyaWdodCB9IGZyb20gJy4uL3R5cGVzJztcbmltcG9ydCB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ICAgICAgICA8U3R5bGVkSWZyYW1lIGFsbG93RnVsbFNjcmVlbiB0eXBlPXt0eXBlfSBzcmM9e3Zpc3VhbEVsZW1lbnQudXJsfSB0aXRsZT17dmlzdWFsRWxlbWVudC50aXRsZX0gLz5cbiAgICAgICl9XG4gICAgPC9GaWd1cmVOb3Rpb24+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBOb3Rpb25WaXN1YWxFbGVtZW50O1xuIl19 */",
25
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
26
- };
27
- var StyledIframe = /*#__PURE__*/(0, _base.default)("iframe", {
28
- target: "e1hql2mu0",
29
- label: "StyledIframe"
30
- })(function (props) {
31
- return props.type === 'video' ? _ref : '';
32
- }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIk5vdGlvblZpc3VhbEVsZW1lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVlvRCIsImZpbGUiOiJOb3Rpb25WaXN1YWxFbGVtZW50LnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIyLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS4gKlxuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgeyBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBDb3B5cmlnaHQgfSBmcm9t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aW1hZ2UuYWx0fSAvPlxuICAgICAgKSA6IChcbiAgICAgICAgPFN0eWxlZElmcmFtZSBhbGxvd0Z1bGxTY3JlZW4gdHlwZT17dHlwZX0gc3JjPXt2aXN1YWxFbGVtZW50LnVybH0gdGl0bGU9e3Zpc3VhbEVsZW1lbnQudGl0bGV9IC8+XG4gICAgICApfVxuICAgIDwvRmlndXJlTm90aW9uPlxuICApO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgTm90aW9uVmlzdWFsRWxlbWVudDtcbiJdfQ== */"));
33
- var supportedEmbedTypes = ['brightcove', 'h5p', 'iframe', 'external', 'image'];
34
- var getType = function getType(resource) {
35
- if (resource === 'brightcove') {
36
- return 'video';
37
- }
38
- if (resource === 'image' || resource === 'h5p') {
39
- return resource;
40
- }
41
- return 'other';
42
- };
43
- var NotionVisualElement = function NotionVisualElement(_ref2) {
44
- var _visualElement$title, _visualElement$copyri, _visualElement$copyri2, _visualElement$copyri3, _visualElement$image, _visualElement$image2;
45
- var visualElement = _ref2.visualElement,
46
- id = _ref2.id,
47
- figureId = _ref2.figureId;
48
- if (!visualElement.resource || !supportedEmbedTypes.includes(visualElement.resource)) {
49
- return (0, _jsxRuntime.jsx)("p", {
50
- children: "Embed type is not supported!"
51
- });
52
- }
53
- var type = getType(visualElement.resource);
54
- return (0, _jsxRuntime.jsx)(_FigureNotion.default, {
55
- resizeIframe: true,
56
- id: id,
57
- figureId: figureId,
58
- title: (_visualElement$title = visualElement.title) !== null && _visualElement$title !== void 0 ? _visualElement$title : '',
59
- copyright: visualElement.copyright,
60
- licenseString: (_visualElement$copyri = (_visualElement$copyri2 = visualElement.copyright) === null || _visualElement$copyri2 === void 0 ? void 0 : (_visualElement$copyri3 = _visualElement$copyri2.license) === null || _visualElement$copyri3 === void 0 ? void 0 : _visualElement$copyri3.license) !== null && _visualElement$copyri !== void 0 ? _visualElement$copyri : '',
61
- licenseButtons: visualElement.licenseButtons,
62
- type: type,
63
- children: (_visualElement$image = visualElement.image) !== null && _visualElement$image !== void 0 && _visualElement$image.src ? (0, _jsxRuntime.jsx)("img", {
64
- src: (_visualElement$image2 = visualElement.image) === null || _visualElement$image2 === void 0 ? void 0 : _visualElement$image2.src,
65
- alt: visualElement.image.alt
66
- }) : (0, _jsxRuntime.jsx)(StyledIframe, {
67
- allowFullScreen: true,
68
- type: type,
69
- src: visualElement.url,
70
- title: visualElement.title
71
- })
72
- });
73
- };
74
- var _default = NotionVisualElement;
75
- exports.default = _default;
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright (c) 2016-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
- import { ReactNode } from 'react';
9
- export declare function createUniversalPortal(children: ReactNode, selector: string): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createUniversalPortal = createUniversalPortal;
7
- var _reactDom = _interopRequireDefault(require("react-dom"));
8
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- /**
11
- * Copyright (c) 2016-present, NDLA.
12
- *
13
- * This source code is licensed under the GPLv3 license found in the
14
- * LICENSE file in the root directory of this source tree.
15
- *
16
- */
17
-
18
- // 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.
19
-
20
- function canUseDOM() {
21
- return !!(typeof window !== 'undefined' && window.document && !window.document.hidden); // window.document.hidden === jsdom check
22
- }
23
-
24
- function createUniversalPortal(children, selector) {
25
- if (!canUseDOM()) {
26
- return (0, _jsxRuntime.jsx)("div", {
27
- "data-react-universal-portal": true,
28
- children: children
29
- });
30
- }
31
- return /*#__PURE__*/_reactDom.default.createPortal(children, document.querySelector(selector));
32
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * Copyright (c) 2022-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 { ReactNode, useMemo } from 'react';
10
- import { AnimatePresence, LazyMotion, m, domAnimation } from 'framer-motion';
11
- import uniqueId from 'lodash/uniqueId';
12
-
13
- interface Props {
14
- children: ReactNode;
15
- delay?: number;
16
- timeout?: number;
17
- exitDelay?: number;
18
- show: boolean;
19
- }
20
-
21
- const animations = (duration: number, delayIn: number, delayOut: number) => ({
22
- open: { opacity: 1, transition: { delay: delayIn / 1000, ease: 'easeInOut', duration: duration / 1000 } },
23
- closed: { opacity: 0, transition: { delay: delayOut / 1000, ease: 'easeInOut', duration: duration / 1000 } },
24
- });
25
-
26
- const defaultTimeout = 300;
27
-
28
- const Fade = ({ show, delay = 0, timeout = defaultTimeout, exitDelay = 0, children }: Props) => {
29
- const id = useMemo(() => uniqueId(), []);
30
-
31
- const variants = useMemo(() => animations(timeout, delay, exitDelay), [timeout, delay, exitDelay]);
32
-
33
- return (
34
- <LazyMotion features={domAnimation}>
35
- <AnimatePresence>
36
- {show && (
37
- <m.div key={id} initial="closed" animate="open" exit="closed" variants={variants}>
38
- {children}
39
- </m.div>
40
- )}
41
- </AnimatePresence>
42
- </LazyMotion>
43
- );
44
- };
45
-
46
- export default Fade;
@@ -1 +0,0 @@
1
- export { default as Fade } from './Fade';
@@ -1,57 +0,0 @@
1
- /**
2
- * Copyright (c) 2021-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 ReactDOM from 'react-dom';
10
- import shave from 'shave';
11
- import Controls from './Controls';
12
- import SpeechControl from './SpeechControl';
13
- import { Locale } from '../types';
14
-
15
- export const truncateDescription = (el: HTMLElement, readMoreLabel: string | null) => {
16
- shave(el, 90, {
17
- character: `... <a href="#" onclick="(function(e){e.preventDefault(); const parentNode = e.target.parentNode; parentNode.nextSibling.style.display = 'inline'; parentNode.remove();return false;})(arguments[0]);return false;">${readMoreLabel}</a>`,
18
- });
19
- };
20
-
21
- const forEachElement = (selector: string, callback: Function) => {
22
- const nodeList = document.querySelectorAll(selector);
23
- for (let i = 0; i < nodeList.length; i += 1) {
24
- callback(nodeList[i], i);
25
- }
26
- };
27
-
28
- const initAudioPlayers = (locale: Locale) => {
29
- forEachElement('[data-audio-player]', (el: HTMLElement) => {
30
- const src = el.getAttribute('data-src');
31
- const title = el.getAttribute('data-title');
32
- const speech = el.getAttribute('data-speech');
33
- if (src && title) {
34
- if (speech) {
35
- // eslint-disable-next-line react/no-deprecated
36
- ReactDOM.hydrate(<SpeechControl src={src} title={title} />, el);
37
- } else {
38
- // eslint-disable-next-line react/no-deprecated
39
- ReactDOM.hydrate(<Controls src={src} title={title} />, el);
40
- }
41
- }
42
- });
43
-
44
- forEachElement('[data-audio-player-description]', (el: HTMLElement) => {
45
- const readMoreLabel = el.getAttribute('data-read-more-text');
46
- truncateDescription(el, readMoreLabel);
47
- });
48
-
49
- forEachElement('[data-audio-text-button-id]', (el: HTMLElement) => {
50
- const id = el.getAttribute('data-audio-text-button-id');
51
- if (id) {
52
- el.onclick = () => document?.getElementById(id)?.toggleAttribute('hidden');
53
- }
54
- });
55
- };
56
-
57
- export default initAudioPlayers;
@@ -1,80 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-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
- // N.B These component is used to render static markup serverside
10
- // Any interactivty is added by scripts located in the ndla-article-scripts package
11
-
12
- import { ReactNode } from 'react';
13
- import BEMHelper from 'react-bem-helper';
14
- import { createUniversalPortal } from '../utils/createUniversalPortal';
15
-
16
- const classes = new BEMHelper({
17
- name: 'dialog',
18
- prefix: 'c-',
19
- });
20
-
21
- interface Props {
22
- id: string;
23
- labelledby?: string;
24
- label?: string;
25
- hidden?: boolean;
26
- children?: ReactNode;
27
- messages?: {
28
- close: string;
29
- };
30
- modifier?: string | string[];
31
- disablePortal?: boolean;
32
- onClose?: () => void;
33
- }
34
-
35
- export const Dialog = ({
36
- children,
37
- messages = { close: 'Lukk' },
38
- id,
39
- labelledby,
40
- label,
41
- modifier,
42
- disablePortal = false,
43
- hidden = true,
44
- onClose,
45
- ...rest
46
- }: Props) => {
47
- const content = (
48
- <div
49
- {...classes('', modifier)}
50
- data-dialog-id={id}
51
- role="dialog"
52
- aria-hidden={hidden}
53
- aria-labelledby={labelledby}
54
- aria-label={label}
55
- {...rest}
56
- >
57
- <div {...classes('content')}>
58
- <button
59
- {...classes('close')}
60
- type="button"
61
- onClick={() => {
62
- if (onClose) {
63
- onClose();
64
- }
65
- }}
66
- >
67
- {messages.close}
68
- </button>
69
- {children}
70
- </div>
71
- <div className="o-backdrop" />
72
- </div>
73
- );
74
-
75
- if (disablePortal) {
76
- return content;
77
- }
78
-
79
- return createUniversalPortal(content, 'body');
80
- };
@@ -1,144 +0,0 @@
1
- .c-dialog {
2
- text-align: left;
3
- position: fixed;
4
- top: 0;
5
- bottom: 0;
6
- left: 0;
7
- right: 0;
8
- display: none;
9
- overflow: auto;
10
- z-index: 9500;
11
- align-items: center;
12
- justify-content: center;
13
- font-family: $font;
14
- .o-backdrop {
15
- display: none;
16
- z-index: 1;
17
- }
18
- &:not(&--large, &--fullscreen) {
19
- h1 {
20
- @include font-size(22px, 26px);
21
- }
22
- }
23
- &--small-heading {
24
- h1 {
25
- @include font-size(22px, 26px);
26
- }
27
- }
28
-
29
- &--active {
30
- display: flex;
31
- .o-backdrop {
32
- display: block;
33
- animation-name: fadeIn;
34
- animation-duration: 0.8s;
35
- }
36
- }
37
-
38
- &__content {
39
- overflow: hidden;
40
- height: 0;
41
- visibility: hidden;
42
- position: relative;
43
- z-index: 2;
44
- color: $primary-color;
45
- @include mq(tablet) {
46
- min-width: 20rem;
47
- }
48
- @include font-size(18px, 1.33);
49
- }
50
-
51
- &--active &__content {
52
- background-color: $brand-color--lighter;
53
- box-shadow: 0 0 30px rgba($black, 0.2);
54
- padding: $spacing--large $spacing;
55
- @include mq($until: tablet) {
56
- padding-left: 20px;
57
- padding-right: 20px;
58
- }
59
- animation-name: zoomIn;
60
- animation-duration: 0.3s;
61
- overflow: auto;
62
- height: 100vh;
63
- width: 100vw;
64
- -webkit-overflow-scrolling: touch;
65
-
66
- @include mq(tablet) {
67
- width: 90%;
68
- max-height: 85vh;
69
- // margin: 0 auto;
70
- padding: $spacing--medium;
71
- max-width: 613px;
72
- min-width: 613px;
73
- width: auto;
74
- opacity: 1;
75
- animation-name: fadeInBottomFixed;
76
- height: auto;
77
- }
78
- visibility: visible;
79
- }
80
-
81
- &--active &__close {
82
- display: block;
83
- float: right;
84
- position: relative;
85
- z-index: 3;
86
- background: transparent;
87
- border: none;
88
- color: $brand-color;
89
- @include font-size(18px, 1.33);
90
- font-weight: $font-weight-normal;
91
- padding: 0;
92
- box-shadow: $link;
93
- height: 25px;
94
- @include mq($until: tablet) {
95
- + * {
96
- margin-top: $spacing--large;
97
- }
98
- }
99
- cursor: pointer;
100
- &:hover {
101
- box-shadow: $link--hover;
102
- }
103
- }
104
-
105
- &--large &__content {
106
- max-width: 970px;
107
- width: 970px;
108
- @include mq($until: 970px) {
109
- max-height: 100vh;
110
- min-height: 100vh;
111
- }
112
- }
113
-
114
- &--medium &__content {
115
- max-width: 790px;
116
- width: 790px;
117
- @include mq($until: 790px) {
118
- max-height: 100vh;
119
- min-height: 100vh;
120
- }
121
- }
122
-
123
- &--fullscreen &__content {
124
- @include mq(tablet) {
125
- height: 100vh;
126
- width: 90vw;
127
- max-width: 90vw;
128
- .c-figure-license__img {
129
- max-height: 85vh;
130
- max-height: 85vh;
131
- width: auto;
132
- margin: auto;
133
- }
134
- }
135
- }
136
- }
137
- /*
138
- Hack for fixing top padding on devices
139
- where had to add position fixed to <html />
140
- to prevent scrolling on background
141
- */
142
- html.scrollFix .c-dialog--active .c-dialog__content {
143
- padding-top: $spacing--large;
144
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-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 { Dialog } from './Dialog';
10
-
11
- export { Dialog };
12
-
13
- export default Dialog;
@@ -1,75 +0,0 @@
1
- /**
2
- * Copyright (c) 2018-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
- // N.B This component is used to render static markup serverside
10
- // Any interactivty is added by scripts located in the ndla-article-scripts package
11
-
12
- import { ReactNode } from 'react';
13
- import BEMHelper from 'react-bem-helper';
14
- import { uuid } from '@ndla/util';
15
- import { LicenseDescription } from '@ndla/notion';
16
- import { FigureLicense } from './Figure';
17
- import { Contributor } from '../types';
18
-
19
- export const classLicenses = new BEMHelper({
20
- name: 'figure-license',
21
- prefix: 'c-',
22
- });
23
-
24
- interface FigureLicenseCtaProps {
25
- children?: ReactNode;
26
- origin?: string;
27
- authors?: Contributor[];
28
- messages: {
29
- source: string;
30
- title: string;
31
- };
32
- title?: string;
33
- }
34
-
35
- export const FigureLicenseCta = ({ children, messages, authors, origin, title }: FigureLicenseCtaProps) => (
36
- <div {...classLicenses('cta-wrapper')}>
37
- <ul {...classLicenses('list')}>
38
- {title && <li {...classLicenses('item')}>{`${messages.title}: ${title}`}</li>}
39
- {authors?.map((author) => (
40
- <li key={uuid()} {...classLicenses('item')}>{`${author.type}: ${author.name}`}</li>
41
- ))}
42
- {origin && (
43
- <li {...classLicenses('item')}>
44
- {messages.source}:{' '}
45
- {origin.startsWith('http') ? (
46
- <a href={origin} target="_blank" rel="noopener noreferrer">
47
- {origin}
48
- </a>
49
- ) : (
50
- origin
51
- )}
52
- </li>
53
- )}
54
- </ul>
55
- <div {...classLicenses('cta-block')}>{children}</div>
56
- </div>
57
- );
58
-
59
- interface Props {
60
- messages: {
61
- modelPremission?: string;
62
- learnAboutLicenses: string;
63
- };
64
- license: FigureLicense;
65
- locale: string;
66
- }
67
-
68
- export const FigureLicenseByline = ({ messages, license, locale }: Props) => (
69
- <>
70
- <LicenseDescription key="byline" highlightCC locale={locale} messages={messages} licenseRights={license.rights} />
71
- <a key="link" {...classLicenses('link')} target="_blank" rel="noopener noreferrer" href={license.url}>
72
- {license.linkText}
73
- </a>
74
- </>
75
- );
@@ -1,51 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-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
- // N.B This component is used to render static markup serverside
10
- // Any interactivty is added by scripts located in the ndla-article-scripts package
11
-
12
- import { ReactNode } from 'react';
13
- import Dialog from '../Dialog';
14
- import { classLicenses, FigureLicenseByline, FigureLicenseCta } from './FigureLicense';
15
- import { FigureLicense } from './Figure';
16
- import { Contributor } from '../types';
17
-
18
- export const FigureLicenseDialog = ({ children, messages, id, authors, origin, title, locale, license }: Props) => {
19
- const headingLabelId = `heading-${id}`;
20
- return (
21
- <Dialog id={id} labelledby={headingLabelId} messages={messages}>
22
- <div {...classLicenses()}>
23
- <h1 id={headingLabelId} {...classLicenses('title')}>
24
- {messages.rulesForUse}
25
- </h1>
26
- <FigureLicenseByline license={license} messages={messages} locale={locale} />
27
- <FigureLicenseCta authors={authors} title={title} origin={origin} messages={messages}>
28
- {children}
29
- </FigureLicenseCta>
30
- </div>
31
- </Dialog>
32
- );
33
- };
34
-
35
- interface Props {
36
- id: string;
37
- children?: ReactNode;
38
- origin?: string;
39
- authors?: Contributor[];
40
- messages: {
41
- modelPremission?: string;
42
- close: string;
43
- rulesForUse: string;
44
- source: string;
45
- learnAboutLicenses: string;
46
- title: string;
47
- };
48
- title?: string;
49
- license: FigureLicense;
50
- locale: string;
51
- }