@quintype/components 3.0.3-test-react18.0 → 3.0.3-test-react18.1
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/dist/cjs/index.js +330 -1044
- package/dist/es/components/access-type.js +51 -229
- package/dist/es/components/adbutler-ad.js +10 -14
- package/dist/es/components/api-client.js +4 -6
- package/dist/es/components/breaking-news-item.js +2 -3
- package/dist/es/components/breaking-news.js +1 -15
- package/dist/es/components/client-side-only.js +14 -26
- package/dist/es/components/collection.js +5 -5
- package/dist/es/components/dfp-ad.js +23 -30
- package/dist/es/components/eager-load-images.js +1 -9
- package/dist/es/components/hamburger-button.js +2 -5
- package/dist/es/components/image-gallery.js +10 -13
- package/dist/es/components/impl/collection-impl.js +2 -8
- package/dist/es/components/impl/gumlet-image.js +8 -15
- package/dist/es/components/impl/image-utils.js +3 -3
- package/dist/es/components/impl/load-more-stories-manager.js +0 -11
- package/dist/es/components/impl/thumbor-image.js +0 -15
- package/dist/es/components/infinite-scroll.js +3 -51
- package/dist/es/components/infinite-story-base.js +1 -16
- package/dist/es/components/lazy-collection.js +8 -8
- package/dist/es/components/lazy-load-images.js +36 -66
- package/dist/es/components/link-base.js +11 -19
- package/dist/es/components/link.js +1 -4
- package/dist/es/components/load-more-collection-stories.js +1 -10
- package/dist/es/components/load-more-stories-base.js +0 -12
- package/dist/es/components/loading-indicator.js +1 -5
- package/dist/es/components/menu-item.js +6 -10
- package/dist/es/components/menu.js +6 -9
- package/dist/es/components/responsive-hero-image.js +1 -3
- package/dist/es/components/responsive-image.js +0 -5
- package/dist/es/components/responsive-source.js +1 -1
- package/dist/es/components/review-rating/review-rating.js +21 -27
- package/dist/es/components/review-rating/star-icon.js +3 -5
- package/dist/es/components/search-box.js +1 -15
- package/dist/es/components/search-page-base.js +1 -10
- package/dist/es/components/social-logins/with-facebook-login.js +10 -20
- package/dist/es/components/social-logins/with-google-login.js +8 -18
- package/dist/es/components/social-logins/with-linkedin-login.js +7 -12
- package/dist/es/components/social-logins/with-social-login.js +1 -13
- package/dist/es/components/social-logins/with-twitter-login.js +7 -7
- package/dist/es/components/social-share.js +1 -15
- package/dist/es/components/story-element.js +27 -66
- package/dist/es/components/story-elements/dailymotion.js +2 -30
- package/dist/es/components/story-elements/jsembed.js +0 -17
- package/dist/es/components/story-elements/polltype.js +0 -12
- package/dist/es/components/story-elements/table.js +4 -20
- package/dist/es/components/story-elements/youtube.js +9 -45
- package/dist/es/components/update-on-interval.js +1 -18
- package/dist/es/components/with-client-side-only.js +3 -4
- package/dist/es/components/with-error.js +1 -12
- package/dist/es/components/with-host-url.js +4 -9
- package/dist/es/components/with-lazy.js +1 -13
- package/dist/es/components/with-member.js +7 -23
- package/dist/es/components/with-preview.js +1 -12
- package/dist/es/components/wrap-collection-layout.js +4 -16
- package/dist/es/store/reducers.js +1 -45
- package/dist/es/utils.js +7 -12
- package/package.json +6 -4
|
@@ -2,11 +2,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
var _excluded = ["navigateToImpl", "externalLink", "callback", "href", "currentHostUrl", "navigateTo", "preventDefault", "disableAjaxLinks"];
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { string, func, bool } from "prop-types";
|
|
5
|
-
|
|
6
5
|
var preventDefaultImpl = function preventDefaultImpl(e) {
|
|
7
6
|
e.preventDefault();
|
|
8
7
|
e.stopPropagation();
|
|
9
8
|
};
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* This component generates an anchor tag. Instead of doing a browser page load, it will go to the next page via AJAX. Analytics scripts will be fired correctly (and if not, it's a bug)
|
|
12
12
|
* LinkBase is not connected to the store or plugged to context, this is used as an alternative for usecases such as partial hydration where context is lost.
|
|
@@ -18,21 +18,18 @@ var preventDefaultImpl = function preventDefaultImpl(e) {
|
|
|
18
18
|
* @category Other
|
|
19
19
|
* @component
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
21
|
export var LinkBase = function LinkBase(_ref) {
|
|
24
22
|
var navigateToImpl = _ref.navigateToImpl,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
externalLink = _ref.externalLink,
|
|
24
|
+
callback = _ref.callback,
|
|
25
|
+
href = _ref.href,
|
|
26
|
+
currentHostUrl = _ref.currentHostUrl,
|
|
27
|
+
navigateTo = _ref.navigateTo,
|
|
28
|
+
_ref$preventDefault = _ref.preventDefault,
|
|
29
|
+
preventDefault = _ref$preventDefault === void 0 ? preventDefaultImpl : _ref$preventDefault,
|
|
30
|
+
_ref$disableAjaxLinks = _ref.disableAjaxLinks,
|
|
31
|
+
disableAjaxLinks = _ref$disableAjaxLinks === void 0 ? global.disableAjaxLinks || global.disableAjaxNavigation : _ref$disableAjaxLinks,
|
|
32
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
36
33
|
navigateTo = navigateTo || navigateToImpl;
|
|
37
34
|
return /*#__PURE__*/React.createElement("a", Object.assign(otherProps, {
|
|
38
35
|
href: href,
|
|
@@ -40,21 +37,16 @@ export var LinkBase = function LinkBase(_ref) {
|
|
|
40
37
|
if (disableAjaxLinks || e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
41
38
|
return;
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
var relativeLink = href.startsWith(currentHostUrl) ? href.replace(currentHostUrl, "") : href;
|
|
45
|
-
|
|
46
41
|
if (!relativeLink.startsWith("/")) {
|
|
47
42
|
return;
|
|
48
43
|
}
|
|
49
|
-
|
|
50
44
|
preventDefault(e);
|
|
51
|
-
|
|
52
45
|
if (externalLink) {
|
|
53
46
|
global.open(externalLink, "_blank");
|
|
54
47
|
} else {
|
|
55
48
|
navigateTo(relativeLink);
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
typeof callback === "function" && callback(e);
|
|
59
51
|
}
|
|
60
52
|
}));
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { connect } from "react-redux";
|
|
2
2
|
import { LinkBase } from "./link-base";
|
|
3
|
-
|
|
4
3
|
var mapStateToProps = function mapStateToProps(state) {
|
|
5
4
|
return {
|
|
6
5
|
currentHostUrl: state.qt && state.qt.currentHostUrl
|
|
7
6
|
};
|
|
8
7
|
};
|
|
9
|
-
|
|
10
8
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
11
9
|
return {
|
|
12
10
|
navigateToImpl: function navigateToImpl(url) {
|
|
@@ -14,6 +12,7 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
14
12
|
}
|
|
15
13
|
};
|
|
16
14
|
};
|
|
15
|
+
|
|
17
16
|
/**
|
|
18
17
|
* This component generates an anchor tag. Instead of doing a browser page load, it will go to the next page via AJAX. Analytics scripts will be fired correctly (and if not, it's a bug)
|
|
19
18
|
*
|
|
@@ -24,6 +23,4 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
24
23
|
* @category Other
|
|
25
24
|
* @component
|
|
26
25
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
26
|
export var Link = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(LinkBase);
|
|
@@ -3,15 +3,13 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
6
|
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); }; }
|
|
8
|
-
|
|
9
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
8
|
import React from 'react';
|
|
12
9
|
import get from "lodash/get";
|
|
13
10
|
import { getRequest } from './api-client';
|
|
14
11
|
import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
12
|
+
|
|
15
13
|
/**
|
|
16
14
|
* This component is very similar to the {@link LoadMoreBase} component but fetches the stories from a `collection`. The api call `/api/v1/collections/{collectionSlug}` is made with the passed collection slug value. The component accepts the `params` prop and a requires a Collection Slug from which to fetch the stories and returns a set of stories only.
|
|
17
15
|
*
|
|
@@ -47,18 +45,13 @@ import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
|
47
45
|
* @component
|
|
48
46
|
* @category Collection Page
|
|
49
47
|
*/
|
|
50
|
-
|
|
51
48
|
export var LoadMoreCollectionStories = /*#__PURE__*/function (_React$Component) {
|
|
52
49
|
_inherits(LoadMoreCollectionStories, _React$Component);
|
|
53
|
-
|
|
54
50
|
var _super = /*#__PURE__*/_createSuper(LoadMoreCollectionStories);
|
|
55
|
-
|
|
56
51
|
function LoadMoreCollectionStories() {
|
|
57
52
|
_classCallCheck(this, LoadMoreCollectionStories);
|
|
58
|
-
|
|
59
53
|
return _super.apply(this, arguments);
|
|
60
54
|
}
|
|
61
|
-
|
|
62
55
|
_createClass(LoadMoreCollectionStories, [{
|
|
63
56
|
key: "loadMoreStories",
|
|
64
57
|
value: function loadMoreStories(pageNumber) {
|
|
@@ -78,7 +71,6 @@ export var LoadMoreCollectionStories = /*#__PURE__*/function (_React$Component)
|
|
|
78
71
|
key: "render",
|
|
79
72
|
value: function render() {
|
|
80
73
|
var _this = this;
|
|
81
|
-
|
|
82
74
|
return /*#__PURE__*/React.createElement(LoadMoreStoriesManager, Object.assign({}, this.props.data, {
|
|
83
75
|
template: this.props.template,
|
|
84
76
|
loadStories: function loadStories(pageNumber) {
|
|
@@ -89,6 +81,5 @@ export var LoadMoreCollectionStories = /*#__PURE__*/function (_React$Component)
|
|
|
89
81
|
}));
|
|
90
82
|
}
|
|
91
83
|
}]);
|
|
92
|
-
|
|
93
84
|
return LoadMoreCollectionStories;
|
|
94
85
|
}(React.Component);
|
|
@@ -3,11 +3,8 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
6
|
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); }; }
|
|
8
|
-
|
|
9
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
8
|
import React from 'react';
|
|
12
9
|
import get from "lodash/get";
|
|
13
10
|
import { getRequest } from './api-client';
|
|
@@ -39,23 +36,17 @@ import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
|
39
36
|
* @component
|
|
40
37
|
* @category Collection Page
|
|
41
38
|
*/
|
|
42
|
-
|
|
43
39
|
export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
44
40
|
_inherits(LoadMoreStoriesBase, _React$Component);
|
|
45
|
-
|
|
46
41
|
var _super = /*#__PURE__*/_createSuper(LoadMoreStoriesBase);
|
|
47
|
-
|
|
48
42
|
function LoadMoreStoriesBase() {
|
|
49
43
|
_classCallCheck(this, LoadMoreStoriesBase);
|
|
50
|
-
|
|
51
44
|
return _super.apply(this, arguments);
|
|
52
45
|
}
|
|
53
|
-
|
|
54
46
|
_createClass(LoadMoreStoriesBase, [{
|
|
55
47
|
key: "loadMoreStories",
|
|
56
48
|
value: function loadMoreStories(pageNumber) {
|
|
57
49
|
var _this = this;
|
|
58
|
-
|
|
59
50
|
var stories = get(this.props, ['data', 'stories'], []);
|
|
60
51
|
return getRequest(this.props.api || '/api/v1/stories', Object.assign({}, this.props.params, {
|
|
61
52
|
offset: this.props.numStoriesToLoad * (pageNumber - 1) + stories.length,
|
|
@@ -65,7 +56,6 @@ export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
|
65
56
|
if (_this.props.apiResponseTransformer) {
|
|
66
57
|
return _this.props.apiResponseTransformer(response);
|
|
67
58
|
}
|
|
68
|
-
|
|
69
59
|
return response.stories || get(response, ['results', 'stories'], []);
|
|
70
60
|
});
|
|
71
61
|
}
|
|
@@ -73,7 +63,6 @@ export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
|
73
63
|
key: "render",
|
|
74
64
|
value: function render() {
|
|
75
65
|
var _this2 = this;
|
|
76
|
-
|
|
77
66
|
return /*#__PURE__*/React.createElement(LoadMoreStoriesManager, Object.assign({}, this.props.data, {
|
|
78
67
|
template: this.props.template,
|
|
79
68
|
loadStories: function loadStories(pageNumber) {
|
|
@@ -84,6 +73,5 @@ export var LoadMoreStoriesBase = /*#__PURE__*/function (_React$Component) {
|
|
|
84
73
|
}));
|
|
85
74
|
}
|
|
86
75
|
}]);
|
|
87
|
-
|
|
88
76
|
return LoadMoreStoriesBase;
|
|
89
77
|
}(React.Component);
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
|
|
4
3
|
function LoadingIndicatorBase(props) {
|
|
5
4
|
return /*#__PURE__*/React.createElement("div", {
|
|
6
5
|
className: "loading-indicator ".concat(props.loading ? 'loading-indicator-loading' : '')
|
|
7
6
|
}, props.loading && props.children);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
function mapStateToProps(state) {
|
|
11
9
|
return {
|
|
12
10
|
loading: state.pageLoading
|
|
13
11
|
};
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
function mapDispatchToProps() {
|
|
17
14
|
return {};
|
|
18
15
|
}
|
|
16
|
+
|
|
19
17
|
/**
|
|
20
18
|
* This component renders it's children when the app is moving between pages. It can be used to show a spinner. It always has the class "loading-indicator", and also "loading-indicator-loading" when loading.
|
|
21
19
|
*
|
|
@@ -30,6 +28,4 @@ function mapDispatchToProps() {
|
|
|
30
28
|
* @component
|
|
31
29
|
* @category Other
|
|
32
30
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
31
|
export var LoadingIndicator = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(LoadingIndicatorBase);
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Link } from "./link";
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* @see {@link Menu}
|
|
5
6
|
* @deprecated
|
|
6
7
|
* @component
|
|
7
8
|
* @category Header
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
10
|
export function MenuItem(_ref) {
|
|
11
11
|
var item = _ref.item,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
className = _ref.className,
|
|
13
|
+
currentUrl = _ref.currentUrl;
|
|
14
14
|
var url = getRelativeUrl(item.url);
|
|
15
15
|
return /*#__PURE__*/React.createElement("li", null, getMenuItemBody(item, "".concat(className).concat(currentUrl == url ? " active" : ""), url));
|
|
16
16
|
}
|
|
17
|
-
|
|
18
17
|
function getRelativeUrl(url) {
|
|
19
18
|
var _URL = new URL(url),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
pathname = _URL.pathname,
|
|
20
|
+
search = _URL.search,
|
|
21
|
+
hash = _URL.hash;
|
|
24
22
|
return "".concat(pathname).concat(search || "").concat(hash || "");
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
function getMenuItemBody(item, className, url, currentUrl) {
|
|
28
25
|
switch (item['item-type']) {
|
|
29
26
|
case 'section':
|
|
@@ -31,7 +28,6 @@ function getMenuItemBody(item, className, url, currentUrl) {
|
|
|
31
28
|
href: url,
|
|
32
29
|
className: className
|
|
33
30
|
}, item.title);
|
|
34
|
-
|
|
35
31
|
default:
|
|
36
32
|
return /*#__PURE__*/React.createElement("a", {
|
|
37
33
|
href: item.url,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
|
|
4
3
|
function MenuBase(_ref) {
|
|
5
4
|
var children = _ref.children,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
className = _ref.className,
|
|
6
|
+
itemClassName = _ref.itemClassName,
|
|
7
|
+
items = _ref.items,
|
|
8
|
+
currentUrl = _ref.currentUrl,
|
|
9
|
+
slice = _ref.slice;
|
|
11
10
|
items = items.slice.apply(items, slice);
|
|
12
11
|
return /*#__PURE__*/React.createElement("ul", {
|
|
13
12
|
className: className
|
|
@@ -20,13 +19,13 @@ function MenuBase(_ref) {
|
|
|
20
19
|
});
|
|
21
20
|
}));
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
function mapStateToProps(state) {
|
|
25
23
|
return {
|
|
26
24
|
items: state.qt.config.layout.menu,
|
|
27
25
|
currentUrl: state.qt.currentPath
|
|
28
26
|
};
|
|
29
27
|
}
|
|
28
|
+
|
|
30
29
|
/**
|
|
31
30
|
* This component can be used to render a menu from the menuItems in the editor. An extra class called active is applied if the menu item is the current url. By default, links will resolve via AJAX.
|
|
32
31
|
*
|
|
@@ -48,8 +47,6 @@ function mapStateToProps(state) {
|
|
|
48
47
|
* @component
|
|
49
48
|
* @category Header
|
|
50
49
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
50
|
export var Menu = /*#__PURE__*/connect(mapStateToProps, function () {
|
|
54
51
|
return {};
|
|
55
52
|
})(MenuBase);
|
|
@@ -2,6 +2,7 @@ import omit from "@babel/runtime/helpers/objectWithoutProperties";
|
|
|
2
2
|
import get from "lodash/get";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { ResponsiveImage } from "./responsive-image";
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* This component is a wrapper over {@link ResponsiveImages}. It accepts story as a prop and renders story's hero image.
|
|
7
8
|
* If hero-image-s3-key is present, it takes that as slug and the story headline as image alt text.
|
|
@@ -20,13 +21,11 @@ import { ResponsiveImage } from "./responsive-image";
|
|
|
20
21
|
* @component
|
|
21
22
|
* @category Images
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
24
|
export function ResponsiveHeroImage(props) {
|
|
25
25
|
var metadata, slug, alternateText;
|
|
26
26
|
var heroImageS3Key = get(props, ["story", "hero-image-s3-key"], "");
|
|
27
27
|
var storyAlternateData = get(props, ["story", "alternative", "home", "default"], {}) || {};
|
|
28
28
|
var alternateHeroImageS3Key = get(storyAlternateData, ["hero-image", "hero-image-s3-key"], "");
|
|
29
|
-
|
|
30
29
|
if (heroImageS3Key) {
|
|
31
30
|
slug = heroImageS3Key;
|
|
32
31
|
metadata = get(props, ["story", "hero-image-metadata"], {});
|
|
@@ -36,7 +35,6 @@ export function ResponsiveHeroImage(props) {
|
|
|
36
35
|
metadata = get(storyAlternateData, ["hero-image", "hero-image-metadata"], {});
|
|
37
36
|
alternateText = get(storyAlternateData, ["headline"], "");
|
|
38
37
|
} else return null;
|
|
39
|
-
|
|
40
38
|
return /*#__PURE__*/React.createElement(ResponsiveImage, Object.assign({
|
|
41
39
|
slug: slug,
|
|
42
40
|
metadata: metadata,
|
|
@@ -3,26 +3,21 @@ import React from "react";
|
|
|
3
3
|
import { ThumborImage } from "./impl/thumbor-image";
|
|
4
4
|
import { string, arrayOf, number, object } from 'prop-types';
|
|
5
5
|
import { GumletImage } from "./impl/gumlet-image";
|
|
6
|
-
|
|
7
6
|
function mapStateToProps(state) {
|
|
8
7
|
return {
|
|
9
8
|
imageCDN: state.qt.config["cdn-image"],
|
|
10
9
|
imageCDNFormat: state.qt.config["image-cdn-format"] || "thumbor"
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
function ResponsiveImageBase(props) {
|
|
15
13
|
if (process.env.NODE_ENV == 'development' && !props.alt && !props.reactTag) {
|
|
16
14
|
global.console && global.console.warn("Image Found without an alt attribute: ".concat(props.slug));
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
if (props.imageCDNFormat === "gumlet") {
|
|
20
17
|
return /*#__PURE__*/React.createElement(GumletImage, props);
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
return /*#__PURE__*/React.createElement(ThumborImage, props);
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
/**
|
|
27
22
|
* This component takes an image, and resizes it to the correct aspect ratio using imgix or thumbor.
|
|
28
23
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ResponsiveImage } from './responsive-image';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* This component is to be used if the aspect of an images changes significantly between different devices.
|
|
5
6
|
*
|
|
@@ -32,7 +33,6 @@ import { ResponsiveImage } from './responsive-image';
|
|
|
32
33
|
* @component
|
|
33
34
|
* @category Images
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
36
|
export var ResponsiveSource = function ResponsiveSource(props) {
|
|
37
37
|
return /*#__PURE__*/React.createElement(ResponsiveImage, Object.assign({
|
|
38
38
|
reactTag: 'source',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bool, element, number, string } from "prop-types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { StarIcon } from "./star-icon";
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* This component takes in the value for rating and renders star for the value passed in. This comopent is generally used for story review type.
|
|
6
7
|
*
|
|
@@ -14,31 +15,29 @@ import { StarIcon } from "./star-icon";
|
|
|
14
15
|
* @component
|
|
15
16
|
* @category Story Page
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
18
|
export function ReviewRating(_ref) {
|
|
19
19
|
var value = _ref.value,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
20
|
+
_ref$canShowEmptyRati = _ref.canShowEmptyRating,
|
|
21
|
+
canShowEmptyRating = _ref$canShowEmptyRati === void 0 ? false : _ref$canShowEmptyRati,
|
|
22
|
+
_ref$size = _ref.size,
|
|
23
|
+
size = _ref$size === void 0 ? 20 : _ref$size,
|
|
24
|
+
_ref$activeColor = _ref.activeColor,
|
|
25
|
+
activeColor = _ref$activeColor === void 0 ? "gold" : _ref$activeColor,
|
|
26
|
+
_ref$inActiveColor = _ref.inActiveColor,
|
|
27
|
+
inActiveColor = _ref$inActiveColor === void 0 ? "gray" : _ref$inActiveColor,
|
|
28
|
+
_ref$count = _ref.count,
|
|
29
|
+
count = _ref$count === void 0 ? 5 : _ref$count,
|
|
30
|
+
_ref$showHalfStar = _ref.showHalfStar,
|
|
31
|
+
showHalfStar = _ref$showHalfStar === void 0 ? true : _ref$showHalfStar,
|
|
32
|
+
_ref$className = _ref.className,
|
|
33
|
+
className = _ref$className === void 0 ? "review-rating" : _ref$className,
|
|
34
|
+
_ref$activeSymbol = _ref.activeSymbol,
|
|
35
|
+
activeSymbol = _ref$activeSymbol === void 0 ? null : _ref$activeSymbol,
|
|
36
|
+
_ref$inActiveSymbol = _ref.inActiveSymbol,
|
|
37
|
+
inActiveSymbol = _ref$inActiveSymbol === void 0 ? null : _ref$inActiveSymbol,
|
|
38
|
+
_ref$halfActiveSymbol = _ref.halfActiveSymbol,
|
|
39
|
+
halfActiveSymbol = _ref$halfActiveSymbol === void 0 ? null : _ref$halfActiveSymbol;
|
|
40
40
|
if (!canShowEmptyRating && value < 0.1) return null;
|
|
41
|
-
|
|
42
41
|
var activeComponent = function activeComponent(index) {
|
|
43
42
|
return activeSymbol ? /*#__PURE__*/React.cloneElement(activeSymbol, {
|
|
44
43
|
size: size,
|
|
@@ -55,7 +54,6 @@ export function ReviewRating(_ref) {
|
|
|
55
54
|
"data-test-id": "star-icon"
|
|
56
55
|
});
|
|
57
56
|
};
|
|
58
|
-
|
|
59
57
|
var inActiveComponent = function inActiveComponent(index) {
|
|
60
58
|
return inActiveSymbol ? /*#__PURE__*/React.cloneElement(inActiveSymbol, {
|
|
61
59
|
size: size,
|
|
@@ -71,7 +69,6 @@ export function ReviewRating(_ref) {
|
|
|
71
69
|
key: "review-".concat(index)
|
|
72
70
|
});
|
|
73
71
|
};
|
|
74
|
-
|
|
75
72
|
var halfActiveComponent = function halfActiveComponent(index) {
|
|
76
73
|
return halfActiveSymbol ? /*#__PURE__*/React.cloneElement(halfActiveSymbol, {
|
|
77
74
|
size: size,
|
|
@@ -87,9 +84,7 @@ export function ReviewRating(_ref) {
|
|
|
87
84
|
key: "review-".concat(index)
|
|
88
85
|
});
|
|
89
86
|
};
|
|
90
|
-
|
|
91
87
|
var children = [];
|
|
92
|
-
|
|
93
88
|
for (var i = 1; i <= count; i++) {
|
|
94
89
|
if (i <= Math.floor(value)) {
|
|
95
90
|
children.push(activeComponent(i));
|
|
@@ -99,7 +94,6 @@ export function ReviewRating(_ref) {
|
|
|
99
94
|
children.push(inActiveComponent(i));
|
|
100
95
|
}
|
|
101
96
|
}
|
|
102
|
-
|
|
103
97
|
return /*#__PURE__*/React.createElement("div", {
|
|
104
98
|
className: className
|
|
105
99
|
}, children);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
2
|
var StarIcon = function StarIcon(_ref) {
|
|
4
3
|
var size = _ref.size,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
foregroundColor = _ref.foregroundColor,
|
|
5
|
+
backgroundColor = _ref.backgroundColor,
|
|
6
|
+
className = _ref.className;
|
|
8
7
|
return /*#__PURE__*/React.createElement("svg", {
|
|
9
8
|
className: className,
|
|
10
9
|
width: size,
|
|
@@ -22,5 +21,4 @@ var StarIcon = function StarIcon(_ref) {
|
|
|
22
21
|
fill: foregroundColor
|
|
23
22
|
})));
|
|
24
23
|
};
|
|
25
|
-
|
|
26
24
|
export { StarIcon };
|
|
@@ -3,32 +3,23 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
6
|
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); }; }
|
|
8
|
-
|
|
9
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
8
|
import { any, element, func, string } from 'prop-types';
|
|
12
9
|
import React from 'react';
|
|
13
10
|
import { connect } from "react-redux";
|
|
14
|
-
|
|
15
11
|
var SearchBoxBase = /*#__PURE__*/function (_React$Component) {
|
|
16
12
|
_inherits(SearchBoxBase, _React$Component);
|
|
17
|
-
|
|
18
13
|
var _super = /*#__PURE__*/_createSuper(SearchBoxBase);
|
|
19
|
-
|
|
20
14
|
function SearchBoxBase(props) {
|
|
21
15
|
var _this;
|
|
22
|
-
|
|
23
16
|
_classCallCheck(this, SearchBoxBase);
|
|
24
|
-
|
|
25
17
|
_this = _super.call(this, props);
|
|
26
18
|
_this.state = {
|
|
27
19
|
query: _this.props.initValue || ""
|
|
28
20
|
};
|
|
29
21
|
return _this;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
_createClass(SearchBoxBase, [{
|
|
33
24
|
key: "componentDidMount",
|
|
34
25
|
value: function componentDidMount() {
|
|
@@ -55,7 +46,6 @@ var SearchBoxBase = /*#__PURE__*/function (_React$Component) {
|
|
|
55
46
|
key: "render",
|
|
56
47
|
value: function render() {
|
|
57
48
|
var _this2 = this;
|
|
58
|
-
|
|
59
49
|
var Render = this.props.template || this.defaultTemplate;
|
|
60
50
|
return /*#__PURE__*/React.createElement("form", {
|
|
61
51
|
role: "search",
|
|
@@ -92,14 +82,11 @@ var SearchBoxBase = /*#__PURE__*/function (_React$Component) {
|
|
|
92
82
|
return children;
|
|
93
83
|
}
|
|
94
84
|
}]);
|
|
95
|
-
|
|
96
85
|
return SearchBoxBase;
|
|
97
86
|
}(React.Component);
|
|
98
|
-
|
|
99
87
|
var mapStateToProps = function mapStateToProps(state) {
|
|
100
88
|
return {};
|
|
101
89
|
};
|
|
102
|
-
|
|
103
90
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
104
91
|
return {
|
|
105
92
|
navigateTo: function navigateTo(url) {
|
|
@@ -107,6 +94,7 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
107
94
|
}
|
|
108
95
|
};
|
|
109
96
|
};
|
|
97
|
+
|
|
110
98
|
/**
|
|
111
99
|
* This component provides a form with a search text box. On submit, the user is redirected to the search page via AJAX.
|
|
112
100
|
*
|
|
@@ -121,6 +109,4 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
121
109
|
* @component
|
|
122
110
|
* @category Header
|
|
123
111
|
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
112
|
export var SearchBox = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(SearchBoxBase);
|
|
@@ -3,15 +3,13 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
6
|
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); }; }
|
|
8
|
-
|
|
9
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
8
|
import React from 'react';
|
|
12
9
|
import get from "lodash/get";
|
|
13
10
|
import { getRequest } from './api-client';
|
|
14
11
|
import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
12
|
+
|
|
15
13
|
/**
|
|
16
14
|
* This component is to handle search functionality and also handles load more.
|
|
17
15
|
*
|
|
@@ -31,18 +29,13 @@ import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
|
31
29
|
* @deprecated
|
|
32
30
|
* @category Other
|
|
33
31
|
*/
|
|
34
|
-
|
|
35
32
|
export var SearchPageBase = /*#__PURE__*/function (_React$Component) {
|
|
36
33
|
_inherits(SearchPageBase, _React$Component);
|
|
37
|
-
|
|
38
34
|
var _super = /*#__PURE__*/_createSuper(SearchPageBase);
|
|
39
|
-
|
|
40
35
|
function SearchPageBase() {
|
|
41
36
|
_classCallCheck(this, SearchPageBase);
|
|
42
|
-
|
|
43
37
|
return _super.apply(this, arguments);
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
_createClass(SearchPageBase, [{
|
|
47
40
|
key: "search",
|
|
48
41
|
value: function search(pageNumber) {
|
|
@@ -57,7 +50,6 @@ export var SearchPageBase = /*#__PURE__*/function (_React$Component) {
|
|
|
57
50
|
key: "render",
|
|
58
51
|
value: function render() {
|
|
59
52
|
var _this = this;
|
|
60
|
-
|
|
61
53
|
return /*#__PURE__*/React.createElement(LoadMoreStoriesManager, Object.assign({}, this.props.data, {
|
|
62
54
|
template: this.props.template,
|
|
63
55
|
loadStories: function loadStories(pageNumber) {
|
|
@@ -66,6 +58,5 @@ export var SearchPageBase = /*#__PURE__*/function (_React$Component) {
|
|
|
66
58
|
}));
|
|
67
59
|
}
|
|
68
60
|
}]);
|
|
69
|
-
|
|
70
61
|
return SearchPageBase;
|
|
71
62
|
}(React.Component);
|