@ndla/ui 4.3.0 → 4.3.3-alpha.12

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 (199) hide show
  1. package/README.md +11 -11
  2. package/es/Article/Article.js +3 -7
  3. package/es/Article/ArticleByline.js +4 -4
  4. package/es/Article/ArticleNotions.js +37 -92
  5. package/es/ContentPlaceholder/ContentPlaceholder.js +51 -0
  6. package/es/ContentPlaceholder/index.js +9 -0
  7. package/es/ContentTypeBadge/ContentTypeBadge.js +10 -1
  8. package/es/FactBox/FactBox.js +36 -11
  9. package/es/Filter/FilterButtons.js +18 -17
  10. package/es/Filter/FilterCarousel.js +198 -0
  11. package/es/Masthead/Masthead.js +30 -7
  12. package/es/Masthead/index.js +2 -1
  13. package/es/Masthead/utils.js +11 -0
  14. package/es/MessageBox/MessageBox.js +12 -7
  15. package/es/Notion/ConceptNotion.js +57 -0
  16. package/es/Notion/FigureNotion.js +84 -0
  17. package/es/Notion/Notion.js +122 -48
  18. package/es/Notion/NotionImage.js +47 -0
  19. package/es/Notion/NotionVisualElement.js +38 -0
  20. package/es/Notion/index.js +2 -1
  21. package/es/SearchTypeResult/ActiveFilterContent.js +17 -2
  22. package/es/SearchTypeResult/ActiveFilters.js +64 -50
  23. package/es/SearchTypeResult/PopupFilter.js +28 -125
  24. package/es/SearchTypeResult/ResultNavigation.js +41 -14
  25. package/es/SearchTypeResult/SearchFieldHeader.js +20 -41
  26. package/es/SearchTypeResult/SearchFilterContent.js +61 -0
  27. package/es/SearchTypeResult/SearchHeader.js +51 -28
  28. package/es/SearchTypeResult/SearchItem.js +64 -190
  29. package/es/SearchTypeResult/SearchItemList.js +132 -0
  30. package/es/SearchTypeResult/SearchItems.js +17 -13
  31. package/es/SearchTypeResult/SearchNotionItem.js +13 -13
  32. package/es/SearchTypeResult/SearchNotionsResult.js +16 -21
  33. package/es/SearchTypeResult/SearchTypeHeader.js +43 -26
  34. package/es/SearchTypeResult/SearchTypeResult.js +7 -5
  35. package/es/SearchTypeResult/SearchViewType.js +93 -0
  36. package/es/SearchTypeResult/components/ItemContexts.js +125 -0
  37. package/es/SearchTypeResult/components/ItemResourceHeader.js +87 -0
  38. package/es/SearchTypeResult/components/ItemTopicHeader.js +56 -0
  39. package/es/SearchTypeResult/components/SubjectFilters.js +177 -0
  40. package/es/SearchTypeResult/index.js +2 -1
  41. package/es/all.css +1 -1
  42. package/es/index-javascript.js +1 -2
  43. package/es/index.js +5 -3
  44. package/es/locale/messages-en.js +21 -6
  45. package/es/locale/messages-nb.js +21 -6
  46. package/es/locale/messages-nn.js +22 -7
  47. package/es/model/ContentType.js +2 -1
  48. package/es/shapes.js +1 -1
  49. package/lib/Article/Article.d.ts +4 -5
  50. package/lib/Article/Article.js +3 -7
  51. package/lib/Article/ArticleByline.js +4 -4
  52. package/lib/Article/ArticleNotions.d.ts +3 -8
  53. package/lib/Article/ArticleNotions.js +41 -90
  54. package/lib/ContentPlaceholder/ContentPlaceholder.d.ts +9 -0
  55. package/lib/ContentPlaceholder/ContentPlaceholder.js +54 -0
  56. package/lib/ContentPlaceholder/index.d.ts +9 -0
  57. package/lib/ContentPlaceholder/index.js +20 -0
  58. package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +1 -0
  59. package/lib/ContentTypeBadge/ContentTypeBadge.js +14 -2
  60. package/lib/FactBox/FactBox.js +41 -8
  61. package/lib/Filter/FilterButtons.d.ts +3 -10
  62. package/lib/Filter/FilterButtons.js +19 -17
  63. package/lib/Filter/FilterCarousel.d.ts +13 -0
  64. package/lib/Filter/FilterCarousel.js +207 -0
  65. package/lib/Masthead/Masthead.d.ts +3 -3
  66. package/lib/Masthead/Masthead.js +37 -7
  67. package/lib/Masthead/index.d.ts +2 -1
  68. package/lib/Masthead/index.js +8 -0
  69. package/lib/Masthead/utils.d.ts +8 -0
  70. package/lib/Masthead/utils.js +20 -0
  71. package/lib/MessageBox/MessageBox.d.ts +2 -1
  72. package/lib/MessageBox/MessageBox.js +12 -7
  73. package/lib/Notion/ConceptNotion.d.ts +25 -0
  74. package/lib/Notion/ConceptNotion.js +79 -0
  75. package/lib/Notion/FigureNotion.d.ts +23 -0
  76. package/lib/Notion/FigureNotion.js +99 -0
  77. package/lib/Notion/Notion.d.ts +24 -11
  78. package/lib/Notion/Notion.js +120 -48
  79. package/lib/Notion/NotionImage.d.ts +15 -0
  80. package/lib/Notion/NotionImage.js +63 -0
  81. package/lib/Notion/NotionVisualElement.d.ts +22 -0
  82. package/lib/Notion/NotionVisualElement.js +51 -0
  83. package/lib/Notion/index.d.ts +1 -0
  84. package/lib/Notion/index.js +8 -0
  85. package/lib/SearchTypeResult/ActiveFilterContent.js +16 -9
  86. package/lib/SearchTypeResult/ActiveFilters.d.ts +2 -1
  87. package/lib/SearchTypeResult/ActiveFilters.js +65 -50
  88. package/lib/SearchTypeResult/PopupFilter.d.ts +13 -19
  89. package/lib/SearchTypeResult/PopupFilter.js +27 -123
  90. package/lib/SearchTypeResult/ResultNavigation.d.ts +2 -2
  91. package/lib/SearchTypeResult/ResultNavigation.js +38 -14
  92. package/lib/SearchTypeResult/SearchFieldHeader.d.ts +3 -8
  93. package/lib/SearchTypeResult/SearchFieldHeader.js +18 -39
  94. package/lib/SearchTypeResult/SearchFilterContent.d.ts +16 -0
  95. package/lib/SearchTypeResult/SearchFilterContent.js +67 -0
  96. package/lib/SearchTypeResult/SearchHeader.d.ts +3 -7
  97. package/lib/SearchTypeResult/SearchHeader.js +59 -30
  98. package/lib/SearchTypeResult/SearchItem.d.ts +8 -12
  99. package/lib/SearchTypeResult/SearchItem.js +64 -187
  100. package/lib/SearchTypeResult/SearchItemList.d.ts +10 -0
  101. package/lib/SearchTypeResult/SearchItemList.js +139 -0
  102. package/lib/SearchTypeResult/SearchItems.d.ts +4 -3
  103. package/lib/SearchTypeResult/SearchItems.js +18 -13
  104. package/lib/SearchTypeResult/SearchNotionItem.js +13 -13
  105. package/lib/SearchTypeResult/SearchNotionsResult.d.ts +2 -4
  106. package/lib/SearchTypeResult/SearchNotionsResult.js +23 -23
  107. package/lib/SearchTypeResult/SearchTypeHeader.d.ts +2 -2
  108. package/lib/SearchTypeResult/SearchTypeHeader.js +40 -25
  109. package/lib/SearchTypeResult/SearchTypeResult.d.ts +7 -6
  110. package/lib/SearchTypeResult/SearchTypeResult.js +7 -5
  111. package/lib/SearchTypeResult/SearchViewType.d.ts +13 -0
  112. package/lib/SearchTypeResult/SearchViewType.js +99 -0
  113. package/lib/SearchTypeResult/components/ItemContexts.d.ts +19 -0
  114. package/lib/SearchTypeResult/components/ItemContexts.js +134 -0
  115. package/lib/SearchTypeResult/components/ItemResourceHeader.d.ts +16 -0
  116. package/lib/SearchTypeResult/components/ItemResourceHeader.js +98 -0
  117. package/lib/SearchTypeResult/components/ItemTopicHeader.d.ts +17 -0
  118. package/lib/SearchTypeResult/components/ItemTopicHeader.js +67 -0
  119. package/lib/SearchTypeResult/components/SubjectFilters.d.ts +32 -0
  120. package/lib/SearchTypeResult/components/SubjectFilters.js +192 -0
  121. package/lib/SearchTypeResult/index.d.ts +2 -1
  122. package/lib/SearchTypeResult/index.js +8 -0
  123. package/lib/all.css +1 -1
  124. package/lib/index-javascript.js +0 -20
  125. package/lib/index.d.ts +4 -2
  126. package/lib/index.js +40 -1
  127. package/lib/locale/messages-en.d.ts +16 -1
  128. package/lib/locale/messages-en.js +21 -6
  129. package/lib/locale/messages-nb.d.ts +15 -0
  130. package/lib/locale/messages-nb.js +21 -6
  131. package/lib/locale/messages-nn.d.ts +16 -1
  132. package/lib/locale/messages-nn.js +22 -7
  133. package/lib/model/ContentType.d.ts +1 -0
  134. package/lib/model/ContentType.js +4 -2
  135. package/lib/shapes.js +1 -1
  136. package/lib/types.d.ts +1 -0
  137. package/package.json +14 -15
  138. package/src/Article/Article.tsx +8 -15
  139. package/src/Article/ArticleByline.tsx +1 -1
  140. package/src/Article/ArticleNotions.tsx +13 -33
  141. package/src/ContentPlaceholder/ContentPlaceholder.tsx +68 -0
  142. package/src/ContentPlaceholder/index.ts +11 -0
  143. package/src/ContentTypeBadge/ContentTypeBadge.tsx +8 -0
  144. package/src/ContentTypeBadge/component.content-type-badge.scss +5 -0
  145. package/src/FactBox/FactBox.tsx +22 -15
  146. package/src/Figure/component.figure.scss +1 -1
  147. package/src/Filter/FilterButtons.tsx +14 -15
  148. package/src/Filter/FilterCarousel.tsx +166 -0
  149. package/src/Masthead/Masthead.tsx +45 -20
  150. package/src/Masthead/component.masthead.scss +3 -62
  151. package/src/Masthead/index.ts +3 -1
  152. package/src/Masthead/utils.ts +12 -0
  153. package/src/MessageBox/MessageBox.tsx +4 -1
  154. package/src/Notion/ConceptNotion.tsx +80 -0
  155. package/src/Notion/FigureNotion.tsx +88 -0
  156. package/src/Notion/Notion.tsx +205 -75
  157. package/src/Notion/NotionImage.tsx +51 -0
  158. package/src/Notion/NotionVisualElement.tsx +50 -0
  159. package/src/Notion/index.ts +1 -0
  160. package/src/SearchTypeResult/ActiveFilterContent.tsx +7 -2
  161. package/src/SearchTypeResult/ActiveFilters.tsx +72 -38
  162. package/src/SearchTypeResult/PopupFilter.tsx +73 -146
  163. package/src/SearchTypeResult/ResultNavigation.tsx +54 -16
  164. package/src/SearchTypeResult/SearchFieldHeader.tsx +15 -40
  165. package/src/SearchTypeResult/SearchFilterContent.tsx +63 -0
  166. package/src/SearchTypeResult/SearchHeader.tsx +31 -31
  167. package/src/SearchTypeResult/SearchItem.tsx +145 -233
  168. package/src/SearchTypeResult/SearchItemList.tsx +167 -0
  169. package/src/SearchTypeResult/SearchItems.tsx +26 -19
  170. package/src/SearchTypeResult/SearchNotionItem.tsx +5 -12
  171. package/src/SearchTypeResult/SearchNotionsResult.tsx +29 -22
  172. package/src/SearchTypeResult/SearchTypeHeader.tsx +51 -33
  173. package/src/SearchTypeResult/SearchTypeResult.tsx +13 -12
  174. package/src/SearchTypeResult/SearchViewType.tsx +109 -0
  175. package/src/SearchTypeResult/components/ItemContexts.tsx +138 -0
  176. package/src/SearchTypeResult/components/ItemResourceHeader.tsx +133 -0
  177. package/src/SearchTypeResult/components/ItemTopicHeader.tsx +95 -0
  178. package/src/SearchTypeResult/components/SubjectFilters.tsx +152 -0
  179. package/src/SearchTypeResult/index.ts +9 -1
  180. package/src/index-javascript.js +0 -2
  181. package/src/index.ts +5 -1
  182. package/src/locale/messages-en.ts +19 -4
  183. package/src/locale/messages-nb.ts +19 -4
  184. package/src/locale/messages-nn.ts +20 -5
  185. package/src/model/ContentType.ts +1 -0
  186. package/src/shapes.js +1 -0
  187. package/src/types.ts +1 -0
  188. package/es/Embedded/Facebook.js +0 -19
  189. package/es/Embedded/FacebookPage.js +0 -22
  190. package/es/Embedded/Twitter.js +0 -121
  191. package/es/Embedded/index.js +0 -3
  192. package/lib/Embedded/Facebook.js +0 -32
  193. package/lib/Embedded/FacebookPage.js +0 -35
  194. package/lib/Embedded/Twitter.js +0 -132
  195. package/lib/Embedded/index.js +0 -31
  196. package/src/Embedded/Facebook.jsx +0 -17
  197. package/src/Embedded/FacebookPage.jsx +0 -24
  198. package/src/Embedded/Twitter.jsx +0 -71
  199. package/src/Embedded/index.js +0 -3
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { FacebookProvider, EmbeddedPost } from 'react-facebook';
4
- import { jsx as ___EmotionJSX } from "@emotion/core";
5
-
6
- var EmbeddedFacebook = function EmbeddedFacebook(props) {
7
- return ___EmotionJSX("div", null, ___EmotionJSX(FacebookProvider, {
8
- appId: "155745961798881"
9
- }, ___EmotionJSX(EmbeddedPost, {
10
- href: props.href,
11
- className: "fb-embedded",
12
- width: ""
13
- })));
14
- };
15
-
16
- EmbeddedFacebook.propTypes = {
17
- href: PropTypes.string.isRequired
18
- };
19
- export default EmbeddedFacebook;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { FacebookProvider, Page } from 'react-facebook';
4
- import { jsx as ___EmotionJSX } from "@emotion/core";
5
-
6
- var EmbeddedFacebookPage = function EmbeddedFacebookPage(props) {
7
- return ___EmotionJSX("div", null, ___EmotionJSX(FacebookProvider, {
8
- appId: "155745961798881"
9
- }, ___EmotionJSX(Page, {
10
- href: props.href,
11
- height: props.height || 500,
12
- tabs: "timeline",
13
- className: "fb-embedded",
14
- adaptContainerWidth: true
15
- })));
16
- };
17
-
18
- EmbeddedFacebookPage.propTypes = {
19
- href: PropTypes.string.isRequired,
20
- height: PropTypes.number
21
- };
22
- export default EmbeddedFacebookPage;
@@ -1,121 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
-
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
-
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
-
11
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
-
13
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
16
-
17
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
-
19
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
20
-
21
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
-
23
- import { Component, createElement } from 'react';
24
- import PropTypes from 'prop-types';
25
-
26
- var EmbeddedTwitter = /*#__PURE__*/function (_Component) {
27
- _inherits(EmbeddedTwitter, _Component);
28
-
29
- var _super = _createSuper(EmbeddedTwitter);
30
-
31
- _createClass(EmbeddedTwitter, null, [{
32
- key: "removeChildren",
33
- value: function removeChildren(node) {
34
- if (node) {
35
- while (node.firstChild) {
36
- node.removeChild(node.firstChild);
37
- }
38
- }
39
- }
40
- }]);
41
-
42
- function EmbeddedTwitter(props) {
43
- var _this;
44
-
45
- _classCallCheck(this, EmbeddedTwitter);
46
-
47
- _this = _super.call(this, props);
48
- _this.loadWidget = _this.loadWidget.bind(_assertThisInitialized(_this));
49
- return _this;
50
- }
51
-
52
- _createClass(EmbeddedTwitter, [{
53
- key: "componentDidMount",
54
- value: function componentDidMount() {
55
- if (window.twttr) {
56
- this.loadWidget();
57
- }
58
- }
59
- }, {
60
- key: "shouldComponentUpdate",
61
- value: function shouldComponentUpdate(nextProps) {
62
- return this.props.screenName !== nextProps.screenName;
63
- }
64
- }, {
65
- key: "componentDidUpdate",
66
- value: function componentDidUpdate() {
67
- if (window.twttr) {
68
- this.loadWidget();
69
- }
70
- }
71
- }, {
72
- key: "componentWillUnmount",
73
- value: function componentWillUnmount() {
74
- EmbeddedTwitter.removeChildren(this.widgetWrapper);
75
- }
76
- }, {
77
- key: "loadWidget",
78
- value: function loadWidget() {
79
- var _this2 = this;
80
-
81
- window.twttr.ready(function (tw) {
82
- // Delete existing
83
- EmbeddedTwitter.removeChildren(_this2.widgetWrapper);
84
- var _this2$props = _this2.props,
85
- screenName = _this2$props.screenName,
86
- tweetLimit = _this2$props.tweetLimit; // Create widget
87
-
88
- tw.widgets.createTimeline({
89
- sourceType: 'profile',
90
- screenName: screenName
91
- }, _this2.widgetWrapper, {
92
- tweetLimit: tweetLimit,
93
- chrome: 'noheader nofooter noborders',
94
- borderColor: '#e8e3e3'
95
- });
96
- });
97
- }
98
- }, {
99
- key: "render",
100
- value: function render() {
101
- var _this3 = this;
102
-
103
- return /*#__PURE__*/createElement('div', {
104
- ref: function ref(c) {
105
- _this3.widgetWrapper = c;
106
- }
107
- });
108
- }
109
- }]);
110
-
111
- return EmbeddedTwitter;
112
- }(Component);
113
-
114
- EmbeddedTwitter.propTypes = {
115
- screenName: PropTypes.string.isRequired,
116
- tweetLimit: PropTypes.number
117
- };
118
- EmbeddedTwitter.defaultProps = {
119
- tweetLimit: 10
120
- };
121
- export default EmbeddedTwitter;
@@ -1,3 +0,0 @@
1
- export { default as EmbeddedTwitter } from './Twitter';
2
- export { default as EmbeddedFacebook } from './Facebook';
3
- export { default as EmbeddedFacebookPage } from './FacebookPage';
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _reactFacebook = require("react-facebook");
13
-
14
- var _core = require("@emotion/core");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- var EmbeddedFacebook = function EmbeddedFacebook(props) {
19
- return (0, _core.jsx)("div", null, (0, _core.jsx)(_reactFacebook.FacebookProvider, {
20
- appId: "155745961798881"
21
- }, (0, _core.jsx)(_reactFacebook.EmbeddedPost, {
22
- href: props.href,
23
- className: "fb-embedded",
24
- width: ""
25
- })));
26
- };
27
-
28
- EmbeddedFacebook.propTypes = {
29
- href: _propTypes["default"].string.isRequired
30
- };
31
- var _default = EmbeddedFacebook;
32
- exports["default"] = _default;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _reactFacebook = require("react-facebook");
13
-
14
- var _core = require("@emotion/core");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- var EmbeddedFacebookPage = function EmbeddedFacebookPage(props) {
19
- return (0, _core.jsx)("div", null, (0, _core.jsx)(_reactFacebook.FacebookProvider, {
20
- appId: "155745961798881"
21
- }, (0, _core.jsx)(_reactFacebook.Page, {
22
- href: props.href,
23
- height: props.height || 500,
24
- tabs: "timeline",
25
- className: "fb-embedded",
26
- adaptContainerWidth: true
27
- })));
28
- };
29
-
30
- EmbeddedFacebookPage.propTypes = {
31
- href: _propTypes["default"].string.isRequired,
32
- height: _propTypes["default"].number
33
- };
34
- var _default = EmbeddedFacebookPage;
35
- exports["default"] = _default;
@@ -1,132 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
15
-
16
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
-
18
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
19
-
20
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
21
-
22
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
23
-
24
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
25
-
26
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
27
-
28
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
29
-
30
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
31
-
32
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
33
-
34
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
35
-
36
- var EmbeddedTwitter = /*#__PURE__*/function (_Component) {
37
- _inherits(EmbeddedTwitter, _Component);
38
-
39
- var _super = _createSuper(EmbeddedTwitter);
40
-
41
- _createClass(EmbeddedTwitter, null, [{
42
- key: "removeChildren",
43
- value: function removeChildren(node) {
44
- if (node) {
45
- while (node.firstChild) {
46
- node.removeChild(node.firstChild);
47
- }
48
- }
49
- }
50
- }]);
51
-
52
- function EmbeddedTwitter(props) {
53
- var _this;
54
-
55
- _classCallCheck(this, EmbeddedTwitter);
56
-
57
- _this = _super.call(this, props);
58
- _this.loadWidget = _this.loadWidget.bind(_assertThisInitialized(_this));
59
- return _this;
60
- }
61
-
62
- _createClass(EmbeddedTwitter, [{
63
- key: "componentDidMount",
64
- value: function componentDidMount() {
65
- if (window.twttr) {
66
- this.loadWidget();
67
- }
68
- }
69
- }, {
70
- key: "shouldComponentUpdate",
71
- value: function shouldComponentUpdate(nextProps) {
72
- return this.props.screenName !== nextProps.screenName;
73
- }
74
- }, {
75
- key: "componentDidUpdate",
76
- value: function componentDidUpdate() {
77
- if (window.twttr) {
78
- this.loadWidget();
79
- }
80
- }
81
- }, {
82
- key: "componentWillUnmount",
83
- value: function componentWillUnmount() {
84
- EmbeddedTwitter.removeChildren(this.widgetWrapper);
85
- }
86
- }, {
87
- key: "loadWidget",
88
- value: function loadWidget() {
89
- var _this2 = this;
90
-
91
- window.twttr.ready(function (tw) {
92
- // Delete existing
93
- EmbeddedTwitter.removeChildren(_this2.widgetWrapper);
94
- var _this2$props = _this2.props,
95
- screenName = _this2$props.screenName,
96
- tweetLimit = _this2$props.tweetLimit; // Create widget
97
-
98
- tw.widgets.createTimeline({
99
- sourceType: 'profile',
100
- screenName: screenName
101
- }, _this2.widgetWrapper, {
102
- tweetLimit: tweetLimit,
103
- chrome: 'noheader nofooter noborders',
104
- borderColor: '#e8e3e3'
105
- });
106
- });
107
- }
108
- }, {
109
- key: "render",
110
- value: function render() {
111
- var _this3 = this;
112
-
113
- return /*#__PURE__*/(0, _react.createElement)('div', {
114
- ref: function ref(c) {
115
- _this3.widgetWrapper = c;
116
- }
117
- });
118
- }
119
- }]);
120
-
121
- return EmbeddedTwitter;
122
- }(_react.Component);
123
-
124
- EmbeddedTwitter.propTypes = {
125
- screenName: _propTypes["default"].string.isRequired,
126
- tweetLimit: _propTypes["default"].number
127
- };
128
- EmbeddedTwitter.defaultProps = {
129
- tweetLimit: 10
130
- };
131
- var _default = EmbeddedTwitter;
132
- exports["default"] = _default;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "EmbeddedTwitter", {
7
- enumerable: true,
8
- get: function get() {
9
- return _Twitter["default"];
10
- }
11
- });
12
- Object.defineProperty(exports, "EmbeddedFacebook", {
13
- enumerable: true,
14
- get: function get() {
15
- return _Facebook["default"];
16
- }
17
- });
18
- Object.defineProperty(exports, "EmbeddedFacebookPage", {
19
- enumerable: true,
20
- get: function get() {
21
- return _FacebookPage["default"];
22
- }
23
- });
24
-
25
- var _Twitter = _interopRequireDefault(require("./Twitter"));
26
-
27
- var _Facebook = _interopRequireDefault(require("./Facebook"));
28
-
29
- var _FacebookPage = _interopRequireDefault(require("./FacebookPage"));
30
-
31
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { FacebookProvider, EmbeddedPost } from 'react-facebook';
4
-
5
- const EmbeddedFacebook = (props) => (
6
- <div>
7
- <FacebookProvider appId="155745961798881">
8
- <EmbeddedPost href={props.href} className="fb-embedded" width="" />
9
- </FacebookProvider>
10
- </div>
11
- );
12
-
13
- EmbeddedFacebook.propTypes = {
14
- href: PropTypes.string.isRequired,
15
- };
16
-
17
- export default EmbeddedFacebook;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { FacebookProvider, Page } from 'react-facebook';
4
-
5
- const EmbeddedFacebookPage = (props) => (
6
- <div>
7
- <FacebookProvider appId="155745961798881">
8
- <Page
9
- href={props.href}
10
- height={props.height || 500}
11
- tabs="timeline"
12
- className="fb-embedded"
13
- adaptContainerWidth={true}
14
- />
15
- </FacebookProvider>
16
- </div>
17
- );
18
-
19
- EmbeddedFacebookPage.propTypes = {
20
- href: PropTypes.string.isRequired,
21
- height: PropTypes.number,
22
- };
23
-
24
- export default EmbeddedFacebookPage;
@@ -1,71 +0,0 @@
1
- import { Component, createElement } from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- class EmbeddedTwitter extends Component {
5
- static removeChildren(node) {
6
- if (node) {
7
- while (node.firstChild) {
8
- node.removeChild(node.firstChild);
9
- }
10
- }
11
- }
12
-
13
- constructor(props) {
14
- super(props);
15
- this.loadWidget = this.loadWidget.bind(this);
16
- }
17
-
18
- componentDidMount() {
19
- if (window.twttr) {
20
- this.loadWidget();
21
- }
22
- }
23
-
24
- shouldComponentUpdate(nextProps) {
25
- return this.props.screenName !== nextProps.screenName;
26
- }
27
-
28
- componentDidUpdate() {
29
- if (window.twttr) {
30
- this.loadWidget();
31
- }
32
- }
33
-
34
- componentWillUnmount() {
35
- EmbeddedTwitter.removeChildren(this.widgetWrapper);
36
- }
37
-
38
- loadWidget() {
39
- window.twttr.ready((tw) => {
40
- // Delete existing
41
- EmbeddedTwitter.removeChildren(this.widgetWrapper);
42
-
43
- const { screenName, tweetLimit } = this.props;
44
- // Create widget
45
- tw.widgets.createTimeline({ sourceType: 'profile', screenName }, this.widgetWrapper, {
46
- tweetLimit,
47
- chrome: 'noheader nofooter noborders',
48
- borderColor: '#e8e3e3',
49
- });
50
- });
51
- }
52
-
53
- render() {
54
- return createElement('div', {
55
- ref: (c) => {
56
- this.widgetWrapper = c;
57
- },
58
- });
59
- }
60
- }
61
-
62
- EmbeddedTwitter.propTypes = {
63
- screenName: PropTypes.string.isRequired,
64
- tweetLimit: PropTypes.number,
65
- };
66
-
67
- EmbeddedTwitter.defaultProps = {
68
- tweetLimit: 10,
69
- };
70
-
71
- export default EmbeddedTwitter;
@@ -1,3 +0,0 @@
1
- export { default as EmbeddedTwitter } from './Twitter';
2
- export { default as EmbeddedFacebook } from './Facebook';
3
- export { default as EmbeddedFacebookPage } from './FacebookPage';