@quintype/arrow 3.15.1-perf.4 → 3.15.1-perf.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/cjs/index.js +14589 -0
- package/package.json +1 -1
- package/atoms/Author/index.js +0 -170
- package/atoms/Author/styles.arrow.css +0 -1
- package/atoms/AuthorWithTime/index.js +0 -514
- package/atoms/AuthorWithTime/styles.arrow.css +0 -1
- package/atoms/CollectionName/index.js +0 -255
- package/atoms/CollectionName/styles.arrow.css +0 -1
- package/atoms/ExtendedLoadMore/index-0f809dd9.js +0 -254
- package/atoms/ExtendedLoadMore/index-142f015c.js +0 -476
- package/atoms/ExtendedLoadMore/index-37a9ccff.js +0 -182
- package/atoms/ExtendedLoadMore/index-446679c8.js +0 -191
- package/atoms/ExtendedLoadMore/index-44f97338.js +0 -300
- package/atoms/ExtendedLoadMore/index-57dd4870.js +0 -239
- package/atoms/ExtendedLoadMore/index-66dd4dbd.js +0 -215
- package/atoms/ExtendedLoadMore/index-8462c597.js +0 -363
- package/atoms/ExtendedLoadMore/index-93cb06d1.js +0 -1016
- package/atoms/ExtendedLoadMore/index-afd44863.js +0 -95
- package/atoms/ExtendedLoadMore/index-b5754c5d.js +0 -195
- package/atoms/ExtendedLoadMore/index-bbaf526e.js +0 -256
- package/atoms/ExtendedLoadMore/index-cfb262ef.js +0 -192
- package/atoms/ExtendedLoadMore/index.js +0 -20
- package/atoms/ExtendedLoadMore/styles.arrow.css +0 -1
- package/atoms/Headline/index.js +0 -379
- package/atoms/Headline/styles.arrow.css +0 -1
- package/atoms/HeroImage/index.js +0 -336
- package/atoms/HeroImage/styles.arrow.css +0 -1
- package/atoms/LoadmoreButton/index.js +0 -175
- package/atoms/LoadmoreButton/styles.arrow.css +0 -1
- package/atoms/ScrollSnap/index.js +0 -379
- package/atoms/ScrollSnap/styles.arrow.css +0 -1
- package/atoms/SectionTag/index.js +0 -140
- package/atoms/SectionTag/styles.arrow.css +0 -1
- package/atoms/Subheadline/index.js +0 -120
- package/atoms/Subheadline/styles.arrow.css +0 -1
- package/atoms/TimeStamp/index.js +0 -221
- package/atoms/TimeStamp/styles.arrow.css +0 -1
- package/molecules/KeyEvents/index.js +0 -457
- package/molecules/KeyEvents/styles.arrow.css +0 -1
- package/molecules/PageIntroductionCard/index.js +0 -248
- package/molecules/PageIntroductionCard/styles.arrow.css +0 -1
- package/molecules/SocialShareTemplate/index.js +0 -506
- package/molecules/SocialShareTemplate/styles.arrow.css +0 -1
- package/molecules/StoryCard/index.js +0 -1430
- package/molecules/StoryCard/styles.arrow.css +0 -1
- package/molecules/StoryElementCard/index.js +0 -3091
- package/molecules/StoryElementCard/styles.arrow.css +0 -1
- package/molecules/StorycardContent/index.js +0 -976
- package/molecules/StorycardContent/styles.arrow.css +0 -1
- package/rows/AlternateCollectionFilter/index.js +0 -2189
- package/rows/AlternateCollectionFilter/styles.arrow.css +0 -1
- package/rows/AsideCollection/index.js +0 -2135
- package/rows/AsideCollection/styles.arrow.css +0 -1
- package/rows/AstrologyCollection/index.js +0 -2106
- package/rows/AstrologyCollection/styles.arrow.css +0 -1
- package/rows/AuthorIntroductionCard/index.js +0 -813
- package/rows/AuthorIntroductionCard/styles.arrow.css +0 -1
- package/rows/AuthorsList/index.js +0 -996
- package/rows/AuthorsList/styles.arrow.css +0 -1
- package/rows/CollectionFilter/index.js +0 -2279
- package/rows/CollectionFilter/styles.arrow.css +0 -1
- package/rows/ElevenStories/index.js +0 -2118
- package/rows/ElevenStories/styles.arrow.css +0 -1
- package/rows/FourColFiveStories/index.js +0 -1861
- package/rows/FourColFiveStories/styles.arrow.css +0 -1
- package/rows/FourColGrid/index.js +0 -2083
- package/rows/FourColGrid/styles.arrow.css +0 -1
- package/rows/FourColPortraitStories/index.js +0 -2116
- package/rows/FourColPortraitStories/styles.arrow.css +0 -1
- package/rows/FourColSixteenStories/index.js +0 -1849
- package/rows/FourColSixteenStories/styles.arrow.css +0 -1
- package/rows/FourColTwelveStories/index.js +0 -1822
- package/rows/FourColTwelveStories/styles.arrow.css +0 -1
- package/rows/FourStorySlider/index.js +0 -2223
- package/rows/FourStorySlider/styles.arrow.css +0 -1
- package/rows/FourStorySliderPortrait/index.js +0 -2226
- package/rows/FourStorySliderPortrait/styles.arrow.css +0 -1
- package/rows/FourTabbedBigStorySlider/index.js +0 -1985
- package/rows/FourTabbedBigStorySlider/styles.arrow.css +0 -1
- package/rows/FullScreenSlider/index.js +0 -2141
- package/rows/FullScreenSlider/styles.arrow.css +0 -1
- package/rows/HalfScreenSlider/index.js +0 -1994
- package/rows/HalfScreenSlider/styles.arrow.css +0 -1
- package/rows/ListComponent/index.js +0 -1942
- package/rows/ListComponent/styles.arrow.css +0 -1
- package/rows/Listicles/index.js +0 -945
- package/rows/Listicles/styles.arrow.css +0 -1
- package/rows/MagazineEditions/index.js +0 -690
- package/rows/MagazineEditions/styles.arrow.css +0 -1
- package/rows/MagazineHeaderCard/index.js +0 -684
- package/rows/MagazineHeaderCard/styles.arrow.css +0 -1
- package/rows/MagazineWidget/index.js +0 -1994
- package/rows/MagazineWidget/styles.arrow.css +0 -1
- package/rows/OneColStoryList/index.js +0 -2169
- package/rows/OneColStoryList/styles.arrow.css +0 -1
- package/rows/OpinionCollection/index.js +0 -1545
- package/rows/OpinionCollection/styles.arrow.css +0 -1
- package/rows/SixColSixStories/index.js +0 -2014
- package/rows/SixColSixStories/styles.arrow.css +0 -1
- package/rows/StoryCollection/index.js +0 -2135
- package/rows/StoryCollection/styles.arrow.css +0 -1
- package/rows/TagIntroductionCard/index.js +0 -103
- package/rows/TagIntroductionCard/styles.arrow.css +0 -1
- package/rows/ThreeColFlexStories/index.js +0 -2074
- package/rows/ThreeColFlexStories/styles.arrow.css +0 -1
- package/rows/ThreeColFourteenStories/index.js +0 -1770
- package/rows/ThreeColFourteenStories/styles.arrow.css +0 -1
- package/rows/ThreeColGrid/index.js +0 -2104
- package/rows/ThreeColGrid/styles.arrow.css +0 -1
- package/rows/ThreeColSevenStory/index.js +0 -1982
- package/rows/ThreeColSevenStory/styles.arrow.css +0 -1
- package/rows/ThreeColSixStories/index.js +0 -1965
- package/rows/ThreeColSixStories/styles.arrow.css +0 -1
- package/rows/ThreeColTwelveStories/index.js +0 -1854
- package/rows/ThreeColTwelveStories/styles.arrow.css +0 -1
- package/rows/TwoColFourStories/index.js +0 -1943
- package/rows/TwoColFourStories/styles.arrow.css +0 -1
- package/rows/TwoColFourStoryHighlight/index.js +0 -1930
- package/rows/TwoColFourStoryHighlight/styles.arrow.css +0 -1
- package/rows/TwoColSevenStories/index.js +0 -1970
- package/rows/TwoColSevenStories/styles.arrow.css +0 -1
- package/rows/TwoColSixStories/index.js +0 -1963
- package/rows/TwoColSixStories/styles.arrow.css +0 -1
- package/rows/TwoColTenStoriesSidebar/index.js +0 -2029
- package/rows/TwoColTenStoriesSidebar/styles.arrow.css +0 -1
- package/rows/TwoColThreeStories/index.js +0 -1916
- package/rows/TwoColThreeStories/styles.arrow.css +0 -1
- package/story-elements/AlsoRead/index.js +0 -320
- package/story-elements/AlsoRead/styles.arrow.css +0 -1
- package/story-elements/Attachment/index.js +0 -167
- package/story-elements/Attachment/styles.arrow.css +0 -1
- package/story-elements/BigFact/index.js +0 -137
- package/story-elements/BigFact/styles.arrow.css +0 -1
- package/story-elements/BlockQuote/index.js +0 -304
- package/story-elements/BlockQuote/styles.arrow.css +0 -1
- package/story-elements/Blurb/index.js +0 -189
- package/story-elements/Blurb/styles.arrow.css +0 -1
- package/story-elements/Image/index.js +0 -529
- package/story-elements/Image/styles.arrow.css +0 -1
- package/story-elements/ImageGallery/index.js +0 -462
- package/story-elements/ImageGallery/styles.arrow.css +0 -1
- package/story-elements/ImageSlideshow/index.js +0 -773
- package/story-elements/ImageSlideshow/styles.arrow.css +0 -1
- package/story-elements/QuestionAnswer/index.js +0 -267
- package/story-elements/QuestionAnswer/styles.arrow.css +0 -1
- package/story-elements/Quote/index.js +0 -166
- package/story-elements/Quote/styles.arrow.css +0 -1
- package/story-elements/Reference/index.js +0 -160
- package/story-elements/Reference/styles.arrow.css +0 -1
- package/story-elements/StoryElement/index.js +0 -75
- package/story-elements/Summary/index.js +0 -190
- package/story-elements/Summary/styles.arrow.css +0 -1
- package/story-elements/Text/index.js +0 -165
- package/story-elements/Text/styles.arrow.css +0 -1
- package/story-elements/Video/index.js +0 -81
- package/story-elements/Video/styles.arrow.css +0 -1
- package/story-templates/ListicleStoryTemplate/index.js +0 -5586
- package/story-templates/ListicleStoryTemplate/styles.arrow.css +0 -1
- package/story-templates/LiveBlogStoryTemplate/index.js +0 -5762
- package/story-templates/LiveBlogStoryTemplate/styles.arrow.css +0 -1
- package/story-templates/PhotoStoryTemplate/index.js +0 -5564
- package/story-templates/PhotoStoryTemplate/styles.arrow.css +0 -1
- package/story-templates/TextStoryTemplate/index.js +0 -5637
- package/story-templates/TextStoryTemplate/styles.arrow.css +0 -1
- package/story-templates/VideoStoryTemplate/index.js +0 -5496
- package/story-templates/VideoStoryTemplate/styles.arrow.css +0 -1
|
@@ -1,1545 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _getClassName = require('babel-plugin-react-css-modules/dist/browser/getClassName');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var reactRedux = require('react-redux');
|
|
9
|
-
var lodash = require('lodash');
|
|
10
|
-
var PropTypes = require('prop-types');
|
|
11
|
-
var components = require('@quintype/components');
|
|
12
|
-
require('@babel/runtime/helpers/asyncToGenerator');
|
|
13
|
-
require('@babel/runtime/helpers/typeof');
|
|
14
|
-
require('@babel/runtime/regenerator');
|
|
15
|
-
var Timeago = require('react-timeago');
|
|
16
|
-
var dateFnsTz = require('date-fns-tz');
|
|
17
|
-
var ReactDOM = require('react-dom');
|
|
18
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
19
|
-
|
|
20
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
|
-
|
|
22
|
-
function _interopNamespace(e) {
|
|
23
|
-
if (e && e.__esModule) return e;
|
|
24
|
-
var n = Object.create(null);
|
|
25
|
-
if (e) {
|
|
26
|
-
Object.keys(e).forEach(function (k) {
|
|
27
|
-
if (k !== 'default') {
|
|
28
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
29
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () { return e[k]; }
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
n["default"] = e;
|
|
37
|
-
return Object.freeze(n);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
41
|
-
var _getClassName__default = /*#__PURE__*/_interopDefaultLegacy(_getClassName);
|
|
42
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
43
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
44
|
-
var Timeago__default = /*#__PURE__*/_interopDefaultLegacy(Timeago);
|
|
45
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
46
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
47
|
-
|
|
48
|
-
var StateContext = /*#__PURE__*/React.createContext(); // eslint-disable-next-line react/display-name
|
|
49
|
-
|
|
50
|
-
var StateProvider = function StateProvider(RowComponent) {
|
|
51
|
-
return function (props) {
|
|
52
|
-
return (
|
|
53
|
-
/*#__PURE__*/
|
|
54
|
-
// eslint-disable-next-line react/prop-types
|
|
55
|
-
React__default["default"].createElement(StateContext.Provider, {
|
|
56
|
-
value: props.config
|
|
57
|
-
}, /*#__PURE__*/React__default["default"].createElement(RowComponent, props))
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
var useStateValue = function useStateValue() {
|
|
62
|
-
return React.useContext(StateContext);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
var timestampToFormat = function timestampToFormat(value, unit, suffix, timestamp) {
|
|
66
|
-
var config = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
67
|
-
var _config$showTime = config.showTime,
|
|
68
|
-
showTime = _config$showTime === void 0 ? false : _config$showTime,
|
|
69
|
-
_config$isTimeFirst = config.isTimeFirst,
|
|
70
|
-
isTimeFirst = _config$isTimeFirst === void 0 ? false : _config$isTimeFirst,
|
|
71
|
-
_config$isUpperCase = config.isUpperCase,
|
|
72
|
-
isUpperCase = _config$isUpperCase === void 0 ? false : _config$isUpperCase,
|
|
73
|
-
_config$disableMeridi = config.disableMeridiem,
|
|
74
|
-
disableMeridiem = _config$disableMeridi === void 0 ? false : _config$disableMeridi,
|
|
75
|
-
_config$timeFormat = config.timeFormat,
|
|
76
|
-
timeFormat = _config$timeFormat === void 0 ? "12hours" : _config$timeFormat;
|
|
77
|
-
var monthList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
78
|
-
var dateTime = new Date(timestamp);
|
|
79
|
-
var date = dateTime.getDate().toString().padStart(2, 0);
|
|
80
|
-
var month = monthList[dateTime.getMonth()];
|
|
81
|
-
var localizedMonth = month;
|
|
82
|
-
|
|
83
|
-
if (isUpperCase) {
|
|
84
|
-
localizedMonth = lodash.upperCase(month);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var year = dateTime.getFullYear();
|
|
88
|
-
var localizedMeridiem = config.localizedMeridiem,
|
|
89
|
-
localizedMonths = config.localizedMonths,
|
|
90
|
-
_config$direction = config.direction,
|
|
91
|
-
direction = _config$direction === void 0 ? "ltr" : _config$direction;
|
|
92
|
-
var time = formatAMPM(timestamp, timeFormat);
|
|
93
|
-
var timeWithLocalizedMeridiem = time;
|
|
94
|
-
var timetoShow;
|
|
95
|
-
|
|
96
|
-
if (localizedMonths) {
|
|
97
|
-
localizedMonth = lodash.get(localizedMonths, [lodash.lowerCase(month)]) || month;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (localizedMeridiem) {
|
|
101
|
-
var isAm = time.includes("am");
|
|
102
|
-
var _localizedMeridiem$am = localizedMeridiem.am,
|
|
103
|
-
am = _localizedMeridiem$am === void 0 ? "am" : _localizedMeridiem$am,
|
|
104
|
-
_localizedMeridiem$pm = localizedMeridiem.pm,
|
|
105
|
-
pm = _localizedMeridiem$pm === void 0 ? "pm" : _localizedMeridiem$pm;
|
|
106
|
-
timeWithLocalizedMeridiem = (isAm ? time.replace("am", am) : time.replace("pm", pm)) || time;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (direction === "rtl") {
|
|
110
|
-
timetoShow = showTime ? "".concat(timeWithLocalizedMeridiem) : "";
|
|
111
|
-
return "".concat(date, " ").concat(localizedMonth, ", ").concat(year, " ").concat(timetoShow, " ");
|
|
112
|
-
} else {
|
|
113
|
-
if (disableMeridiem) {
|
|
114
|
-
return "".concat(localizedMonth, " ").concat(date, ", ").concat(year);
|
|
115
|
-
} else if (isTimeFirst) {
|
|
116
|
-
return "".concat(timeWithLocalizedMeridiem, ", ").concat(date, " ").concat(localizedMonth, " ").concat(year);
|
|
117
|
-
} else {
|
|
118
|
-
timetoShow = showTime ? ", ".concat(timeWithLocalizedMeridiem) : "";
|
|
119
|
-
return "".concat(date, " ").concat(localizedMonth, ", ").concat(year).concat(timetoShow);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
function formatter(value, unit, suffix, date, config) {
|
|
124
|
-
var showDateForUnits = ["day", "week", "month", "year"]; // suffix here refers to ago
|
|
125
|
-
// unit here refers to seconds, minute, minutes,...
|
|
126
|
-
|
|
127
|
-
var localizedSuffix = lodash.get(config, ["localizedPublishTime", suffix]) || suffix;
|
|
128
|
-
var localizedUnitOfTime;
|
|
129
|
-
|
|
130
|
-
if (unit === "hour" && value > 23 || showDateForUnits.indexOf(unit) !== -1) {
|
|
131
|
-
return timestampToFormat(value, unit, suffix, date, config);
|
|
132
|
-
} else if (value > 1) {
|
|
133
|
-
localizedUnitOfTime = lodash.get(config, ["localizedPublishTime", "".concat(unit, "s")]) || "".concat(unit, "s");
|
|
134
|
-
return "".concat(value, " ").concat(localizedUnitOfTime, " ").concat(localizedSuffix);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
localizedUnitOfTime = lodash.get(config, ["localizedPublishTime", unit]) || unit;
|
|
138
|
-
return "".concat(value, " ").concat(localizedUnitOfTime, " ").concat(localizedSuffix, " ");
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function formatAMPM(timestamp) {
|
|
142
|
-
var timeFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "12hours";
|
|
143
|
-
var dateTime = new Date(timestamp);
|
|
144
|
-
var hours = dateTime.getHours();
|
|
145
|
-
var minutes = dateTime.getMinutes();
|
|
146
|
-
var ampm = hours >= 12 ? "pm" : "am";
|
|
147
|
-
hours = hours % 12;
|
|
148
|
-
hours = hours || 12;
|
|
149
|
-
minutes = minutes < 10 ? "0" + minutes : minutes;
|
|
150
|
-
var strTime = hours + ":" + minutes + " " + ampm;
|
|
151
|
-
|
|
152
|
-
if (timeFormat === "24hours") {
|
|
153
|
-
return dateTime.toLocaleTimeString([], {
|
|
154
|
-
hour: "2-digit",
|
|
155
|
-
minute: "2-digit"
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return strTime;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
var hexToRGB = function hexToRGB(hex) {
|
|
163
|
-
var r = parseInt(hex.slice(1, 3), 16);
|
|
164
|
-
var g = parseInt(hex.slice(3, 5), 16);
|
|
165
|
-
var b = parseInt(hex.slice(5, 7), 16);
|
|
166
|
-
return {
|
|
167
|
-
r: r,
|
|
168
|
-
g: g,
|
|
169
|
-
b: b
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
var getLuminanceOfColor = function getLuminanceOfColor(hex) {
|
|
173
|
-
var _hexToRGB = hexToRGB(hex),
|
|
174
|
-
r = _hexToRGB.r,
|
|
175
|
-
g = _hexToRGB.g,
|
|
176
|
-
b = _hexToRGB.b;
|
|
177
|
-
|
|
178
|
-
return r * 0.299 + g * 0.587 + b * 0.114;
|
|
179
|
-
};
|
|
180
|
-
var rgbToHex = function rgbToHex() {
|
|
181
|
-
var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgba(255, 255, 255, 0)";
|
|
182
|
-
var rgba = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
|
|
183
|
-
return rgba && rgba.length === 4 ? "#" + ("0" + parseInt(rgba[1], 10).toString(16)).slice(-2) + ("0" + parseInt(rgba[2], 10).toString(16)).slice(-2) + ("0" + parseInt(rgba[3], 10).toString(16)).slice(-2) : color;
|
|
184
|
-
};
|
|
185
|
-
var clientWidths = {
|
|
186
|
-
mobile: 767,
|
|
187
|
-
tablet: 1024
|
|
188
|
-
};
|
|
189
|
-
var clientWidth = function clientWidth(device) {
|
|
190
|
-
var foundDeviceWidth = lodash.get(clientWidths, device);
|
|
191
|
-
|
|
192
|
-
if (foundDeviceWidth) {
|
|
193
|
-
return lodash.get(global, "document.documentElement.clientWidth") <= foundDeviceWidth;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return false;
|
|
197
|
-
};
|
|
198
|
-
var getTextColor = function getTextColor() {
|
|
199
|
-
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgb(255,255,255)";
|
|
200
|
-
var isRegexCheck = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(theme);
|
|
201
|
-
var getHexValue = !isRegexCheck ? rgbToHex(theme) : theme;
|
|
202
|
-
var textColor = getLuminanceOfColor(getHexValue) < 155 ? "light" : "dark";
|
|
203
|
-
return textColor;
|
|
204
|
-
};
|
|
205
|
-
var getSlot = function getSlot(type, component, storyCallback, collectionCallback) {
|
|
206
|
-
switch (type) {
|
|
207
|
-
case "story":
|
|
208
|
-
return storyCallback();
|
|
209
|
-
|
|
210
|
-
case "collection":
|
|
211
|
-
return collectionCallback();
|
|
212
|
-
|
|
213
|
-
default:
|
|
214
|
-
return component ? component() : null;
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
var getSlug = function getSlug(collection) {
|
|
218
|
-
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
219
|
-
var _config$magazineSlug = config.magazineSlug,
|
|
220
|
-
magazineSlug = _config$magazineSlug === void 0 ? "" : _config$magazineSlug,
|
|
221
|
-
_config$isArchivePage = config.isArchivePage,
|
|
222
|
-
isArchivePage = _config$isArchivePage === void 0 ? false : _config$isArchivePage;
|
|
223
|
-
|
|
224
|
-
if (isArchivePage) {
|
|
225
|
-
return "/magazine/archive/".concat(magazineSlug);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (magazineSlug) {
|
|
229
|
-
return "/magazine/".concat(magazineSlug, "/").concat(collection.slug);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
var isSection = collection.template === "section";
|
|
233
|
-
|
|
234
|
-
if (isSection) {
|
|
235
|
-
var sectionId = lodash.get(collection, ["metadata", "section", "0", "id"], "");
|
|
236
|
-
var sections = config.sections;
|
|
237
|
-
var section = sections && sections.find(function (section) {
|
|
238
|
-
return section.id === sectionId;
|
|
239
|
-
});
|
|
240
|
-
return section ? section["section-url"] : "/";
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return "/collection/".concat(collection.slug);
|
|
244
|
-
};
|
|
245
|
-
function isExternalStory() {
|
|
246
|
-
var story = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
247
|
-
var _story$storyTemplate = story["story-template"],
|
|
248
|
-
storyTemplate = _story$storyTemplate === void 0 ? "" : _story$storyTemplate,
|
|
249
|
-
_story$metadata = story.metadata,
|
|
250
|
-
metadata = _story$metadata === void 0 ? {} : _story$metadata;
|
|
251
|
-
return storyTemplate === "news-elsewhere" ? lodash.get(metadata, ["reference-url"], "") : "";
|
|
252
|
-
} // Adds target='_blank' attribute to anchor tags if not present
|
|
253
|
-
PropTypes__default["default"].shape({
|
|
254
|
-
"sketches-host": PropTypes__default["default"].string,
|
|
255
|
-
"cdn-name": PropTypes__default["default"].string,
|
|
256
|
-
"cdn-image": PropTypes__default["default"].string
|
|
257
|
-
});
|
|
258
|
-
PropTypes__default["default"].shape({
|
|
259
|
-
headline: PropTypes__default["default"].string,
|
|
260
|
-
"last-published-at": PropTypes__default["default"].number,
|
|
261
|
-
subheadline: PropTypes__default["default"].string
|
|
262
|
-
});
|
|
263
|
-
var getStoryUrl = function getStoryUrl(story) {
|
|
264
|
-
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
265
|
-
return lodash.get(story, ["story-template"]) === "news-elsewhere" ? lodash.get(story, ["metadata", "reference-url"], "") : story.url || defaultValue;
|
|
266
|
-
};
|
|
267
|
-
var navigateTo = function navigateTo(dispatch) {
|
|
268
|
-
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
269
|
-
global.app.navigateToPage(dispatch, url);
|
|
270
|
-
};
|
|
271
|
-
var generateNavigateSlug = function generateNavigateSlug() {
|
|
272
|
-
var collection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
273
|
-
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
274
|
-
var customUrlPath = arguments.length > 2 ? arguments[2] : undefined;
|
|
275
|
-
|
|
276
|
-
if (customUrlPath) {
|
|
277
|
-
return customUrlPath;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
var _config$magazineSlug2 = config.magazineSlug,
|
|
281
|
-
magazineSlug = _config$magazineSlug2 === void 0 ? "" : _config$magazineSlug2,
|
|
282
|
-
_config$isArchivePage2 = config.isArchivePage,
|
|
283
|
-
isArchivePage = _config$isArchivePage2 === void 0 ? false : _config$isArchivePage2;
|
|
284
|
-
|
|
285
|
-
if (isArchivePage) {
|
|
286
|
-
return "/magazine/archive/".concat(magazineSlug);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (magazineSlug) {
|
|
290
|
-
return "/magazine/".concat(magazineSlug, "/").concat(collection.slug);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (collection) {
|
|
294
|
-
return getSlug(collection, config);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return "/";
|
|
298
|
-
};
|
|
299
|
-
var getTimeStamp = function getTimeStamp(date, _formatter) {
|
|
300
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
301
|
-
var template = arguments.length > 3 ? arguments[3] : undefined;
|
|
302
|
-
var timezone = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
303
|
-
|
|
304
|
-
if (timezone && template === "story") {
|
|
305
|
-
var zonedTime = timezone && dateFnsTz.utcToZonedTime(date, timezone);
|
|
306
|
-
var formatZonedTime = zonedTime && dateFnsTz.format(zonedTime, "yyyy-MM-dd'T'HH:mm:ssXXX", {
|
|
307
|
-
timeZone: timezone
|
|
308
|
-
});
|
|
309
|
-
var timeStamp = timestampToFormat("", "", "", date, config);
|
|
310
|
-
return /*#__PURE__*/React__default["default"].createElement("time", {
|
|
311
|
-
dateTime: formatZonedTime
|
|
312
|
-
}, timeStamp);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
return /*#__PURE__*/React__default["default"].createElement(Timeago__default["default"], {
|
|
316
|
-
date: date,
|
|
317
|
-
formatter: function formatter(value, unit, suffix, date) {
|
|
318
|
-
return _formatter(value, unit, suffix, date, config);
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
var _styleModuleImportMap$a = {
|
|
324
|
-
"./author.m.css": {
|
|
325
|
-
"author": "author-m_author__WRuLm",
|
|
326
|
-
"author-image": "author-m_author-image__3q2oc",
|
|
327
|
-
"author-name": "author-m_author-name__3WP-O",
|
|
328
|
-
"bottom-fix": "author-m_bottom-fix__223TT",
|
|
329
|
-
"prefix": "author-m_prefix__YSInK",
|
|
330
|
-
"rtl-image": "author-m_rtl-image__2nglD",
|
|
331
|
-
"ltr-image": "author-m_ltr-image__3bc0L",
|
|
332
|
-
"dark": "author-m_dark__2TTlp",
|
|
333
|
-
"light": "author-m_light__3y8_x"
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
var AuthorBase = function AuthorBase(_ref) {
|
|
338
|
-
var story = _ref.story,
|
|
339
|
-
hideAuthorImage = _ref.hideAuthorImage,
|
|
340
|
-
isBottom = _ref.isBottom,
|
|
341
|
-
_ref$prefix = _ref.prefix,
|
|
342
|
-
prefix = _ref$prefix === void 0 ? "" : _ref$prefix,
|
|
343
|
-
_ref$config = _ref.config,
|
|
344
|
-
config = _ref$config === void 0 ? {} : _ref$config;
|
|
345
|
-
var configData = useStateValue() || {};
|
|
346
|
-
var isAuthor = lodash.get(configData, ["showAuthor"], true);
|
|
347
|
-
|
|
348
|
-
var _get = lodash.get(story, ["authors", "0"], ""),
|
|
349
|
-
avatarUrl = _get["avatar-url"],
|
|
350
|
-
avatarS3Key = _get["avatar-s3-key"],
|
|
351
|
-
authorName = _get.name,
|
|
352
|
-
slug = _get.slug;
|
|
353
|
-
|
|
354
|
-
var isBottomClasses = isBottom ? "bottom-fix" : "";
|
|
355
|
-
var textColor = getTextColor(configData.theme);
|
|
356
|
-
var mountAt = lodash.get(config, ["mountAt"], "");
|
|
357
|
-
|
|
358
|
-
var authorImage = function authorImage(dir) {
|
|
359
|
-
if (!avatarUrl && !avatarS3Key) {
|
|
360
|
-
return null;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
364
|
-
"data-test-id": "author-image",
|
|
365
|
-
className: _getClassName__default["default"]("author-image ".concat(dir, "-image"), _styleModuleImportMap$a)
|
|
366
|
-
}, /*#__PURE__*/React__default["default"].createElement("figure", null, avatarS3Key ? /*#__PURE__*/React__default["default"].createElement(components.ResponsiveImage, {
|
|
367
|
-
slug: avatarS3Key,
|
|
368
|
-
"aspect-ratio": [1, 1],
|
|
369
|
-
defaultWidth: 400,
|
|
370
|
-
imgParams: {
|
|
371
|
-
auto: ["format", "compress"]
|
|
372
|
-
},
|
|
373
|
-
alt: authorName
|
|
374
|
-
}) : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
375
|
-
src: avatarUrl
|
|
376
|
-
})));
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
var isPrefix = function isPrefix(dir) {
|
|
380
|
-
if (prefix) {
|
|
381
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
382
|
-
className: "arr-author-prefix " + _getClassName__default["default"]("prefix ".concat(textColor), _styleModuleImportMap$a)
|
|
383
|
-
}, prefix);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
return !hideAuthorImage && authorImage(dir);
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isAuthor && /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
390
|
-
href: "".concat(mountAt, "/author/") + slug,
|
|
391
|
-
"aria-label": "author-name",
|
|
392
|
-
className: "author-name arr-author-name arrow-component " + _getClassName__default["default"]("author ".concat(isBottomClasses), _styleModuleImportMap$a)
|
|
393
|
-
}, isPrefix("ltr"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
394
|
-
"data-test-id": "author-name",
|
|
395
|
-
className: "author-name " + _getClassName__default["default"]("author-name ".concat(textColor), _styleModuleImportMap$a)
|
|
396
|
-
}, authorName || story["author-name"]), !prefix && isPrefix("rtl")));
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
function mapStateToProps$1(state) {
|
|
400
|
-
return {
|
|
401
|
-
config: lodash.get(state, ["qt", "config"], {})
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
var Author = reactRedux.connect(mapStateToProps$1)(AuthorBase);
|
|
406
|
-
AuthorBase.propTypes = {
|
|
407
|
-
/** The Story Object from the API response */
|
|
408
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
409
|
-
|
|
410
|
-
/** Hide Author Avatar Image */
|
|
411
|
-
hideAuthorImage: PropTypes__default["default"].bool,
|
|
412
|
-
// fix Author bottom of the storyCard
|
|
413
|
-
isBottom: PropTypes__default["default"].bool,
|
|
414
|
-
// fix prefix before the author name
|
|
415
|
-
prefix: PropTypes__default["default"].string,
|
|
416
|
-
config: PropTypes__default["default"].object
|
|
417
|
-
};
|
|
418
|
-
AuthorBase.defaultProps = {
|
|
419
|
-
hideAuthorImage: false,
|
|
420
|
-
isBottom: false,
|
|
421
|
-
prefix: ""
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
var CrownIcon = function CrownIcon(_ref) {
|
|
425
|
-
var height = _ref.height,
|
|
426
|
-
width = _ref.width,
|
|
427
|
-
_ref$color = _ref.color,
|
|
428
|
-
color = _ref$color === void 0 ? "#D8D8D8" : _ref$color,
|
|
429
|
-
positionTop = _ref.positionTop;
|
|
430
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
431
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
432
|
-
width: width,
|
|
433
|
-
height: height,
|
|
434
|
-
viewBox: "0 0 40 40",
|
|
435
|
-
style: {
|
|
436
|
-
position: "relative",
|
|
437
|
-
top: positionTop
|
|
438
|
-
}
|
|
439
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
440
|
-
fill: "none",
|
|
441
|
-
fillRule: "evenodd",
|
|
442
|
-
stroke: "none",
|
|
443
|
-
strokeWidth: "1"
|
|
444
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
445
|
-
transform: "translate(8 8)"
|
|
446
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
447
|
-
d: "M0 0H24V24H0z"
|
|
448
|
-
}), /*#__PURE__*/React__default["default"].createElement("g", {
|
|
449
|
-
fill: color,
|
|
450
|
-
fillRule: "nonzero",
|
|
451
|
-
transform: "translate(0 2)"
|
|
452
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
453
|
-
d: "M21.043 19.553c0-.743-.601-1.344-1.344-1.344h-15.4a1.343 1.343 0 100 2.688h15.4c.743 0 1.344-.603 1.344-1.344zM1.598 8.673c.022 0 .042 0 .064-.003l2.131 7.713h16.411l2.132-7.713c.022 0 .041.003.063.003a1.599 1.599 0 10-1.52-1.108L17.025 9.82 12.882 2.95a1.599 1.599 0 10-1.765 0L6.976 9.82 3.121 7.565a1.599 1.599 0 10-1.523 1.107z"
|
|
454
|
-
}))))));
|
|
455
|
-
};
|
|
456
|
-
CrownIcon.propTypes = {
|
|
457
|
-
height: PropTypes__default["default"].string,
|
|
458
|
-
width: PropTypes__default["default"].string,
|
|
459
|
-
color: PropTypes__default["default"].string,
|
|
460
|
-
positionTop: PropTypes__default["default"].string
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
var KeyIcon = function KeyIcon(_ref) {
|
|
464
|
-
var height = _ref.height,
|
|
465
|
-
width = _ref.width,
|
|
466
|
-
_ref$color = _ref.color,
|
|
467
|
-
color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
|
|
468
|
-
positionTop = _ref.positionTop;
|
|
469
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
470
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
471
|
-
width: width,
|
|
472
|
-
height: height,
|
|
473
|
-
viewBox: "0 0 40 40",
|
|
474
|
-
style: {
|
|
475
|
-
position: "relative",
|
|
476
|
-
top: positionTop
|
|
477
|
-
}
|
|
478
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
479
|
-
fill: "none",
|
|
480
|
-
fillRule: "evenodd",
|
|
481
|
-
stroke: "none",
|
|
482
|
-
strokeWidth: "1"
|
|
483
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
484
|
-
transform: "translate(8 8)"
|
|
485
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
486
|
-
d: "M0 0H24V24H0z"
|
|
487
|
-
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
|
488
|
-
fill: color,
|
|
489
|
-
fillRule: "nonzero",
|
|
490
|
-
d: "M12.71 4.364A6.54 6.54 0 000 6.545a6.54 6.54 0 0012.71 2.182h4.745v4.364h4.363V8.727H24V4.364H12.71zM6.544 8.727a2.181 2.181 0 110-4.362 2.181 2.181 0 010 4.362z",
|
|
491
|
-
transform: "translate(0 5)"
|
|
492
|
-
})))));
|
|
493
|
-
};
|
|
494
|
-
KeyIcon.propTypes = {
|
|
495
|
-
height: PropTypes__default["default"].string,
|
|
496
|
-
width: PropTypes__default["default"].string,
|
|
497
|
-
color: PropTypes__default["default"].string,
|
|
498
|
-
positionTop: PropTypes__default["default"].string
|
|
499
|
-
};
|
|
500
|
-
|
|
501
|
-
var LockIcon = function LockIcon(_ref) {
|
|
502
|
-
var height = _ref.height,
|
|
503
|
-
width = _ref.width,
|
|
504
|
-
_ref$color = _ref.color,
|
|
505
|
-
color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
|
|
506
|
-
positionTop = _ref.positionTop;
|
|
507
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
508
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
509
|
-
width: width,
|
|
510
|
-
height: height,
|
|
511
|
-
viewBox: "0 0 40 40",
|
|
512
|
-
style: {
|
|
513
|
-
position: "relative",
|
|
514
|
-
top: positionTop
|
|
515
|
-
}
|
|
516
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
517
|
-
fill: "none",
|
|
518
|
-
fillRule: "evenodd",
|
|
519
|
-
stroke: "none",
|
|
520
|
-
strokeWidth: "1"
|
|
521
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
522
|
-
transform: "translate(8 8)"
|
|
523
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
524
|
-
d: "M0 0H24V24H0z"
|
|
525
|
-
}), /*#__PURE__*/React__default["default"].createElement("g", {
|
|
526
|
-
fill: color,
|
|
527
|
-
fillRule: "nonzero",
|
|
528
|
-
transform: "translate(3)"
|
|
529
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
530
|
-
d: "M15.692 9h-.747V6c0-3.31-2.681-6-5.978-6C5.67 0 2.989 2.69 2.989 6v3h-.747A2.249 2.249 0 000 11.25v10.5A2.249 2.249 0 002.242 24h13.45a2.249 2.249 0 002.242-2.25v-10.5A2.249 2.249 0 0015.692 9zM4.982 6c0-2.206 1.787-4 3.985-4s3.985 1.794 3.985 4v3h-7.97V6z"
|
|
531
|
-
}))))));
|
|
532
|
-
};
|
|
533
|
-
LockIcon.propTypes = {
|
|
534
|
-
height: PropTypes__default["default"].string,
|
|
535
|
-
width: PropTypes__default["default"].string,
|
|
536
|
-
color: PropTypes__default["default"].string,
|
|
537
|
-
positionTop: PropTypes__default["default"].string
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
var StarIcon = function StarIcon(_ref) {
|
|
541
|
-
var width = _ref.width,
|
|
542
|
-
height = _ref.height,
|
|
543
|
-
_ref$color = _ref.color,
|
|
544
|
-
color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
|
|
545
|
-
_ref$positionTop = _ref.positionTop,
|
|
546
|
-
positionTop = _ref$positionTop === void 0 ? "" : _ref$positionTop;
|
|
547
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
548
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
549
|
-
width: width,
|
|
550
|
-
height: height,
|
|
551
|
-
viewBox: "0 0 40 40",
|
|
552
|
-
style: {
|
|
553
|
-
position: "relative",
|
|
554
|
-
top: positionTop
|
|
555
|
-
}
|
|
556
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
557
|
-
fill: "none",
|
|
558
|
-
fillRule: "evenodd",
|
|
559
|
-
stroke: "none",
|
|
560
|
-
strokeWidth: "1"
|
|
561
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
562
|
-
fill: color,
|
|
563
|
-
d: "M20 26L12.946577 29.7082039 14.2936609 21.854102 8.5873218 16.2917961 16.4732885 15.145898 20 8 23.5267115 15.145898 31.4126782 16.2917961 25.7063391 21.854102 27.053423 29.7082039z"
|
|
564
|
-
}))));
|
|
565
|
-
};
|
|
566
|
-
StarIcon.propTypes = {
|
|
567
|
-
height: PropTypes__default["default"].string,
|
|
568
|
-
width: PropTypes__default["default"].string,
|
|
569
|
-
color: PropTypes__default["default"].string,
|
|
570
|
-
positionTop: PropTypes__default["default"].string
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
var PremiumStoryIcon = function PremiumStoryIcon(_ref) {
|
|
574
|
-
var width = _ref.width,
|
|
575
|
-
height = _ref.height,
|
|
576
|
-
color = _ref.color,
|
|
577
|
-
iconType = _ref.iconType,
|
|
578
|
-
positionTop = _ref.positionTop;
|
|
579
|
-
|
|
580
|
-
switch (iconType) {
|
|
581
|
-
case "crown":
|
|
582
|
-
return /*#__PURE__*/React__default["default"].createElement(CrownIcon, {
|
|
583
|
-
width: width,
|
|
584
|
-
height: height,
|
|
585
|
-
color: color,
|
|
586
|
-
positionTop: positionTop
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
case "lock":
|
|
590
|
-
return /*#__PURE__*/React__default["default"].createElement(LockIcon, {
|
|
591
|
-
width: width,
|
|
592
|
-
height: height,
|
|
593
|
-
color: color,
|
|
594
|
-
positionTop: positionTop
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
case "key":
|
|
598
|
-
return /*#__PURE__*/React__default["default"].createElement(KeyIcon, {
|
|
599
|
-
width: width,
|
|
600
|
-
height: height,
|
|
601
|
-
color: color,
|
|
602
|
-
positionTop: positionTop
|
|
603
|
-
});
|
|
604
|
-
|
|
605
|
-
default:
|
|
606
|
-
return /*#__PURE__*/React__default["default"].createElement(StarIcon, {
|
|
607
|
-
width: width,
|
|
608
|
-
height: height,
|
|
609
|
-
color: color,
|
|
610
|
-
positionTop: positionTop
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
PremiumStoryIcon.propTypes = {
|
|
615
|
-
width: PropTypes__default["default"].string,
|
|
616
|
-
height: PropTypes__default["default"].string,
|
|
617
|
-
color: PropTypes__default["default"].string,
|
|
618
|
-
iconType: PropTypes__default["default"].string,
|
|
619
|
-
positionTop: PropTypes__default["default"].string
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
function LiveIcon() {
|
|
623
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
624
|
-
className: "live-icon",
|
|
625
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
626
|
-
width: "25",
|
|
627
|
-
height: "24",
|
|
628
|
-
viewBox: "0 0 25 24"
|
|
629
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
630
|
-
fill: "#ff5858",
|
|
631
|
-
d: "M12 18a6 6 0 110-12 6 6 0 010 12zm0 2.5a8.5 8.5 0 110-17 8.5 8.5 0 010 17zm0-1a7.5 7.5 0 100-15 7.5 7.5 0 000 15z"
|
|
632
|
-
}));
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
var _styleModuleImportMap$9 = {
|
|
636
|
-
"./headline.m.css": {
|
|
637
|
-
"wrapper": "headline-m_wrapper__3nUmh",
|
|
638
|
-
"headline": "headline-m_headline__3_NhV",
|
|
639
|
-
"dark": "headline-m_dark__en3hW",
|
|
640
|
-
"light": "headline-m_light__3lKJB"
|
|
641
|
-
}
|
|
642
|
-
};
|
|
643
|
-
var Headline = function Headline(_ref) {
|
|
644
|
-
var story = _ref.story,
|
|
645
|
-
headerLevel = _ref.headerLevel,
|
|
646
|
-
_ref$premiumStoryIcon = _ref.premiumStoryIconConfig,
|
|
647
|
-
premiumStoryIconConfig = _ref$premiumStoryIcon === void 0 ? {} : _ref$premiumStoryIcon,
|
|
648
|
-
isLink = _ref.isLink;
|
|
649
|
-
var configData = useStateValue() || {};
|
|
650
|
-
var _premiumStoryIconConf = premiumStoryIconConfig.iconColor,
|
|
651
|
-
iconColor = _premiumStoryIconConf === void 0 ? "#F7B500" : _premiumStoryIconConf,
|
|
652
|
-
_premiumStoryIconConf2 = premiumStoryIconConfig.iconStyle,
|
|
653
|
-
iconStyle = _premiumStoryIconConf2 === void 0 ? "star" : _premiumStoryIconConf2,
|
|
654
|
-
_premiumStoryIconConf3 = premiumStoryIconConfig.enablePremiumStoryIcon,
|
|
655
|
-
enablePremiumStoryIcon = _premiumStoryIconConf3 === void 0 ? false : _premiumStoryIconConf3,
|
|
656
|
-
_premiumStoryIconConf4 = premiumStoryIconConfig.showLiveIcon,
|
|
657
|
-
showLiveIcon = _premiumStoryIconConf4 === void 0 ? false : _premiumStoryIconConf4;
|
|
658
|
-
var alternateHeadline = lodash.get(story, ["alternative", "home", "default", "headline"]);
|
|
659
|
-
var premiumStory = enablePremiumStoryIcon && lodash.get(story, ["access"]) === "subscription";
|
|
660
|
-
var headline = alternateHeadline || story.headline;
|
|
661
|
-
var HeaderTag = "h" + headerLevel;
|
|
662
|
-
|
|
663
|
-
var positionHeadline = function positionHeadline() {
|
|
664
|
-
switch (parseInt(headerLevel)) {
|
|
665
|
-
case 1:
|
|
666
|
-
return "-2px";
|
|
667
|
-
|
|
668
|
-
case 2:
|
|
669
|
-
return "2px";
|
|
670
|
-
|
|
671
|
-
case 3:
|
|
672
|
-
return "4px";
|
|
673
|
-
|
|
674
|
-
case 4:
|
|
675
|
-
return "5px";
|
|
676
|
-
|
|
677
|
-
default:
|
|
678
|
-
return "6px";
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
|
|
682
|
-
var textColor = getTextColor(configData.theme);
|
|
683
|
-
var wrapperClass = premiumStory ? "wrapper" : "";
|
|
684
|
-
var iconSize = "24px";
|
|
685
|
-
var enableLiveIcon = showLiveIcon && story["story-template"] === "live-blog" && !lodash.get(story, ["metadata", "is-closed"], false);
|
|
686
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
687
|
-
"data-test-id": "headline",
|
|
688
|
-
className: "arrow-component arr--headline " + _getClassName__default["default"](wrapperClass, _styleModuleImportMap$9)
|
|
689
|
-
}, premiumStory && /*#__PURE__*/React__default["default"].createElement(PremiumStoryIcon, {
|
|
690
|
-
width: iconSize,
|
|
691
|
-
height: iconSize,
|
|
692
|
-
color: iconColor,
|
|
693
|
-
iconType: iconStyle,
|
|
694
|
-
positionTop: positionHeadline()
|
|
695
|
-
}), isLink ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
696
|
-
href: getStoryUrl(story, "/".concat(story.slug)),
|
|
697
|
-
externalLink: isExternalStory(story),
|
|
698
|
-
"aria-label": "headline"
|
|
699
|
-
}, /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
|
|
700
|
-
className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$9)
|
|
701
|
-
}, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
|
|
702
|
-
className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$9)
|
|
703
|
-
}, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline));
|
|
704
|
-
};
|
|
705
|
-
Headline.propTypes = {
|
|
706
|
-
/** The Story Object from the API response */
|
|
707
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
708
|
-
|
|
709
|
-
/** Header tags ranging h1-h6, where h[headerLevel] */
|
|
710
|
-
headerLevel: PropTypes__default["default"].string,
|
|
711
|
-
premiumStoryIconConfig: PropTypes__default["default"].shape({
|
|
712
|
-
iconColor: PropTypes__default["default"].string,
|
|
713
|
-
iconType: PropTypes__default["default"].string,
|
|
714
|
-
enablePremiumStoryIcon: PropTypes__default["default"].bool
|
|
715
|
-
}),
|
|
716
|
-
isLink: PropTypes__default["default"].bool
|
|
717
|
-
};
|
|
718
|
-
Headline.defaultProps = {
|
|
719
|
-
headerLevel: "6",
|
|
720
|
-
isLink: true
|
|
721
|
-
};
|
|
722
|
-
|
|
723
|
-
var UserFallbackIcon = function UserFallbackIcon(_ref) {
|
|
724
|
-
var _ref$width = _ref.width,
|
|
725
|
-
width = _ref$width === void 0 ? 120 : _ref$width,
|
|
726
|
-
_ref$height = _ref.height,
|
|
727
|
-
height = _ref$height === void 0 ? 120 : _ref$height;
|
|
728
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
729
|
-
width: width,
|
|
730
|
-
height: height,
|
|
731
|
-
viewBox: "0 0 120 120",
|
|
732
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
733
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
734
|
-
d: "M93.28 108.98c-1.055-17.675-15.47-31.678-33.098-31.678-17.708 0-32.173 14.129-33.11 31.916 9.415 6.311 20.741 9.993 32.927 9.993 12.338 0 23.795-3.774 33.28-10.23l.001-.001zM58.584 73.283c9.928 0 17.977-8.275 17.977-18.483 0-10.209-8.049-18.484-17.977-18.484-9.929 0-17.977 8.275-17.977 18.484 0 10.208 8.048 18.483 17.977 18.483zM60 120C26.863 120 0 93.137 0 60S26.863 0 60 0s60 26.863 60 60-26.863 60-60 60z",
|
|
735
|
-
fill: "#DADADA",
|
|
736
|
-
fillRule: "nonzero"
|
|
737
|
-
}));
|
|
738
|
-
};
|
|
739
|
-
UserFallbackIcon.propTypes = {
|
|
740
|
-
width: PropTypes__default["default"].object,
|
|
741
|
-
height: PropTypes__default["default"].object
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
var _styleModuleImportMap$8 = {
|
|
745
|
-
"./author-image.m.css": {
|
|
746
|
-
"viewports": "\"../../../../assets/stylesheets/viewports.m.css\"",
|
|
747
|
-
"mobile": "768px",
|
|
748
|
-
"tablet": "992px",
|
|
749
|
-
"image-container": "author-image-m_image-container__19WNd",
|
|
750
|
-
"author-image": "author-image-m_author-image__D8GMB",
|
|
751
|
-
"square": "author-image-m_square__bjK7M",
|
|
752
|
-
"small-circle": "author-image-m_small-circle__DbQMN",
|
|
753
|
-
"smaller-circle": "author-image-m_smaller-circle__2yMOZ"
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
var authorWithImage = function authorWithImage(author, templateStyle) {
|
|
758
|
-
var avatarUrl = author["avatar-url"],
|
|
759
|
-
avatarS3Key = author["avatar-s3-key"],
|
|
760
|
-
name = author.name;
|
|
761
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
762
|
-
"data-test-id": "author-image",
|
|
763
|
-
className: "arr--author-image " + _getClassName__default["default"]("author-image ".concat(templateStyle), _styleModuleImportMap$8)
|
|
764
|
-
}, /*#__PURE__*/React__default["default"].createElement("figure", {
|
|
765
|
-
className: "author-image-m_image-container__19WNd"
|
|
766
|
-
}, avatarS3Key ? /*#__PURE__*/React__default["default"].createElement(components.ResponsiveImage, {
|
|
767
|
-
slug: avatarS3Key,
|
|
768
|
-
alt: name,
|
|
769
|
-
defaultWidth: 250,
|
|
770
|
-
widths: [250, 480],
|
|
771
|
-
aspectRatio: [[1, 1], [1, 1]],
|
|
772
|
-
sizes: "98vw",
|
|
773
|
-
imgParams: {
|
|
774
|
-
auto: ["format", "compress"]
|
|
775
|
-
}
|
|
776
|
-
}) : avatarUrl ? /*#__PURE__*/React__default["default"].createElement("img", {
|
|
777
|
-
src: avatarUrl
|
|
778
|
-
}) : /*#__PURE__*/React__default["default"].createElement(UserFallbackIcon, null)));
|
|
779
|
-
};
|
|
780
|
-
|
|
781
|
-
var AuthorImage = function AuthorImage(_ref) {
|
|
782
|
-
var _ref$author = _ref.author,
|
|
783
|
-
author = _ref$author === void 0 ? {} : _ref$author,
|
|
784
|
-
_ref$template = _ref.template,
|
|
785
|
-
template = _ref$template === void 0 ? "" : _ref$template,
|
|
786
|
-
_ref$config = _ref.config,
|
|
787
|
-
config = _ref$config === void 0 ? {} : _ref$config;
|
|
788
|
-
var slug = author.slug;
|
|
789
|
-
var mountAt = config.mountAt || "";
|
|
790
|
-
var templateStyle = "";
|
|
791
|
-
if (template === "smallerCircle") templateStyle = "smaller-circle";else if (template === "smallCircle") templateStyle = "small-circle";else if (template === "square") templateStyle = "square";
|
|
792
|
-
if (slug) return /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
793
|
-
href: "".concat(mountAt, "/author/") + slug
|
|
794
|
-
}, authorWithImage(author, templateStyle));else return authorWithImage(author, templateStyle);
|
|
795
|
-
};
|
|
796
|
-
|
|
797
|
-
AuthorImage.propTypes = {
|
|
798
|
-
author: PropTypes__default["default"].shape({
|
|
799
|
-
"avatar-url": PropTypes__default["default"].string,
|
|
800
|
-
"avatar-s3-key": PropTypes__default["default"].string,
|
|
801
|
-
name: PropTypes__default["default"].string,
|
|
802
|
-
slug: PropTypes__default["default"].string
|
|
803
|
-
}),
|
|
804
|
-
template: PropTypes__default["default"].string
|
|
805
|
-
};
|
|
806
|
-
|
|
807
|
-
var LoadMoreTarget = function LoadMoreTarget(_ref) {
|
|
808
|
-
var collection = _ref.collection,
|
|
809
|
-
componentName = _ref.componentName,
|
|
810
|
-
offset = _ref.offset,
|
|
811
|
-
limit = _ref.limit;
|
|
812
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
813
|
-
id: "ELM-".concat(collection.id),
|
|
814
|
-
"data-collection-slug": collection["slug"],
|
|
815
|
-
"data-component-name": componentName,
|
|
816
|
-
"data-collection-offset": offset,
|
|
817
|
-
"data-collection-limit": limit
|
|
818
|
-
});
|
|
819
|
-
};
|
|
820
|
-
LoadMoreTarget.propTypes = {
|
|
821
|
-
collection: PropTypes__default["default"].shape({
|
|
822
|
-
id: PropTypes__default["default"].string,
|
|
823
|
-
slug: PropTypes__default["default"].string
|
|
824
|
-
}),
|
|
825
|
-
componentName: PropTypes__default["default"].string,
|
|
826
|
-
offset: PropTypes__default["default"].number,
|
|
827
|
-
limit: PropTypes__default["default"].number
|
|
828
|
-
};
|
|
829
|
-
|
|
830
|
-
var _styleModuleImportMap$7 = {
|
|
831
|
-
"./collection-name.m.css": {
|
|
832
|
-
"collection": "collection-name-m_collection__JD6sx",
|
|
833
|
-
"collection-borderLeft": "collection-name-m_collection-borderLeft__3Dznk",
|
|
834
|
-
"border-left": "collection-name-m_border-left__3_pYw",
|
|
835
|
-
"collection-borderBottomFull": "collection-name-m_collection-borderBottomFull__Dkq3K",
|
|
836
|
-
"collection-borderBottom": "collection-name-m_collection-borderBottom__2rdQM",
|
|
837
|
-
"collection-crossLine": "collection-name-m_collection-crossLine__1sIpN",
|
|
838
|
-
"border-bottom": "collection-name-m_border-bottom__1MnlV",
|
|
839
|
-
"dark": "collection-name-m_dark__nMe5H",
|
|
840
|
-
"light": "collection-name-m_light__1vFDN"
|
|
841
|
-
}
|
|
842
|
-
};
|
|
843
|
-
var CollectionNameBase = function CollectionNameBase(_ref) {
|
|
844
|
-
var _ref$collectionNameBo = _ref.collectionNameBorderColor,
|
|
845
|
-
collectionNameBorderColor = _ref$collectionNameBo === void 0 ? "" : _ref$collectionNameBo,
|
|
846
|
-
collection = _ref.collection,
|
|
847
|
-
config = _ref.config,
|
|
848
|
-
collectionNameTemplate = _ref.collectionNameTemplate,
|
|
849
|
-
headerLevel = _ref.headerLevel,
|
|
850
|
-
_ref$customCollection = _ref.customCollectionName,
|
|
851
|
-
customCollectionName = _ref$customCollection === void 0 ? "" : _ref$customCollection,
|
|
852
|
-
_ref$navigate = _ref.navigate,
|
|
853
|
-
navigate = _ref$navigate === void 0 ? true : _ref$navigate;
|
|
854
|
-
var collectionTitle = useStateValue() || {};
|
|
855
|
-
var showRowTitle = lodash.get(collectionTitle, ["showRowTitle"], true);
|
|
856
|
-
var supportedTemplates = ["borderLeft", "borderBottom", "crossLine", "borderBottomFull"];
|
|
857
|
-
var templateStyle = supportedTemplates.includes(collectionNameTemplate) ? " collection-".concat(collectionNameTemplate) : "";
|
|
858
|
-
var slug = navigate && collection && getSlug(collection, config) || "";
|
|
859
|
-
var collectionName = customCollectionName || collection.name || "";
|
|
860
|
-
var textColor = getTextColor(collectionTitle.theme);
|
|
861
|
-
var HeaderTag = "h" + headerLevel;
|
|
862
|
-
var CollectionNameBorderColor = rgbToHex(collectionNameBorderColor);
|
|
863
|
-
var borderBottomFullStyle = templateStyle.includes("collection-borderBottomFull") ? "4px solid ".concat(CollectionNameBorderColor) : "";
|
|
864
|
-
|
|
865
|
-
var borderBottomStyle = function borderBottomStyle() {
|
|
866
|
-
return templateStyle.includes("collection-borderBottom") && !templateStyle.includes("collection-borderBottomFull") ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
867
|
-
className: "collection-name-m_border-bottom__1MnlV",
|
|
868
|
-
style: {
|
|
869
|
-
borderBottom: "4px solid ".concat(CollectionNameBorderColor)
|
|
870
|
-
}
|
|
871
|
-
}) : "";
|
|
872
|
-
};
|
|
873
|
-
|
|
874
|
-
var isMobile = clientWidth("mobile");
|
|
875
|
-
|
|
876
|
-
var getBorderHeight = function getBorderHeight() {
|
|
877
|
-
if (isMobile) {
|
|
878
|
-
switch (headerLevel) {
|
|
879
|
-
case "1":
|
|
880
|
-
return "32px";
|
|
881
|
-
|
|
882
|
-
case "2":
|
|
883
|
-
return "24px";
|
|
884
|
-
|
|
885
|
-
case "3":
|
|
886
|
-
return "20px";
|
|
887
|
-
|
|
888
|
-
case "4":
|
|
889
|
-
return "18px";
|
|
890
|
-
|
|
891
|
-
case "5":
|
|
892
|
-
return "16px";
|
|
893
|
-
|
|
894
|
-
case "6":
|
|
895
|
-
return "16px";
|
|
896
|
-
|
|
897
|
-
default:
|
|
898
|
-
return "20px";
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
switch (headerLevel) {
|
|
903
|
-
case "1":
|
|
904
|
-
return "40px";
|
|
905
|
-
|
|
906
|
-
case "2":
|
|
907
|
-
return "32px";
|
|
908
|
-
|
|
909
|
-
case "3":
|
|
910
|
-
return "24px";
|
|
911
|
-
|
|
912
|
-
case "4":
|
|
913
|
-
return "20px";
|
|
914
|
-
|
|
915
|
-
case "5":
|
|
916
|
-
return "18px";
|
|
917
|
-
|
|
918
|
-
case "6":
|
|
919
|
-
return "16px";
|
|
920
|
-
|
|
921
|
-
default:
|
|
922
|
-
return "24px";
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
|
|
926
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showRowTitle && collectionName && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
927
|
-
style: {
|
|
928
|
-
borderBottom: borderBottomFullStyle
|
|
929
|
-
},
|
|
930
|
-
"data-test-id": "collection-name",
|
|
931
|
-
className: ("arr--collection-name arrow-component ".concat(templateStyle) ? "arr--collection-name arrow-component ".concat(templateStyle) + " " : "") + _getClassName__default["default"]("collection ".concat(textColor, " ").concat(templateStyle), _styleModuleImportMap$7)
|
|
932
|
-
}, templateStyle.includes("collection-borderLeft") && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
933
|
-
className: "arr-collection-name-border-left collection-name-m_border-left__3_pYw",
|
|
934
|
-
style: {
|
|
935
|
-
color: CollectionNameBorderColor,
|
|
936
|
-
fontSize: getBorderHeight()
|
|
937
|
-
}
|
|
938
|
-
}), slug && !slug.includes(undefined) ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
939
|
-
href: slug,
|
|
940
|
-
"aria-label": "collection-name"
|
|
941
|
-
}, /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName), borderBottomStyle()));
|
|
942
|
-
};
|
|
943
|
-
CollectionNameBase.propTypes = {
|
|
944
|
-
/** Collection name border color */
|
|
945
|
-
collectionNameBorderColor: PropTypes.PropTypes.string,
|
|
946
|
-
|
|
947
|
-
/** The Collection Object from the API response */
|
|
948
|
-
collection: PropTypes.PropTypes.object,
|
|
949
|
-
|
|
950
|
-
/** The publisher config from the API response */
|
|
951
|
-
config: PropTypes.PropTypes.object,
|
|
952
|
-
|
|
953
|
-
/** The style template for the component */
|
|
954
|
-
collectionNameTemplate: PropTypes.PropTypes.oneOf(["", "borderLeft", "borderBottom", "crossLine", "borderBottomFull"]),
|
|
955
|
-
|
|
956
|
-
/** Header tags ranging h1-h6, where h[headerLevel] */
|
|
957
|
-
headerLevel: PropTypes.PropTypes.string,
|
|
958
|
-
customCollectionName: PropTypes.PropTypes.string,
|
|
959
|
-
navigate: PropTypes.PropTypes.bool
|
|
960
|
-
};
|
|
961
|
-
CollectionNameBase.defaultProps = {
|
|
962
|
-
collectionNameTemplate: "",
|
|
963
|
-
headerLevel: "3"
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
function mapStateToProps(state) {
|
|
967
|
-
return {
|
|
968
|
-
config: lodash.get(state, ["qt", "config"], {})
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
var CollectionName = reactRedux.connect(mapStateToProps)(CollectionNameBase);
|
|
973
|
-
|
|
974
|
-
var _styleModuleImportMap$6 = {
|
|
975
|
-
"./timestamp.m.css": {
|
|
976
|
-
"time": "timestamp-m_time__2v46i",
|
|
977
|
-
"time-wrapper": "timestamp-m_time-wrapper__3O2lM",
|
|
978
|
-
"bottom-fix": "timestamp-m_bottom-fix__1Zh8r",
|
|
979
|
-
"dark": "timestamp-m_dark__2lk9E",
|
|
980
|
-
"light": "timestamp-m_light__2QlrI"
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
var TimeStamp = function TimeStamp(_ref) {
|
|
984
|
-
var story = _ref.story,
|
|
985
|
-
isBottom = _ref.isBottom,
|
|
986
|
-
_ref$config = _ref.config,
|
|
987
|
-
config = _ref$config === void 0 ? {} : _ref$config;
|
|
988
|
-
var configState = useStateValue() || {};
|
|
989
|
-
var isTime = lodash.get(config, ["showTime"], lodash.get(configState, ["showTime"], true));
|
|
990
|
-
var time = story["last-published-at"] || story["first-published-at"];
|
|
991
|
-
var isBottomClasses = isBottom ? "bottom-fix" : "";
|
|
992
|
-
var textColor = getTextColor(configState.theme);
|
|
993
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isTime && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
994
|
-
"data-test-id": "publish-time",
|
|
995
|
-
className: "time arr--publish-time " + _getClassName__default["default"]("time ".concat(textColor, " ").concat(isBottomClasses), _styleModuleImportMap$6)
|
|
996
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
997
|
-
className: "timestamp-m_time-wrapper__3O2lM"
|
|
998
|
-
}, getTimeStamp(time, formatter, config))));
|
|
999
|
-
};
|
|
1000
|
-
TimeStamp.propTypes = {
|
|
1001
|
-
/** The Story Object from the API response */
|
|
1002
|
-
story: PropTypes__default["default"].object,
|
|
1003
|
-
isBottom: PropTypes__default["default"].bool,
|
|
1004
|
-
config: PropTypes__default["default"].object
|
|
1005
|
-
};
|
|
1006
|
-
|
|
1007
|
-
var _styleModuleImportMap$5 = {
|
|
1008
|
-
"./dot.m.css": {
|
|
1009
|
-
"dark": "dot-m_dark__1Njxl",
|
|
1010
|
-
"light": "dot-m_light__27IA3"
|
|
1011
|
-
}
|
|
1012
|
-
};
|
|
1013
|
-
var Dot = function Dot(_ref) {
|
|
1014
|
-
var _ref$width = _ref.width,
|
|
1015
|
-
width = _ref$width === void 0 ? "3px" : _ref$width,
|
|
1016
|
-
_ref$height = _ref.height,
|
|
1017
|
-
height = _ref$height === void 0 ? "3px" : _ref$height,
|
|
1018
|
-
_ref$color = _ref.color,
|
|
1019
|
-
color = _ref$color === void 0 ? "light" : _ref$color;
|
|
1020
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1021
|
-
className: _getClassName__default["default"](color, _styleModuleImportMap$5)
|
|
1022
|
-
}, /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
1023
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1024
|
-
width: width,
|
|
1025
|
-
height: height,
|
|
1026
|
-
viewBox: "0 0 3 3"
|
|
1027
|
-
}, /*#__PURE__*/React__default["default"].createElement("circle", {
|
|
1028
|
-
cx: "87",
|
|
1029
|
-
cy: "9",
|
|
1030
|
-
r: "1",
|
|
1031
|
-
fill: "inherit",
|
|
1032
|
-
fillRule: "nonzero",
|
|
1033
|
-
transform: "translate(-86 -8)"
|
|
1034
|
-
})));
|
|
1035
|
-
};
|
|
1036
|
-
Dot.propTypes = {
|
|
1037
|
-
/** height , width and color of the dot icon */
|
|
1038
|
-
color: PropTypes__default["default"].string,
|
|
1039
|
-
width: PropTypes__default["default"].string,
|
|
1040
|
-
height: PropTypes__default["default"].string
|
|
1041
|
-
};
|
|
1042
|
-
|
|
1043
|
-
var _styleModuleImportMap$4 = {
|
|
1044
|
-
"./divider.m.css": {
|
|
1045
|
-
"dark": "divider-m_dark__26FRi",
|
|
1046
|
-
"light": "divider-m_light__w-7sy"
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
var Divider = function Divider(_ref) {
|
|
1050
|
-
var _ref$width = _ref.width,
|
|
1051
|
-
width = _ref$width === void 0 ? "1" : _ref$width,
|
|
1052
|
-
_ref$height = _ref.height,
|
|
1053
|
-
height = _ref$height === void 0 ? "10" : _ref$height,
|
|
1054
|
-
_ref$color = _ref.color,
|
|
1055
|
-
color = _ref$color === void 0 ? "light" : _ref$color;
|
|
1056
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1057
|
-
className: _getClassName__default["default"](color, _styleModuleImportMap$4)
|
|
1058
|
-
}, /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
1059
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1060
|
-
width: width,
|
|
1061
|
-
height: height
|
|
1062
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
1063
|
-
fill: "inherit",
|
|
1064
|
-
d: "M0 0h1v10H0z"
|
|
1065
|
-
})));
|
|
1066
|
-
};
|
|
1067
|
-
Divider.propTypes = {
|
|
1068
|
-
/** height , width and color of the dot icon */
|
|
1069
|
-
color: PropTypes__default["default"].string,
|
|
1070
|
-
width: PropTypes__default["default"].string,
|
|
1071
|
-
height: PropTypes__default["default"].string
|
|
1072
|
-
};
|
|
1073
|
-
|
|
1074
|
-
var _styleModuleImportMap$3 = {
|
|
1075
|
-
"./read-time.m.css": {
|
|
1076
|
-
"read-time-wrapper": "read-time-m_read-time-wrapper__3GyC_",
|
|
1077
|
-
"dot-indicator": "read-time-m_dot-indicator__3Sqh2",
|
|
1078
|
-
"dark": "read-time-m_dark__3yRaK",
|
|
1079
|
-
"light": "read-time-m_light__1GAZu"
|
|
1080
|
-
}
|
|
1081
|
-
};
|
|
1082
|
-
var ReadTime = function ReadTime(_ref) {
|
|
1083
|
-
var story = _ref.story,
|
|
1084
|
-
_ref$opts = _ref.opts,
|
|
1085
|
-
opts = _ref$opts === void 0 ? {} : _ref$opts,
|
|
1086
|
-
_ref$isLightTheme = _ref.isLightTheme,
|
|
1087
|
-
isLightTheme = _ref$isLightTheme === void 0 ? false : _ref$isLightTheme;
|
|
1088
|
-
var config = useStateValue() || {};
|
|
1089
|
-
var showReadTime = lodash.get(config, ["showReadTime"]) || lodash.get(opts, ["showReadTime"], true);
|
|
1090
|
-
var readTime = lodash.get(story, ["read-time"], 0);
|
|
1091
|
-
var textColor = isLightTheme ? "light" : getTextColor(config.theme);
|
|
1092
|
-
if (!showReadTime || !readTime) return null;
|
|
1093
|
-
var timeToRead = lodash.get(opts, ["localizedTimeToRead"]) || "min read";
|
|
1094
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1095
|
-
"data-test-id": "read-time",
|
|
1096
|
-
className: "arrow-component arr--read-time " + _getClassName__default["default"]("read-time-wrapper ".concat(textColor), _styleModuleImportMap$3)
|
|
1097
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1098
|
-
className: "read-time-indicator read-time-m_dot-indicator__3Sqh2"
|
|
1099
|
-
}, /*#__PURE__*/React__default["default"].createElement(Dot, {
|
|
1100
|
-
color: textColor
|
|
1101
|
-
})), /*#__PURE__*/React__default["default"].createElement("span", null, readTime, " ", timeToRead)));
|
|
1102
|
-
};
|
|
1103
|
-
ReadTime.propTypes = {
|
|
1104
|
-
story: PropTypes__default["default"].shape({
|
|
1105
|
-
"read-time": PropTypes__default["default"].number
|
|
1106
|
-
}),
|
|
1107
|
-
opts: PropTypes__default["default"].shape({
|
|
1108
|
-
showReadTime: PropTypes__default["default"].bool
|
|
1109
|
-
}),
|
|
1110
|
-
isLightTheme: PropTypes__default["default"].bool
|
|
1111
|
-
};
|
|
1112
|
-
|
|
1113
|
-
var _styleModuleImportMap$2 = {
|
|
1114
|
-
"./author-with-timestamp.m.css": {
|
|
1115
|
-
"author-time-wrapper": "author-with-timestamp-m_author-time-wrapper__G7_eI",
|
|
1116
|
-
"author-image": "author-with-timestamp-m_author-image__24xrD",
|
|
1117
|
-
"dot": "author-with-timestamp-m_dot__1LHXD",
|
|
1118
|
-
"bottom-fix": "author-with-timestamp-m_bottom-fix__1rWGv",
|
|
1119
|
-
"dash": "author-with-timestamp-m_dash__2L5XC"
|
|
1120
|
-
}
|
|
1121
|
-
};
|
|
1122
|
-
var AuthorWithTime = function AuthorWithTime(_ref) {
|
|
1123
|
-
var story = _ref.story,
|
|
1124
|
-
separator = _ref.separator,
|
|
1125
|
-
isBottom = _ref.isBottom,
|
|
1126
|
-
hideAuthorImage = _ref.hideAuthorImage,
|
|
1127
|
-
prefix = _ref.prefix,
|
|
1128
|
-
_ref$config = _ref.config,
|
|
1129
|
-
config = _ref$config === void 0 ? {} : _ref$config,
|
|
1130
|
-
isLightTheme = _ref.isLightTheme;
|
|
1131
|
-
var configState = useStateValue() || {};
|
|
1132
|
-
var isAuthor = lodash.get(config, ["showAuthor"], lodash.get(configState, ["showAuthor"], true));
|
|
1133
|
-
var isTime = lodash.get(config, ["showTime"], lodash.get(configState, ["showTime"], true));
|
|
1134
|
-
var isReadTime = lodash.get(configState, ["showReadTime"], true);
|
|
1135
|
-
var isBottomClasses = isBottom ? "bottom-fix" : "";
|
|
1136
|
-
var seperatorStyle = separator === "dot" ? "dot" : "dash";
|
|
1137
|
-
var textColor = isLightTheme ? "light" : getTextColor(configState.theme);
|
|
1138
|
-
|
|
1139
|
-
var getSeparator = function getSeparator() {
|
|
1140
|
-
if (separator === "divider") {
|
|
1141
|
-
return /*#__PURE__*/React__default["default"].createElement(Divider, {
|
|
1142
|
-
color: textColor
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
return /*#__PURE__*/React__default["default"].createElement(Dot, {
|
|
1147
|
-
color: textColor
|
|
1148
|
-
});
|
|
1149
|
-
};
|
|
1150
|
-
|
|
1151
|
-
var getTimeStamp = function getTimeStamp() {
|
|
1152
|
-
if (!isTime) return null;
|
|
1153
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isAuthor && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1154
|
-
className: "arr-separator " + _getClassName__default["default"]("".concat(seperatorStyle), _styleModuleImportMap$2)
|
|
1155
|
-
}, getSeparator()), /*#__PURE__*/React__default["default"].createElement(TimeStamp, {
|
|
1156
|
-
story: story,
|
|
1157
|
-
config: config
|
|
1158
|
-
}), isReadTime && /*#__PURE__*/React__default["default"].createElement(ReadTime, {
|
|
1159
|
-
story: story,
|
|
1160
|
-
opts: config,
|
|
1161
|
-
isLightTheme: isLightTheme
|
|
1162
|
-
}));
|
|
1163
|
-
};
|
|
1164
|
-
|
|
1165
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1166
|
-
className: "arr--author-time " + _getClassName__default["default"]("author-time-wrapper ".concat(isBottomClasses), _styleModuleImportMap$2)
|
|
1167
|
-
}, isAuthor ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Author, {
|
|
1168
|
-
story: story,
|
|
1169
|
-
isBottom: true,
|
|
1170
|
-
hideAuthorImage: hideAuthorImage,
|
|
1171
|
-
prefix: prefix
|
|
1172
|
-
}), getTimeStamp()) : getTimeStamp());
|
|
1173
|
-
};
|
|
1174
|
-
AuthorWithTime.propTypes = {
|
|
1175
|
-
story: PropTypes__default["default"].object,
|
|
1176
|
-
|
|
1177
|
-
/** Style of separator between the Author & Timestamp */
|
|
1178
|
-
separator: PropTypes__default["default"].oneOf(["dot", "divider"]),
|
|
1179
|
-
|
|
1180
|
-
/** hide the author image */
|
|
1181
|
-
hideAuthorImage: PropTypes__default["default"].bool,
|
|
1182
|
-
// fix author and time at the end
|
|
1183
|
-
isBottom: PropTypes__default["default"].bool,
|
|
1184
|
-
// fix prefix before the author name
|
|
1185
|
-
prefix: PropTypes__default["default"].string,
|
|
1186
|
-
config: PropTypes__default["default"].object,
|
|
1187
|
-
isLightTheme: PropTypes__default["default"].bool
|
|
1188
|
-
};
|
|
1189
|
-
AuthorWithTime.defaultProps = {
|
|
1190
|
-
separator: "dot",
|
|
1191
|
-
isBottom: false,
|
|
1192
|
-
hideAuthorImage: true,
|
|
1193
|
-
prefix: "",
|
|
1194
|
-
isLightTheme: false
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
var _styleModuleImportMap$1 = {
|
|
1198
|
-
"./load-more.m.css": {
|
|
1199
|
-
"button": "load-more-m_button__1mmf1",
|
|
1200
|
-
"default": "load-more-m_default__2_k4V",
|
|
1201
|
-
"dark": "load-more-m_dark__3dfzb",
|
|
1202
|
-
"light": "load-more-m_light__ePZQI"
|
|
1203
|
-
}
|
|
1204
|
-
};
|
|
1205
|
-
|
|
1206
|
-
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1207
|
-
|
|
1208
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1209
|
-
var LoadmoreButton = function LoadmoreButton(_ref) {
|
|
1210
|
-
var _ref$config = _ref.config,
|
|
1211
|
-
config = _ref$config === void 0 ? {} : _ref$config,
|
|
1212
|
-
collection = _ref.collection,
|
|
1213
|
-
_ref$template = _ref.template,
|
|
1214
|
-
template = _ref$template === void 0 ? "SubsequentLoadCount" : _ref$template,
|
|
1215
|
-
onClick = _ref.onClick,
|
|
1216
|
-
navigate = _ref.navigate,
|
|
1217
|
-
qtConfig = _ref.qtConfig;
|
|
1218
|
-
var _config$showButton = config.showButton,
|
|
1219
|
-
showButton = _config$showButton === void 0 ? true : _config$showButton,
|
|
1220
|
-
_config$buttonText = config.buttonText,
|
|
1221
|
-
buttonText = _config$buttonText === void 0 ? "Read More" : _config$buttonText,
|
|
1222
|
-
_config$theme = config.theme,
|
|
1223
|
-
theme = _config$theme === void 0 ? "" : _config$theme,
|
|
1224
|
-
_config$customUrlPath = config.customUrlPath,
|
|
1225
|
-
customUrlPath = _config$customUrlPath === void 0 ? "" : _config$customUrlPath;
|
|
1226
|
-
if (!showButton) return null;
|
|
1227
|
-
var textColor = getTextColor(theme);
|
|
1228
|
-
var slug = customUrlPath ? "/".concat(customUrlPath) : generateNavigateSlug(collection, _objectSpread$1(_objectSpread$1({}, qtConfig), config));
|
|
1229
|
-
return template === "SubsequentLoadCount" ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1230
|
-
onClick: onClick,
|
|
1231
|
-
"data-test-id": "load-more",
|
|
1232
|
-
className: "arr--button " + _getClassName__default["default"]("button ".concat(textColor, " default"), _styleModuleImportMap$1)
|
|
1233
|
-
}, buttonText) : /*#__PURE__*/React__default["default"].createElement(components.LinkBase, {
|
|
1234
|
-
href: slug,
|
|
1235
|
-
navigateTo: navigate,
|
|
1236
|
-
"data-test-id": "load-more",
|
|
1237
|
-
"aria-label": "load-more"
|
|
1238
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1239
|
-
className: "arr--button " + _getClassName__default["default"]("button ".concat(textColor, " default"), _styleModuleImportMap$1)
|
|
1240
|
-
}, buttonText));
|
|
1241
|
-
};
|
|
1242
|
-
LoadmoreButton.propTypes = {
|
|
1243
|
-
collection: PropTypes__default["default"].object,
|
|
1244
|
-
template: PropTypes__default["default"].string,
|
|
1245
|
-
config: PropTypes__default["default"].object,
|
|
1246
|
-
onClick: PropTypes__default["default"].func,
|
|
1247
|
-
navigate: PropTypes__default["default"].func,
|
|
1248
|
-
qtConfig: PropTypes__default["default"].object
|
|
1249
|
-
};
|
|
1250
|
-
|
|
1251
|
-
var isClient = typeof window !== "undefined";
|
|
1252
|
-
|
|
1253
|
-
var hasIntersectionObserverSupport = function hasIntersectionObserverSupport() {
|
|
1254
|
-
return typeof window.IntersectionObserver !== "undefined";
|
|
1255
|
-
}; // import intersection observer polyfill only if on client
|
|
1256
|
-
// and if not supported by browser
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
var getIntersectionObserver = function getIntersectionObserver() {
|
|
1260
|
-
return Promise.resolve(isClient && !hasIntersectionObserverSupport() && Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('intersection-observer')); }));
|
|
1261
|
-
}; // options for intersection observer in order to improve the effect
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
var intersectionObserverOptions = {
|
|
1265
|
-
root: null,
|
|
1266
|
-
// windows viewport will be used
|
|
1267
|
-
rootMargin: "200px 0px 0px 0px"
|
|
1268
|
-
};
|
|
1269
|
-
|
|
1270
|
-
var handleIntersect = function handleIntersect(entries, observer) {
|
|
1271
|
-
entries.filter(function (entry) {
|
|
1272
|
-
return entry.isIntersecting;
|
|
1273
|
-
}).forEach(function (entry) {
|
|
1274
|
-
var target = entry.target;
|
|
1275
|
-
|
|
1276
|
-
target._onIntersect(observer);
|
|
1277
|
-
});
|
|
1278
|
-
}; // get observer from the cache or create a new one
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
var getObserver = function getObserver() {
|
|
1282
|
-
return getIntersectionObserver().then(function (_) {
|
|
1283
|
-
|
|
1284
|
-
if (isClient) {
|
|
1285
|
-
return new window.IntersectionObserver(handleIntersect, intersectionObserverOptions);
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1288
|
-
};
|
|
1289
|
-
|
|
1290
|
-
var useNearScreen = (function (_ref) {
|
|
1291
|
-
var ref = _ref.ref;
|
|
1292
|
-
|
|
1293
|
-
var _useState = React.useState(false),
|
|
1294
|
-
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1295
|
-
show = _useState2[0],
|
|
1296
|
-
setShow = _useState2[1];
|
|
1297
|
-
|
|
1298
|
-
React.useEffect(function () {
|
|
1299
|
-
var current = ref.current;
|
|
1300
|
-
if (!current) return; // get observer async and only when needed
|
|
1301
|
-
|
|
1302
|
-
getObserver().then(function (observer) {
|
|
1303
|
-
return observer.observe(current);
|
|
1304
|
-
}); // mutate the current target to add a method to be executed when intersecting
|
|
1305
|
-
|
|
1306
|
-
current._onIntersect = function (observer) {
|
|
1307
|
-
setShow(true);
|
|
1308
|
-
observer.unobserve(current);
|
|
1309
|
-
}; // clean observed element when unmounted
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
return function () {
|
|
1313
|
-
return current._isSubscribed = false;
|
|
1314
|
-
};
|
|
1315
|
-
}, [ref]);
|
|
1316
|
-
return show;
|
|
1317
|
-
});
|
|
1318
|
-
|
|
1319
|
-
var EMPTY_HTML = {
|
|
1320
|
-
__html: ""
|
|
1321
|
-
};
|
|
1322
|
-
var isServer = typeof window === "undefined";
|
|
1323
|
-
var ProgressiveHydration = function ProgressiveHydration(props) {
|
|
1324
|
-
var children = props.children;
|
|
1325
|
-
var ref = React.useRef(null);
|
|
1326
|
-
var isNearScreen = useNearScreen({
|
|
1327
|
-
ref: ref
|
|
1328
|
-
});
|
|
1329
|
-
React.useEffect(function () {
|
|
1330
|
-
var el = ref.current; // CLIENT:
|
|
1331
|
-
// If we want to force the hydration OR the element is near screen
|
|
1332
|
-
// then we hydrate the content to get the functionality ready
|
|
1333
|
-
|
|
1334
|
-
if (isNearScreen) {
|
|
1335
|
-
var action = el.hasChildNodes() ? "hydrate" : "render";
|
|
1336
|
-
ReactDOM__default["default"][action](children, el);
|
|
1337
|
-
}
|
|
1338
|
-
}, [children, isNearScreen]); // SERVER: Just render the content as usual
|
|
1339
|
-
|
|
1340
|
-
if (isServer) {
|
|
1341
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1342
|
-
ref: ref
|
|
1343
|
-
}, children);
|
|
1344
|
-
} // CLIENT: Avoid hydration until we say so
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1348
|
-
ref: ref,
|
|
1349
|
-
suppressHydrationWarning: true,
|
|
1350
|
-
dangerouslySetInnerHTML: EMPTY_HTML
|
|
1351
|
-
});
|
|
1352
|
-
};
|
|
1353
|
-
ProgressiveHydration.propTypes = {
|
|
1354
|
-
children: PropTypes__default["default"].element
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
var _styleModuleImportMap = {
|
|
1358
|
-
"./opinion-collection.m.css": {
|
|
1359
|
-
"viewports": "\"../../../../assets/stylesheets/viewports.m.css\"",
|
|
1360
|
-
"mobile": "768px",
|
|
1361
|
-
"desktop": "1025px",
|
|
1362
|
-
"opinion-collection": "opinion-collection-m_opinion-collection__1Bc7h",
|
|
1363
|
-
"content-wrapper": "opinion-collection-m_content-wrapper__y32PE",
|
|
1364
|
-
"custom-grid": "opinion-collection-m_custom-grid__33uRh",
|
|
1365
|
-
"wrapper-with-ads": "opinion-collection-m_wrapper-with-ads__2daVe",
|
|
1366
|
-
"ad-slot": "opinion-collection-m_ad-slot__2ZpaC",
|
|
1367
|
-
"headline-author": "opinion-collection-m_headline-author__2H6Tv",
|
|
1368
|
-
"border": "opinion-collection-m_border__38tun",
|
|
1369
|
-
"light": "opinion-collection-m_light__2Hent",
|
|
1370
|
-
"dark": "opinion-collection-m_dark__WMRNF",
|
|
1371
|
-
"count-3": "opinion-collection-m_count-3__3cQUB",
|
|
1372
|
-
"count-2": "opinion-collection-m_count-2__2e7g_"
|
|
1373
|
-
}
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1377
|
-
|
|
1378
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1379
|
-
|
|
1380
|
-
var loadMore = function loadMore(_ref) {
|
|
1381
|
-
var isLoading = _ref.isLoading,
|
|
1382
|
-
renderStories = _ref.renderStories,
|
|
1383
|
-
getMoreStories = _ref.getMoreStories,
|
|
1384
|
-
_ref$subsequentLoadCo = _ref.subsequentLoadCount,
|
|
1385
|
-
subsequentLoadCount = _ref$subsequentLoadCo === void 0 ? 3 : _ref$subsequentLoadCo;
|
|
1386
|
-
if (isLoading) return;
|
|
1387
|
-
var limit = subsequentLoadCount;
|
|
1388
|
-
var offset = renderStories.length;
|
|
1389
|
-
getMoreStories(offset, limit);
|
|
1390
|
-
};
|
|
1391
|
-
|
|
1392
|
-
var OpinionCollectionBase = function OpinionCollectionBase(_ref2) {
|
|
1393
|
-
var collection = _ref2.collection,
|
|
1394
|
-
config = _ref2.config,
|
|
1395
|
-
getMoreStories = _ref2.getMoreStories,
|
|
1396
|
-
isLoadMoreVisible = _ref2.isLoadMoreVisible,
|
|
1397
|
-
isLoading = _ref2.isLoading,
|
|
1398
|
-
isolatedLoadMore = _ref2.isolatedLoadMore;
|
|
1399
|
-
var stories = components.collectionToStories(collection);
|
|
1400
|
-
var _config$theme = config.theme,
|
|
1401
|
-
theme = _config$theme === void 0 ? "" : _config$theme,
|
|
1402
|
-
_config$footerButton = config.footerButton,
|
|
1403
|
-
footerButton = _config$footerButton === void 0 ? "" : _config$footerButton,
|
|
1404
|
-
_config$border = config.border,
|
|
1405
|
-
border = _config$border === void 0 ? "fullBorder" : _config$border,
|
|
1406
|
-
_config$collectionNam = config.collectionNameBorderColor,
|
|
1407
|
-
collectionNameBorderColor = _config$collectionNam === void 0 ? "" : _config$collectionNam,
|
|
1408
|
-
_config$collectionNam2 = config.collectionNameTemplate,
|
|
1409
|
-
collectionNameTemplate = _config$collectionNam2 === void 0 ? "" : _config$collectionNam2,
|
|
1410
|
-
_config$slotConfig = config.slotConfig,
|
|
1411
|
-
slotConfig = _config$slotConfig === void 0 ? [] : _config$slotConfig,
|
|
1412
|
-
_config$subsequentLoa = config.subsequentLoadCount,
|
|
1413
|
-
subsequentLoadCount = _config$subsequentLoa === void 0 ? 3 : _config$subsequentLoa;
|
|
1414
|
-
|
|
1415
|
-
var _get = lodash.get(slotConfig, [0], {}),
|
|
1416
|
-
_get$type = _get.type,
|
|
1417
|
-
type = _get$type === void 0 ? "story" : _get$type,
|
|
1418
|
-
_get$component = _get.component,
|
|
1419
|
-
component = _get$component === void 0 ? null : _get$component;
|
|
1420
|
-
|
|
1421
|
-
var dispatch = reactRedux.useDispatch();
|
|
1422
|
-
var qtConfig = reactRedux.useSelector(function (state) {
|
|
1423
|
-
return lodash.get(state, ["qt", "config"], {});
|
|
1424
|
-
});
|
|
1425
|
-
if (!stories.length) return null;
|
|
1426
|
-
var textColor = getTextColor(theme);
|
|
1427
|
-
var borderStyle = border === "fullBorder" ? "border" : "";
|
|
1428
|
-
var slot = type === "ad" ? getSlot(type, component) : null;
|
|
1429
|
-
var adStyle = slot ? "custom-grid" : "";
|
|
1430
|
-
|
|
1431
|
-
var getLoadMore = function getLoadMore(opts) {
|
|
1432
|
-
if (!isLoadMoreVisible) return null;
|
|
1433
|
-
|
|
1434
|
-
if (isolatedLoadMore) {
|
|
1435
|
-
return /*#__PURE__*/React__default["default"].createElement(LoadMoreTarget, {
|
|
1436
|
-
collection: collection,
|
|
1437
|
-
componentName: "OpinionCollection",
|
|
1438
|
-
offset: stories.length,
|
|
1439
|
-
limit: subsequentLoadCount
|
|
1440
|
-
});
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
var url = generateNavigateSlug(collection, qtConfig);
|
|
1444
|
-
return /*#__PURE__*/React__default["default"].createElement(ProgressiveHydration, null, /*#__PURE__*/React__default["default"].createElement(LoadmoreButton, {
|
|
1445
|
-
config: config,
|
|
1446
|
-
collection: collection,
|
|
1447
|
-
template: footerButton,
|
|
1448
|
-
onClick: function onClick() {
|
|
1449
|
-
return loadMore(opts);
|
|
1450
|
-
},
|
|
1451
|
-
navigate: function navigate() {
|
|
1452
|
-
return navigateTo(dispatch, url);
|
|
1453
|
-
},
|
|
1454
|
-
qtConfig: qtConfig
|
|
1455
|
-
}));
|
|
1456
|
-
};
|
|
1457
|
-
|
|
1458
|
-
var getAuthorCard = function getAuthorCard(story) {
|
|
1459
|
-
var authorData = lodash.get(story, ["authors", "0"]);
|
|
1460
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1461
|
-
"data-test-id": "story-card"
|
|
1462
|
-
}, /*#__PURE__*/React__default["default"].createElement(Author, {
|
|
1463
|
-
story: story,
|
|
1464
|
-
hideAuthorImage: true
|
|
1465
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1466
|
-
className: "opinion-collection-m_headline-author__2H6Tv"
|
|
1467
|
-
}, /*#__PURE__*/React__default["default"].createElement(Headline, {
|
|
1468
|
-
story: story
|
|
1469
|
-
}), /*#__PURE__*/React__default["default"].createElement(AuthorImage, {
|
|
1470
|
-
author: authorData,
|
|
1471
|
-
template: "smallerCircle",
|
|
1472
|
-
config: config
|
|
1473
|
-
})), /*#__PURE__*/React__default["default"].createElement(AuthorWithTime, {
|
|
1474
|
-
story: story,
|
|
1475
|
-
config: _objectSpread(_objectSpread({}, config), {}, {
|
|
1476
|
-
disableMeridiem: true,
|
|
1477
|
-
showAuthor: false
|
|
1478
|
-
})
|
|
1479
|
-
}));
|
|
1480
|
-
};
|
|
1481
|
-
|
|
1482
|
-
var countStyleName = stories.length === 2 || stories.length === 3 ? "count-".concat(stories.length) : "";
|
|
1483
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1484
|
-
className: "full-width-with-padding arrow-component",
|
|
1485
|
-
"data-test-id": "opinion-collection",
|
|
1486
|
-
style: {
|
|
1487
|
-
backgroundColor: theme,
|
|
1488
|
-
color: textColor
|
|
1489
|
-
}
|
|
1490
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1491
|
-
className: "opinion-collection-m_opinion-collection__1Bc7h",
|
|
1492
|
-
style: {
|
|
1493
|
-
backgroundColor: theme,
|
|
1494
|
-
color: textColor
|
|
1495
|
-
}
|
|
1496
|
-
}, /*#__PURE__*/React__default["default"].createElement(CollectionName, {
|
|
1497
|
-
collection: collection,
|
|
1498
|
-
collectionNameTemplate: collectionNameTemplate,
|
|
1499
|
-
collectionNameBorderColor: collectionNameBorderColor,
|
|
1500
|
-
headerLevel: 2
|
|
1501
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1502
|
-
className: ("content-wrapper ".concat(borderStyle, " ").concat(textColor) ? "content-wrapper ".concat(borderStyle, " ").concat(textColor) + " " : "") + _getClassName__default["default"]("content-wrapper ".concat(borderStyle, " ").concat(textColor, " ").concat(adStyle), _styleModuleImportMap)
|
|
1503
|
-
}, slot ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1504
|
-
className: "wrapper-with-ads " + _getClassName__default["default"]("wrapper-with-ads ".concat(countStyleName), _styleModuleImportMap)
|
|
1505
|
-
}, stories.slice(0, 4).map(function (story) {
|
|
1506
|
-
return getAuthorCard(story);
|
|
1507
|
-
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1508
|
-
className: "opinion-collection-m_ad-slot__2ZpaC"
|
|
1509
|
-
}, slot)) : stories.map(function (story) {
|
|
1510
|
-
return getAuthorCard(story);
|
|
1511
|
-
})), getLoadMore({
|
|
1512
|
-
isLoading: isLoading,
|
|
1513
|
-
stories: stories,
|
|
1514
|
-
getMoreStories: getMoreStories,
|
|
1515
|
-
subsequentLoadCount: subsequentLoadCount
|
|
1516
|
-
})));
|
|
1517
|
-
};
|
|
1518
|
-
OpinionCollectionBase.propTypes = {
|
|
1519
|
-
collection: PropTypes__default["default"].object,
|
|
1520
|
-
config: PropTypes__default["default"].shape({
|
|
1521
|
-
collectionNameBorderColor: PropTypes__default["default"].string,
|
|
1522
|
-
theme: PropTypes__default["default"].string,
|
|
1523
|
-
collectionNameTemplate: PropTypes__default["default"].string,
|
|
1524
|
-
footerButton: PropTypes__default["default"].string,
|
|
1525
|
-
border: PropTypes__default["default"].string,
|
|
1526
|
-
slotConfig: PropTypes__default["default"].array,
|
|
1527
|
-
subsequentLoadCount: PropTypes__default["default"].number
|
|
1528
|
-
}),
|
|
1529
|
-
getMoreStories: PropTypes__default["default"].func,
|
|
1530
|
-
isLoading: PropTypes__default["default"].bool,
|
|
1531
|
-
isLoadMoreVisible: PropTypes__default["default"].bool,
|
|
1532
|
-
isolatedLoadMore: PropTypes__default["default"].bool
|
|
1533
|
-
};
|
|
1534
|
-
OpinionCollectionBase.defaultProps = {
|
|
1535
|
-
getMoreStories: function getMoreStories() {},
|
|
1536
|
-
isLoadMoreVisible: true,
|
|
1537
|
-
isLoading: false,
|
|
1538
|
-
collection: {},
|
|
1539
|
-
config: {},
|
|
1540
|
-
hideFirstCard: false
|
|
1541
|
-
};
|
|
1542
|
-
var OpinionCollection = StateProvider(OpinionCollectionBase);
|
|
1543
|
-
|
|
1544
|
-
exports.OpinionCollection = OpinionCollection;
|
|
1545
|
-
exports.OpinionCollectionBase = OpinionCollectionBase;
|