@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,2223 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var reactRedux = require('react-redux');
|
|
8
|
-
var lodash = require('lodash');
|
|
9
|
-
var components = require('@quintype/components');
|
|
10
|
-
var _getClassName = require('babel-plugin-react-css-modules/dist/browser/getClassName');
|
|
11
|
-
var PropTypes = require('prop-types');
|
|
12
|
-
require('@babel/runtime/helpers/asyncToGenerator');
|
|
13
|
-
var _typeof = 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 _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
18
|
-
|
|
19
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
-
|
|
21
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
22
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
|
-
var _getClassName__default = /*#__PURE__*/_interopDefaultLegacy(_getClassName);
|
|
24
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
25
|
-
var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
|
|
26
|
-
var Timeago__default = /*#__PURE__*/_interopDefaultLegacy(Timeago);
|
|
27
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
28
|
-
|
|
29
|
-
var StateContext = /*#__PURE__*/React.createContext(); // eslint-disable-next-line react/display-name
|
|
30
|
-
|
|
31
|
-
var StateProvider = function StateProvider(RowComponent) {
|
|
32
|
-
return function (props) {
|
|
33
|
-
return (
|
|
34
|
-
/*#__PURE__*/
|
|
35
|
-
// eslint-disable-next-line react/prop-types
|
|
36
|
-
React__default["default"].createElement(StateContext.Provider, {
|
|
37
|
-
value: props.config
|
|
38
|
-
}, /*#__PURE__*/React__default["default"].createElement(RowComponent, props))
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
var useStateValue = function useStateValue() {
|
|
43
|
-
return React.useContext(StateContext);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
function truncate() {
|
|
47
|
-
var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
48
|
-
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 60;
|
|
49
|
-
var ellipsis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
50
|
-
var putEllipsis = ellipsis ? " ..." : "";
|
|
51
|
-
return typeof string === "string" && string.length > limit ? string.substring(0, limit) + putEllipsis : string;
|
|
52
|
-
}
|
|
53
|
-
var timestampToFormat = function timestampToFormat(value, unit, suffix, timestamp) {
|
|
54
|
-
var config = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
55
|
-
var _config$showTime = config.showTime,
|
|
56
|
-
showTime = _config$showTime === void 0 ? false : _config$showTime,
|
|
57
|
-
_config$isTimeFirst = config.isTimeFirst,
|
|
58
|
-
isTimeFirst = _config$isTimeFirst === void 0 ? false : _config$isTimeFirst,
|
|
59
|
-
_config$isUpperCase = config.isUpperCase,
|
|
60
|
-
isUpperCase = _config$isUpperCase === void 0 ? false : _config$isUpperCase,
|
|
61
|
-
_config$disableMeridi = config.disableMeridiem,
|
|
62
|
-
disableMeridiem = _config$disableMeridi === void 0 ? false : _config$disableMeridi,
|
|
63
|
-
_config$timeFormat = config.timeFormat,
|
|
64
|
-
timeFormat = _config$timeFormat === void 0 ? "12hours" : _config$timeFormat;
|
|
65
|
-
var monthList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
66
|
-
var dateTime = new Date(timestamp);
|
|
67
|
-
var date = dateTime.getDate().toString().padStart(2, 0);
|
|
68
|
-
var month = monthList[dateTime.getMonth()];
|
|
69
|
-
var localizedMonth = month;
|
|
70
|
-
|
|
71
|
-
if (isUpperCase) {
|
|
72
|
-
localizedMonth = lodash.upperCase(month);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
var year = dateTime.getFullYear();
|
|
76
|
-
var localizedMeridiem = config.localizedMeridiem,
|
|
77
|
-
localizedMonths = config.localizedMonths,
|
|
78
|
-
_config$direction = config.direction,
|
|
79
|
-
direction = _config$direction === void 0 ? "ltr" : _config$direction;
|
|
80
|
-
var time = formatAMPM(timestamp, timeFormat);
|
|
81
|
-
var timeWithLocalizedMeridiem = time;
|
|
82
|
-
var timetoShow;
|
|
83
|
-
|
|
84
|
-
if (localizedMonths) {
|
|
85
|
-
localizedMonth = lodash.get(localizedMonths, [lodash.lowerCase(month)]) || month;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (localizedMeridiem) {
|
|
89
|
-
var isAm = time.includes("am");
|
|
90
|
-
var _localizedMeridiem$am = localizedMeridiem.am,
|
|
91
|
-
am = _localizedMeridiem$am === void 0 ? "am" : _localizedMeridiem$am,
|
|
92
|
-
_localizedMeridiem$pm = localizedMeridiem.pm,
|
|
93
|
-
pm = _localizedMeridiem$pm === void 0 ? "pm" : _localizedMeridiem$pm;
|
|
94
|
-
timeWithLocalizedMeridiem = (isAm ? time.replace("am", am) : time.replace("pm", pm)) || time;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (direction === "rtl") {
|
|
98
|
-
timetoShow = showTime ? "".concat(timeWithLocalizedMeridiem) : "";
|
|
99
|
-
return "".concat(date, " ").concat(localizedMonth, ", ").concat(year, " ").concat(timetoShow, " ");
|
|
100
|
-
} else {
|
|
101
|
-
if (disableMeridiem) {
|
|
102
|
-
return "".concat(localizedMonth, " ").concat(date, ", ").concat(year);
|
|
103
|
-
} else if (isTimeFirst) {
|
|
104
|
-
return "".concat(timeWithLocalizedMeridiem, ", ").concat(date, " ").concat(localizedMonth, " ").concat(year);
|
|
105
|
-
} else {
|
|
106
|
-
timetoShow = showTime ? ", ".concat(timeWithLocalizedMeridiem) : "";
|
|
107
|
-
return "".concat(date, " ").concat(localizedMonth, ", ").concat(year).concat(timetoShow);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
function formatter(value, unit, suffix, date, config) {
|
|
112
|
-
var showDateForUnits = ["day", "week", "month", "year"]; // suffix here refers to ago
|
|
113
|
-
// unit here refers to seconds, minute, minutes,...
|
|
114
|
-
|
|
115
|
-
var localizedSuffix = lodash.get(config, ["localizedPublishTime", suffix]) || suffix;
|
|
116
|
-
var localizedUnitOfTime;
|
|
117
|
-
|
|
118
|
-
if (unit === "hour" && value > 23 || showDateForUnits.indexOf(unit) !== -1) {
|
|
119
|
-
return timestampToFormat(value, unit, suffix, date, config);
|
|
120
|
-
} else if (value > 1) {
|
|
121
|
-
localizedUnitOfTime = lodash.get(config, ["localizedPublishTime", "".concat(unit, "s")]) || "".concat(unit, "s");
|
|
122
|
-
return "".concat(value, " ").concat(localizedUnitOfTime, " ").concat(localizedSuffix);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
localizedUnitOfTime = lodash.get(config, ["localizedPublishTime", unit]) || unit;
|
|
126
|
-
return "".concat(value, " ").concat(localizedUnitOfTime, " ").concat(localizedSuffix, " ");
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function formatAMPM(timestamp) {
|
|
130
|
-
var timeFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "12hours";
|
|
131
|
-
var dateTime = new Date(timestamp);
|
|
132
|
-
var hours = dateTime.getHours();
|
|
133
|
-
var minutes = dateTime.getMinutes();
|
|
134
|
-
var ampm = hours >= 12 ? "pm" : "am";
|
|
135
|
-
hours = hours % 12;
|
|
136
|
-
hours = hours || 12;
|
|
137
|
-
minutes = minutes < 10 ? "0" + minutes : minutes;
|
|
138
|
-
var strTime = hours + ":" + minutes + " " + ampm;
|
|
139
|
-
|
|
140
|
-
if (timeFormat === "24hours") {
|
|
141
|
-
return dateTime.toLocaleTimeString([], {
|
|
142
|
-
hour: "2-digit",
|
|
143
|
-
minute: "2-digit"
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return strTime;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var hexToRGB = function hexToRGB(hex) {
|
|
151
|
-
var r = parseInt(hex.slice(1, 3), 16);
|
|
152
|
-
var g = parseInt(hex.slice(3, 5), 16);
|
|
153
|
-
var b = parseInt(hex.slice(5, 7), 16);
|
|
154
|
-
return {
|
|
155
|
-
r: r,
|
|
156
|
-
g: g,
|
|
157
|
-
b: b
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
var getLuminanceOfColor = function getLuminanceOfColor(hex) {
|
|
161
|
-
var _hexToRGB = hexToRGB(hex),
|
|
162
|
-
r = _hexToRGB.r,
|
|
163
|
-
g = _hexToRGB.g,
|
|
164
|
-
b = _hexToRGB.b;
|
|
165
|
-
|
|
166
|
-
return r * 0.299 + g * 0.587 + b * 0.114;
|
|
167
|
-
};
|
|
168
|
-
var rgbToHex = function rgbToHex() {
|
|
169
|
-
var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgba(255, 255, 255, 0)";
|
|
170
|
-
var rgba = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
|
|
171
|
-
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;
|
|
172
|
-
};
|
|
173
|
-
var clientWidths = {
|
|
174
|
-
mobile: 767,
|
|
175
|
-
tablet: 1024
|
|
176
|
-
};
|
|
177
|
-
var clientWidth = function clientWidth(device) {
|
|
178
|
-
var foundDeviceWidth = lodash.get(clientWidths, device);
|
|
179
|
-
|
|
180
|
-
if (foundDeviceWidth) {
|
|
181
|
-
return lodash.get(global, "document.documentElement.clientWidth") <= foundDeviceWidth;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return false;
|
|
185
|
-
};
|
|
186
|
-
var getTextColor = function getTextColor() {
|
|
187
|
-
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgb(255,255,255)";
|
|
188
|
-
var isRegexCheck = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(theme);
|
|
189
|
-
var getHexValue = !isRegexCheck ? rgbToHex(theme) : theme;
|
|
190
|
-
var textColor = getLuminanceOfColor(getHexValue) < 155 ? "light" : "dark";
|
|
191
|
-
return textColor;
|
|
192
|
-
};
|
|
193
|
-
function getNumberOfStoriesToShow(numberOfStoriesToShow) {
|
|
194
|
-
return numberOfStoriesToShow ? parseInt(numberOfStoriesToShow) : 1;
|
|
195
|
-
}
|
|
196
|
-
var getSlug = function getSlug(collection) {
|
|
197
|
-
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
198
|
-
var _config$magazineSlug = config.magazineSlug,
|
|
199
|
-
magazineSlug = _config$magazineSlug === void 0 ? "" : _config$magazineSlug,
|
|
200
|
-
_config$isArchivePage = config.isArchivePage,
|
|
201
|
-
isArchivePage = _config$isArchivePage === void 0 ? false : _config$isArchivePage;
|
|
202
|
-
|
|
203
|
-
if (isArchivePage) {
|
|
204
|
-
return "/magazine/archive/".concat(magazineSlug);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (magazineSlug) {
|
|
208
|
-
return "/magazine/".concat(magazineSlug, "/").concat(collection.slug);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
var isSection = collection.template === "section";
|
|
212
|
-
|
|
213
|
-
if (isSection) {
|
|
214
|
-
var sectionId = lodash.get(collection, ["metadata", "section", "0", "id"], "");
|
|
215
|
-
var sections = config.sections;
|
|
216
|
-
var section = sections && sections.find(function (section) {
|
|
217
|
-
return section.id === sectionId;
|
|
218
|
-
});
|
|
219
|
-
return section ? section["section-url"] : "/";
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return "/collection/".concat(collection.slug);
|
|
223
|
-
};
|
|
224
|
-
function isExternalStory() {
|
|
225
|
-
var story = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
226
|
-
var _story$storyTemplate = story["story-template"],
|
|
227
|
-
storyTemplate = _story$storyTemplate === void 0 ? "" : _story$storyTemplate,
|
|
228
|
-
_story$metadata = story.metadata,
|
|
229
|
-
metadata = _story$metadata === void 0 ? {} : _story$metadata;
|
|
230
|
-
return storyTemplate === "news-elsewhere" ? lodash.get(metadata, ["reference-url"], "") : "";
|
|
231
|
-
} // Adds target='_blank' attribute to anchor tags if not present
|
|
232
|
-
var isEmpty = function isEmpty(value) {
|
|
233
|
-
return value == null || // From standard.js: Always use === - but value == null is allowed to check null || undefined
|
|
234
|
-
_typeof__default["default"](value) === "object" && Object.entries(value).length === 0 && value.constructor === Object || typeof value === "string" && value.trim().length === 0;
|
|
235
|
-
};
|
|
236
|
-
PropTypes__default["default"].shape({
|
|
237
|
-
"sketches-host": PropTypes__default["default"].string,
|
|
238
|
-
"cdn-name": PropTypes__default["default"].string,
|
|
239
|
-
"cdn-image": PropTypes__default["default"].string
|
|
240
|
-
});
|
|
241
|
-
PropTypes__default["default"].shape({
|
|
242
|
-
headline: PropTypes__default["default"].string,
|
|
243
|
-
"last-published-at": PropTypes__default["default"].number,
|
|
244
|
-
subheadline: PropTypes__default["default"].string
|
|
245
|
-
});
|
|
246
|
-
var getStoryUrl = function getStoryUrl(story) {
|
|
247
|
-
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
248
|
-
return lodash.get(story, ["story-template"]) === "news-elsewhere" ? lodash.get(story, ["metadata", "reference-url"], "") : story.url || defaultValue;
|
|
249
|
-
};
|
|
250
|
-
var navigateTo = function navigateTo(dispatch) {
|
|
251
|
-
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
252
|
-
global.app.navigateToPage(dispatch, url);
|
|
253
|
-
};
|
|
254
|
-
var generateNavigateSlug = function generateNavigateSlug() {
|
|
255
|
-
var collection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
256
|
-
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
257
|
-
var customUrlPath = arguments.length > 2 ? arguments[2] : undefined;
|
|
258
|
-
|
|
259
|
-
if (customUrlPath) {
|
|
260
|
-
return customUrlPath;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
var _config$magazineSlug2 = config.magazineSlug,
|
|
264
|
-
magazineSlug = _config$magazineSlug2 === void 0 ? "" : _config$magazineSlug2,
|
|
265
|
-
_config$isArchivePage2 = config.isArchivePage,
|
|
266
|
-
isArchivePage = _config$isArchivePage2 === void 0 ? false : _config$isArchivePage2;
|
|
267
|
-
|
|
268
|
-
if (isArchivePage) {
|
|
269
|
-
return "/magazine/archive/".concat(magazineSlug);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (magazineSlug) {
|
|
273
|
-
return "/magazine/".concat(magazineSlug, "/").concat(collection.slug);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if (collection) {
|
|
277
|
-
return getSlug(collection, config);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return "/";
|
|
281
|
-
};
|
|
282
|
-
var getTimeStamp = function getTimeStamp(date, _formatter) {
|
|
283
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
284
|
-
var template = arguments.length > 3 ? arguments[3] : undefined;
|
|
285
|
-
var timezone = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
286
|
-
|
|
287
|
-
if (timezone && template === "story") {
|
|
288
|
-
var zonedTime = timezone && dateFnsTz.utcToZonedTime(date, timezone);
|
|
289
|
-
var formatZonedTime = zonedTime && dateFnsTz.format(zonedTime, "yyyy-MM-dd'T'HH:mm:ssXXX", {
|
|
290
|
-
timeZone: timezone
|
|
291
|
-
});
|
|
292
|
-
var timeStamp = timestampToFormat("", "", "", date, config);
|
|
293
|
-
return /*#__PURE__*/React__default["default"].createElement("time", {
|
|
294
|
-
dateTime: formatZonedTime
|
|
295
|
-
}, timeStamp);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
return /*#__PURE__*/React__default["default"].createElement(Timeago__default["default"], {
|
|
299
|
-
date: date,
|
|
300
|
-
formatter: function formatter(value, unit, suffix, date) {
|
|
301
|
-
return _formatter(value, unit, suffix, date, config);
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
var _styleModuleImportMap$f = {
|
|
307
|
-
"./collection-name.m.css": {
|
|
308
|
-
"collection": "collection-name-m_collection__JD6sx",
|
|
309
|
-
"collection-borderLeft": "collection-name-m_collection-borderLeft__3Dznk",
|
|
310
|
-
"border-left": "collection-name-m_border-left__3_pYw",
|
|
311
|
-
"collection-borderBottomFull": "collection-name-m_collection-borderBottomFull__Dkq3K",
|
|
312
|
-
"collection-borderBottom": "collection-name-m_collection-borderBottom__2rdQM",
|
|
313
|
-
"collection-crossLine": "collection-name-m_collection-crossLine__1sIpN",
|
|
314
|
-
"border-bottom": "collection-name-m_border-bottom__1MnlV",
|
|
315
|
-
"dark": "collection-name-m_dark__nMe5H",
|
|
316
|
-
"light": "collection-name-m_light__1vFDN"
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
var CollectionNameBase = function CollectionNameBase(_ref) {
|
|
320
|
-
var _ref$collectionNameBo = _ref.collectionNameBorderColor,
|
|
321
|
-
collectionNameBorderColor = _ref$collectionNameBo === void 0 ? "" : _ref$collectionNameBo,
|
|
322
|
-
collection = _ref.collection,
|
|
323
|
-
config = _ref.config,
|
|
324
|
-
collectionNameTemplate = _ref.collectionNameTemplate,
|
|
325
|
-
headerLevel = _ref.headerLevel,
|
|
326
|
-
_ref$customCollection = _ref.customCollectionName,
|
|
327
|
-
customCollectionName = _ref$customCollection === void 0 ? "" : _ref$customCollection,
|
|
328
|
-
_ref$navigate = _ref.navigate,
|
|
329
|
-
navigate = _ref$navigate === void 0 ? true : _ref$navigate;
|
|
330
|
-
var collectionTitle = useStateValue() || {};
|
|
331
|
-
var showRowTitle = lodash.get(collectionTitle, ["showRowTitle"], true);
|
|
332
|
-
var supportedTemplates = ["borderLeft", "borderBottom", "crossLine", "borderBottomFull"];
|
|
333
|
-
var templateStyle = supportedTemplates.includes(collectionNameTemplate) ? " collection-".concat(collectionNameTemplate) : "";
|
|
334
|
-
var slug = navigate && collection && getSlug(collection, config) || "";
|
|
335
|
-
var collectionName = customCollectionName || collection.name || "";
|
|
336
|
-
var textColor = getTextColor(collectionTitle.theme);
|
|
337
|
-
var HeaderTag = "h" + headerLevel;
|
|
338
|
-
var CollectionNameBorderColor = rgbToHex(collectionNameBorderColor);
|
|
339
|
-
var borderBottomFullStyle = templateStyle.includes("collection-borderBottomFull") ? "4px solid ".concat(CollectionNameBorderColor) : "";
|
|
340
|
-
|
|
341
|
-
var borderBottomStyle = function borderBottomStyle() {
|
|
342
|
-
return templateStyle.includes("collection-borderBottom") && !templateStyle.includes("collection-borderBottomFull") ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
343
|
-
className: "collection-name-m_border-bottom__1MnlV",
|
|
344
|
-
style: {
|
|
345
|
-
borderBottom: "4px solid ".concat(CollectionNameBorderColor)
|
|
346
|
-
}
|
|
347
|
-
}) : "";
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
var isMobile = clientWidth("mobile");
|
|
351
|
-
|
|
352
|
-
var getBorderHeight = function getBorderHeight() {
|
|
353
|
-
if (isMobile) {
|
|
354
|
-
switch (headerLevel) {
|
|
355
|
-
case "1":
|
|
356
|
-
return "32px";
|
|
357
|
-
|
|
358
|
-
case "2":
|
|
359
|
-
return "24px";
|
|
360
|
-
|
|
361
|
-
case "3":
|
|
362
|
-
return "20px";
|
|
363
|
-
|
|
364
|
-
case "4":
|
|
365
|
-
return "18px";
|
|
366
|
-
|
|
367
|
-
case "5":
|
|
368
|
-
return "16px";
|
|
369
|
-
|
|
370
|
-
case "6":
|
|
371
|
-
return "16px";
|
|
372
|
-
|
|
373
|
-
default:
|
|
374
|
-
return "20px";
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
switch (headerLevel) {
|
|
379
|
-
case "1":
|
|
380
|
-
return "40px";
|
|
381
|
-
|
|
382
|
-
case "2":
|
|
383
|
-
return "32px";
|
|
384
|
-
|
|
385
|
-
case "3":
|
|
386
|
-
return "24px";
|
|
387
|
-
|
|
388
|
-
case "4":
|
|
389
|
-
return "20px";
|
|
390
|
-
|
|
391
|
-
case "5":
|
|
392
|
-
return "18px";
|
|
393
|
-
|
|
394
|
-
case "6":
|
|
395
|
-
return "16px";
|
|
396
|
-
|
|
397
|
-
default:
|
|
398
|
-
return "24px";
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showRowTitle && collectionName && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
403
|
-
style: {
|
|
404
|
-
borderBottom: borderBottomFullStyle
|
|
405
|
-
},
|
|
406
|
-
"data-test-id": "collection-name",
|
|
407
|
-
className: ("arr--collection-name arrow-component ".concat(templateStyle) ? "arr--collection-name arrow-component ".concat(templateStyle) + " " : "") + _getClassName__default["default"]("collection ".concat(textColor, " ").concat(templateStyle), _styleModuleImportMap$f)
|
|
408
|
-
}, templateStyle.includes("collection-borderLeft") && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
409
|
-
className: "arr-collection-name-border-left collection-name-m_border-left__3_pYw",
|
|
410
|
-
style: {
|
|
411
|
-
color: CollectionNameBorderColor,
|
|
412
|
-
fontSize: getBorderHeight()
|
|
413
|
-
}
|
|
414
|
-
}), slug && !slug.includes(undefined) ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
415
|
-
href: slug,
|
|
416
|
-
"aria-label": "collection-name"
|
|
417
|
-
}, /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName), borderBottomStyle()));
|
|
418
|
-
};
|
|
419
|
-
CollectionNameBase.propTypes = {
|
|
420
|
-
/** Collection name border color */
|
|
421
|
-
collectionNameBorderColor: PropTypes.PropTypes.string,
|
|
422
|
-
|
|
423
|
-
/** The Collection Object from the API response */
|
|
424
|
-
collection: PropTypes.PropTypes.object,
|
|
425
|
-
|
|
426
|
-
/** The publisher config from the API response */
|
|
427
|
-
config: PropTypes.PropTypes.object,
|
|
428
|
-
|
|
429
|
-
/** The style template for the component */
|
|
430
|
-
collectionNameTemplate: PropTypes.PropTypes.oneOf(["", "borderLeft", "borderBottom", "crossLine", "borderBottomFull"]),
|
|
431
|
-
|
|
432
|
-
/** Header tags ranging h1-h6, where h[headerLevel] */
|
|
433
|
-
headerLevel: PropTypes.PropTypes.string,
|
|
434
|
-
customCollectionName: PropTypes.PropTypes.string,
|
|
435
|
-
navigate: PropTypes.PropTypes.bool
|
|
436
|
-
};
|
|
437
|
-
CollectionNameBase.defaultProps = {
|
|
438
|
-
collectionNameTemplate: "",
|
|
439
|
-
headerLevel: "3"
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
function mapStateToProps$1(state) {
|
|
443
|
-
return {
|
|
444
|
-
config: lodash.get(state, ["qt", "config"], {})
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
var CollectionName = reactRedux.connect(mapStateToProps$1)(CollectionNameBase);
|
|
449
|
-
|
|
450
|
-
var CrownIcon = function CrownIcon(_ref) {
|
|
451
|
-
var height = _ref.height,
|
|
452
|
-
width = _ref.width,
|
|
453
|
-
_ref$color = _ref.color,
|
|
454
|
-
color = _ref$color === void 0 ? "#D8D8D8" : _ref$color,
|
|
455
|
-
positionTop = _ref.positionTop;
|
|
456
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
457
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
458
|
-
width: width,
|
|
459
|
-
height: height,
|
|
460
|
-
viewBox: "0 0 40 40",
|
|
461
|
-
style: {
|
|
462
|
-
position: "relative",
|
|
463
|
-
top: positionTop
|
|
464
|
-
}
|
|
465
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
466
|
-
fill: "none",
|
|
467
|
-
fillRule: "evenodd",
|
|
468
|
-
stroke: "none",
|
|
469
|
-
strokeWidth: "1"
|
|
470
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
471
|
-
transform: "translate(8 8)"
|
|
472
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
473
|
-
d: "M0 0H24V24H0z"
|
|
474
|
-
}), /*#__PURE__*/React__default["default"].createElement("g", {
|
|
475
|
-
fill: color,
|
|
476
|
-
fillRule: "nonzero",
|
|
477
|
-
transform: "translate(0 2)"
|
|
478
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
479
|
-
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"
|
|
480
|
-
}))))));
|
|
481
|
-
};
|
|
482
|
-
CrownIcon.propTypes = {
|
|
483
|
-
height: PropTypes__default["default"].string,
|
|
484
|
-
width: PropTypes__default["default"].string,
|
|
485
|
-
color: PropTypes__default["default"].string,
|
|
486
|
-
positionTop: PropTypes__default["default"].string
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
var KeyIcon = function KeyIcon(_ref) {
|
|
490
|
-
var height = _ref.height,
|
|
491
|
-
width = _ref.width,
|
|
492
|
-
_ref$color = _ref.color,
|
|
493
|
-
color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
|
|
494
|
-
positionTop = _ref.positionTop;
|
|
495
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
496
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
497
|
-
width: width,
|
|
498
|
-
height: height,
|
|
499
|
-
viewBox: "0 0 40 40",
|
|
500
|
-
style: {
|
|
501
|
-
position: "relative",
|
|
502
|
-
top: positionTop
|
|
503
|
-
}
|
|
504
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
505
|
-
fill: "none",
|
|
506
|
-
fillRule: "evenodd",
|
|
507
|
-
stroke: "none",
|
|
508
|
-
strokeWidth: "1"
|
|
509
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
510
|
-
transform: "translate(8 8)"
|
|
511
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
512
|
-
d: "M0 0H24V24H0z"
|
|
513
|
-
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
|
514
|
-
fill: color,
|
|
515
|
-
fillRule: "nonzero",
|
|
516
|
-
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",
|
|
517
|
-
transform: "translate(0 5)"
|
|
518
|
-
})))));
|
|
519
|
-
};
|
|
520
|
-
KeyIcon.propTypes = {
|
|
521
|
-
height: PropTypes__default["default"].string,
|
|
522
|
-
width: PropTypes__default["default"].string,
|
|
523
|
-
color: PropTypes__default["default"].string,
|
|
524
|
-
positionTop: PropTypes__default["default"].string
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
var LockIcon = function LockIcon(_ref) {
|
|
528
|
-
var height = _ref.height,
|
|
529
|
-
width = _ref.width,
|
|
530
|
-
_ref$color = _ref.color,
|
|
531
|
-
color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
|
|
532
|
-
positionTop = _ref.positionTop;
|
|
533
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
534
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
535
|
-
width: width,
|
|
536
|
-
height: height,
|
|
537
|
-
viewBox: "0 0 40 40",
|
|
538
|
-
style: {
|
|
539
|
-
position: "relative",
|
|
540
|
-
top: positionTop
|
|
541
|
-
}
|
|
542
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
543
|
-
fill: "none",
|
|
544
|
-
fillRule: "evenodd",
|
|
545
|
-
stroke: "none",
|
|
546
|
-
strokeWidth: "1"
|
|
547
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
548
|
-
transform: "translate(8 8)"
|
|
549
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
550
|
-
d: "M0 0H24V24H0z"
|
|
551
|
-
}), /*#__PURE__*/React__default["default"].createElement("g", {
|
|
552
|
-
fill: color,
|
|
553
|
-
fillRule: "nonzero",
|
|
554
|
-
transform: "translate(3)"
|
|
555
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
556
|
-
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"
|
|
557
|
-
}))))));
|
|
558
|
-
};
|
|
559
|
-
LockIcon.propTypes = {
|
|
560
|
-
height: PropTypes__default["default"].string,
|
|
561
|
-
width: PropTypes__default["default"].string,
|
|
562
|
-
color: PropTypes__default["default"].string,
|
|
563
|
-
positionTop: PropTypes__default["default"].string
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
var StarIcon = function StarIcon(_ref) {
|
|
567
|
-
var width = _ref.width,
|
|
568
|
-
height = _ref.height,
|
|
569
|
-
_ref$color = _ref.color,
|
|
570
|
-
color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
|
|
571
|
-
_ref$positionTop = _ref.positionTop,
|
|
572
|
-
positionTop = _ref$positionTop === void 0 ? "" : _ref$positionTop;
|
|
573
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
574
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
575
|
-
width: width,
|
|
576
|
-
height: height,
|
|
577
|
-
viewBox: "0 0 40 40",
|
|
578
|
-
style: {
|
|
579
|
-
position: "relative",
|
|
580
|
-
top: positionTop
|
|
581
|
-
}
|
|
582
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
583
|
-
fill: "none",
|
|
584
|
-
fillRule: "evenodd",
|
|
585
|
-
stroke: "none",
|
|
586
|
-
strokeWidth: "1"
|
|
587
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
588
|
-
fill: color,
|
|
589
|
-
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"
|
|
590
|
-
}))));
|
|
591
|
-
};
|
|
592
|
-
StarIcon.propTypes = {
|
|
593
|
-
height: PropTypes__default["default"].string,
|
|
594
|
-
width: PropTypes__default["default"].string,
|
|
595
|
-
color: PropTypes__default["default"].string,
|
|
596
|
-
positionTop: PropTypes__default["default"].string
|
|
597
|
-
};
|
|
598
|
-
|
|
599
|
-
var PremiumStoryIcon = function PremiumStoryIcon(_ref) {
|
|
600
|
-
var width = _ref.width,
|
|
601
|
-
height = _ref.height,
|
|
602
|
-
color = _ref.color,
|
|
603
|
-
iconType = _ref.iconType,
|
|
604
|
-
positionTop = _ref.positionTop;
|
|
605
|
-
|
|
606
|
-
switch (iconType) {
|
|
607
|
-
case "crown":
|
|
608
|
-
return /*#__PURE__*/React__default["default"].createElement(CrownIcon, {
|
|
609
|
-
width: width,
|
|
610
|
-
height: height,
|
|
611
|
-
color: color,
|
|
612
|
-
positionTop: positionTop
|
|
613
|
-
});
|
|
614
|
-
|
|
615
|
-
case "lock":
|
|
616
|
-
return /*#__PURE__*/React__default["default"].createElement(LockIcon, {
|
|
617
|
-
width: width,
|
|
618
|
-
height: height,
|
|
619
|
-
color: color,
|
|
620
|
-
positionTop: positionTop
|
|
621
|
-
});
|
|
622
|
-
|
|
623
|
-
case "key":
|
|
624
|
-
return /*#__PURE__*/React__default["default"].createElement(KeyIcon, {
|
|
625
|
-
width: width,
|
|
626
|
-
height: height,
|
|
627
|
-
color: color,
|
|
628
|
-
positionTop: positionTop
|
|
629
|
-
});
|
|
630
|
-
|
|
631
|
-
default:
|
|
632
|
-
return /*#__PURE__*/React__default["default"].createElement(StarIcon, {
|
|
633
|
-
width: width,
|
|
634
|
-
height: height,
|
|
635
|
-
color: color,
|
|
636
|
-
positionTop: positionTop
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
};
|
|
640
|
-
PremiumStoryIcon.propTypes = {
|
|
641
|
-
width: PropTypes__default["default"].string,
|
|
642
|
-
height: PropTypes__default["default"].string,
|
|
643
|
-
color: PropTypes__default["default"].string,
|
|
644
|
-
iconType: PropTypes__default["default"].string,
|
|
645
|
-
positionTop: PropTypes__default["default"].string
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
function LiveIcon() {
|
|
649
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
650
|
-
className: "live-icon",
|
|
651
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
652
|
-
width: "25",
|
|
653
|
-
height: "24",
|
|
654
|
-
viewBox: "0 0 25 24"
|
|
655
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
656
|
-
fill: "#ff5858",
|
|
657
|
-
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"
|
|
658
|
-
}));
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
var _styleModuleImportMap$e = {
|
|
662
|
-
"./headline.m.css": {
|
|
663
|
-
"wrapper": "headline-m_wrapper__3nUmh",
|
|
664
|
-
"headline": "headline-m_headline__3_NhV",
|
|
665
|
-
"dark": "headline-m_dark__en3hW",
|
|
666
|
-
"light": "headline-m_light__3lKJB"
|
|
667
|
-
}
|
|
668
|
-
};
|
|
669
|
-
var Headline = function Headline(_ref) {
|
|
670
|
-
var story = _ref.story,
|
|
671
|
-
headerLevel = _ref.headerLevel,
|
|
672
|
-
_ref$premiumStoryIcon = _ref.premiumStoryIconConfig,
|
|
673
|
-
premiumStoryIconConfig = _ref$premiumStoryIcon === void 0 ? {} : _ref$premiumStoryIcon,
|
|
674
|
-
isLink = _ref.isLink;
|
|
675
|
-
var configData = useStateValue() || {};
|
|
676
|
-
var _premiumStoryIconConf = premiumStoryIconConfig.iconColor,
|
|
677
|
-
iconColor = _premiumStoryIconConf === void 0 ? "#F7B500" : _premiumStoryIconConf,
|
|
678
|
-
_premiumStoryIconConf2 = premiumStoryIconConfig.iconStyle,
|
|
679
|
-
iconStyle = _premiumStoryIconConf2 === void 0 ? "star" : _premiumStoryIconConf2,
|
|
680
|
-
_premiumStoryIconConf3 = premiumStoryIconConfig.enablePremiumStoryIcon,
|
|
681
|
-
enablePremiumStoryIcon = _premiumStoryIconConf3 === void 0 ? false : _premiumStoryIconConf3,
|
|
682
|
-
_premiumStoryIconConf4 = premiumStoryIconConfig.showLiveIcon,
|
|
683
|
-
showLiveIcon = _premiumStoryIconConf4 === void 0 ? false : _premiumStoryIconConf4;
|
|
684
|
-
var alternateHeadline = lodash.get(story, ["alternative", "home", "default", "headline"]);
|
|
685
|
-
var premiumStory = enablePremiumStoryIcon && lodash.get(story, ["access"]) === "subscription";
|
|
686
|
-
var headline = alternateHeadline || story.headline;
|
|
687
|
-
var HeaderTag = "h" + headerLevel;
|
|
688
|
-
|
|
689
|
-
var positionHeadline = function positionHeadline() {
|
|
690
|
-
switch (parseInt(headerLevel)) {
|
|
691
|
-
case 1:
|
|
692
|
-
return "-2px";
|
|
693
|
-
|
|
694
|
-
case 2:
|
|
695
|
-
return "2px";
|
|
696
|
-
|
|
697
|
-
case 3:
|
|
698
|
-
return "4px";
|
|
699
|
-
|
|
700
|
-
case 4:
|
|
701
|
-
return "5px";
|
|
702
|
-
|
|
703
|
-
default:
|
|
704
|
-
return "6px";
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
var textColor = getTextColor(configData.theme);
|
|
709
|
-
var wrapperClass = premiumStory ? "wrapper" : "";
|
|
710
|
-
var iconSize = "24px";
|
|
711
|
-
var enableLiveIcon = showLiveIcon && story["story-template"] === "live-blog" && !lodash.get(story, ["metadata", "is-closed"], false);
|
|
712
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
713
|
-
"data-test-id": "headline",
|
|
714
|
-
className: "arrow-component arr--headline " + _getClassName__default["default"](wrapperClass, _styleModuleImportMap$e)
|
|
715
|
-
}, premiumStory && /*#__PURE__*/React__default["default"].createElement(PremiumStoryIcon, {
|
|
716
|
-
width: iconSize,
|
|
717
|
-
height: iconSize,
|
|
718
|
-
color: iconColor,
|
|
719
|
-
iconType: iconStyle,
|
|
720
|
-
positionTop: positionHeadline()
|
|
721
|
-
}), isLink ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
722
|
-
href: getStoryUrl(story, "/".concat(story.slug)),
|
|
723
|
-
externalLink: isExternalStory(story),
|
|
724
|
-
"aria-label": "headline"
|
|
725
|
-
}, /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
|
|
726
|
-
className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$e)
|
|
727
|
-
}, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
|
|
728
|
-
className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$e)
|
|
729
|
-
}, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline));
|
|
730
|
-
};
|
|
731
|
-
Headline.propTypes = {
|
|
732
|
-
/** The Story Object from the API response */
|
|
733
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
734
|
-
|
|
735
|
-
/** Header tags ranging h1-h6, where h[headerLevel] */
|
|
736
|
-
headerLevel: PropTypes__default["default"].string,
|
|
737
|
-
premiumStoryIconConfig: PropTypes__default["default"].shape({
|
|
738
|
-
iconColor: PropTypes__default["default"].string,
|
|
739
|
-
iconType: PropTypes__default["default"].string,
|
|
740
|
-
enablePremiumStoryIcon: PropTypes__default["default"].bool
|
|
741
|
-
}),
|
|
742
|
-
isLink: PropTypes__default["default"].bool
|
|
743
|
-
};
|
|
744
|
-
Headline.defaultProps = {
|
|
745
|
-
headerLevel: "6",
|
|
746
|
-
isLink: true
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
var _styleModuleImportMap$d = {
|
|
750
|
-
"./subheadline.m.css": {
|
|
751
|
-
"subheadline": "subheadline-m_subheadline__3fd7z",
|
|
752
|
-
"dark": "subheadline-m_dark__28u00",
|
|
753
|
-
"light": "subheadline-m_light__2YUOe"
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
var Subheadline = function Subheadline(_ref) {
|
|
757
|
-
var story = _ref.story,
|
|
758
|
-
_ref$truncateChars = _ref.truncateChars,
|
|
759
|
-
truncateChars = _ref$truncateChars === void 0 ? 200 : _ref$truncateChars,
|
|
760
|
-
lineClamp = _ref.lineClamp,
|
|
761
|
-
_ref$clazzName = _ref.clazzName,
|
|
762
|
-
clazzName = _ref$clazzName === void 0 ? "" : _ref$clazzName,
|
|
763
|
-
forceShowAtom = _ref.forceShowAtom,
|
|
764
|
-
showFullContent = _ref.showFullContent;
|
|
765
|
-
var config = useStateValue() || {};
|
|
766
|
-
var subheadline = forceShowAtom || lodash.get(config, ["showSubheadline"], true);
|
|
767
|
-
if (!subheadline) return null;
|
|
768
|
-
var textColor = getTextColor(config.theme);
|
|
769
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
770
|
-
style: {
|
|
771
|
-
WebkitLineClamp: lineClamp
|
|
772
|
-
},
|
|
773
|
-
"data-test-id": "subheadline",
|
|
774
|
-
className: ("p-alt arr--sub-headline arrow-component ".concat(clazzName) ? "p-alt arr--sub-headline arrow-component ".concat(clazzName) + " " : "") + _getClassName__default["default"]("subheadline ".concat(textColor), _styleModuleImportMap$d)
|
|
775
|
-
}, showFullContent || typeof lineClamp === "number" ? story.subheadline : truncate(story.subheadline, truncateChars, true));
|
|
776
|
-
};
|
|
777
|
-
Subheadline.propTypes = {
|
|
778
|
-
/** The Story Object from the API response */
|
|
779
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
780
|
-
// Restricts the number of lines for subheadline.
|
|
781
|
-
lineClamp: PropTypes__default["default"].number,
|
|
782
|
-
|
|
783
|
-
/** Number of characters to truncate the subheadline */
|
|
784
|
-
truncateChars: PropTypes__default["default"].number,
|
|
785
|
-
clazzName: PropTypes__default["default"].string,
|
|
786
|
-
forceShowAtom: PropTypes__default["default"].bool,
|
|
787
|
-
showFullContent: PropTypes__default["default"].bool
|
|
788
|
-
};
|
|
789
|
-
Subheadline.defaultProps = {
|
|
790
|
-
forceShowAtom: false,
|
|
791
|
-
showFullContent: false
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
var _styleModuleImportMap$c = {
|
|
795
|
-
"./timestamp.m.css": {
|
|
796
|
-
"time": "timestamp-m_time__2v46i",
|
|
797
|
-
"time-wrapper": "timestamp-m_time-wrapper__3O2lM",
|
|
798
|
-
"bottom-fix": "timestamp-m_bottom-fix__1Zh8r",
|
|
799
|
-
"dark": "timestamp-m_dark__2lk9E",
|
|
800
|
-
"light": "timestamp-m_light__2QlrI"
|
|
801
|
-
}
|
|
802
|
-
};
|
|
803
|
-
var TimeStamp = function TimeStamp(_ref) {
|
|
804
|
-
var story = _ref.story,
|
|
805
|
-
isBottom = _ref.isBottom,
|
|
806
|
-
_ref$config = _ref.config,
|
|
807
|
-
config = _ref$config === void 0 ? {} : _ref$config;
|
|
808
|
-
var configState = useStateValue() || {};
|
|
809
|
-
var isTime = lodash.get(config, ["showTime"], lodash.get(configState, ["showTime"], true));
|
|
810
|
-
var time = story["last-published-at"] || story["first-published-at"];
|
|
811
|
-
var isBottomClasses = isBottom ? "bottom-fix" : "";
|
|
812
|
-
var textColor = getTextColor(configState.theme);
|
|
813
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isTime && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
814
|
-
"data-test-id": "publish-time",
|
|
815
|
-
className: "time arr--publish-time " + _getClassName__default["default"]("time ".concat(textColor, " ").concat(isBottomClasses), _styleModuleImportMap$c)
|
|
816
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
817
|
-
className: "timestamp-m_time-wrapper__3O2lM"
|
|
818
|
-
}, getTimeStamp(time, formatter, config))));
|
|
819
|
-
};
|
|
820
|
-
TimeStamp.propTypes = {
|
|
821
|
-
/** The Story Object from the API response */
|
|
822
|
-
story: PropTypes__default["default"].object,
|
|
823
|
-
isBottom: PropTypes__default["default"].bool,
|
|
824
|
-
config: PropTypes__default["default"].object
|
|
825
|
-
};
|
|
826
|
-
|
|
827
|
-
var _styleModuleImportMap$b = {
|
|
828
|
-
"./author.m.css": {
|
|
829
|
-
"author": "author-m_author__WRuLm",
|
|
830
|
-
"author-image": "author-m_author-image__3q2oc",
|
|
831
|
-
"author-name": "author-m_author-name__3WP-O",
|
|
832
|
-
"bottom-fix": "author-m_bottom-fix__223TT",
|
|
833
|
-
"prefix": "author-m_prefix__YSInK",
|
|
834
|
-
"rtl-image": "author-m_rtl-image__2nglD",
|
|
835
|
-
"ltr-image": "author-m_ltr-image__3bc0L",
|
|
836
|
-
"dark": "author-m_dark__2TTlp",
|
|
837
|
-
"light": "author-m_light__3y8_x"
|
|
838
|
-
}
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
var AuthorBase = function AuthorBase(_ref) {
|
|
842
|
-
var story = _ref.story,
|
|
843
|
-
hideAuthorImage = _ref.hideAuthorImage,
|
|
844
|
-
isBottom = _ref.isBottom,
|
|
845
|
-
_ref$prefix = _ref.prefix,
|
|
846
|
-
prefix = _ref$prefix === void 0 ? "" : _ref$prefix,
|
|
847
|
-
_ref$config = _ref.config,
|
|
848
|
-
config = _ref$config === void 0 ? {} : _ref$config;
|
|
849
|
-
var configData = useStateValue() || {};
|
|
850
|
-
var isAuthor = lodash.get(configData, ["showAuthor"], true);
|
|
851
|
-
|
|
852
|
-
var _get = lodash.get(story, ["authors", "0"], ""),
|
|
853
|
-
avatarUrl = _get["avatar-url"],
|
|
854
|
-
avatarS3Key = _get["avatar-s3-key"],
|
|
855
|
-
authorName = _get.name,
|
|
856
|
-
slug = _get.slug;
|
|
857
|
-
|
|
858
|
-
var isBottomClasses = isBottom ? "bottom-fix" : "";
|
|
859
|
-
var textColor = getTextColor(configData.theme);
|
|
860
|
-
var mountAt = lodash.get(config, ["mountAt"], "");
|
|
861
|
-
|
|
862
|
-
var authorImage = function authorImage(dir) {
|
|
863
|
-
if (!avatarUrl && !avatarS3Key) {
|
|
864
|
-
return null;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
868
|
-
"data-test-id": "author-image",
|
|
869
|
-
className: _getClassName__default["default"]("author-image ".concat(dir, "-image"), _styleModuleImportMap$b)
|
|
870
|
-
}, /*#__PURE__*/React__default["default"].createElement("figure", null, avatarS3Key ? /*#__PURE__*/React__default["default"].createElement(components.ResponsiveImage, {
|
|
871
|
-
slug: avatarS3Key,
|
|
872
|
-
"aspect-ratio": [1, 1],
|
|
873
|
-
defaultWidth: 400,
|
|
874
|
-
imgParams: {
|
|
875
|
-
auto: ["format", "compress"]
|
|
876
|
-
},
|
|
877
|
-
alt: authorName
|
|
878
|
-
}) : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
879
|
-
src: avatarUrl
|
|
880
|
-
})));
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
var isPrefix = function isPrefix(dir) {
|
|
884
|
-
if (prefix) {
|
|
885
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
886
|
-
className: "arr-author-prefix " + _getClassName__default["default"]("prefix ".concat(textColor), _styleModuleImportMap$b)
|
|
887
|
-
}, prefix);
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
return !hideAuthorImage && authorImage(dir);
|
|
891
|
-
};
|
|
892
|
-
|
|
893
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isAuthor && /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
894
|
-
href: "".concat(mountAt, "/author/") + slug,
|
|
895
|
-
"aria-label": "author-name",
|
|
896
|
-
className: "author-name arr-author-name arrow-component " + _getClassName__default["default"]("author ".concat(isBottomClasses), _styleModuleImportMap$b)
|
|
897
|
-
}, isPrefix("ltr"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
898
|
-
"data-test-id": "author-name",
|
|
899
|
-
className: "author-name " + _getClassName__default["default"]("author-name ".concat(textColor), _styleModuleImportMap$b)
|
|
900
|
-
}, authorName || story["author-name"]), !prefix && isPrefix("rtl")));
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
function mapStateToProps(state) {
|
|
904
|
-
return {
|
|
905
|
-
config: lodash.get(state, ["qt", "config"], {})
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
var Author = reactRedux.connect(mapStateToProps)(AuthorBase);
|
|
910
|
-
AuthorBase.propTypes = {
|
|
911
|
-
/** The Story Object from the API response */
|
|
912
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
913
|
-
|
|
914
|
-
/** Hide Author Avatar Image */
|
|
915
|
-
hideAuthorImage: PropTypes__default["default"].bool,
|
|
916
|
-
// fix Author bottom of the storyCard
|
|
917
|
-
isBottom: PropTypes__default["default"].bool,
|
|
918
|
-
// fix prefix before the author name
|
|
919
|
-
prefix: PropTypes__default["default"].string,
|
|
920
|
-
config: PropTypes__default["default"].object
|
|
921
|
-
};
|
|
922
|
-
AuthorBase.defaultProps = {
|
|
923
|
-
hideAuthorImage: false,
|
|
924
|
-
isBottom: false,
|
|
925
|
-
prefix: ""
|
|
926
|
-
};
|
|
927
|
-
|
|
928
|
-
var _styleModuleImportMap$a = {
|
|
929
|
-
"./dot.m.css": {
|
|
930
|
-
"dark": "dot-m_dark__1Njxl",
|
|
931
|
-
"light": "dot-m_light__27IA3"
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
var Dot = function Dot(_ref) {
|
|
935
|
-
var _ref$width = _ref.width,
|
|
936
|
-
width = _ref$width === void 0 ? "3px" : _ref$width,
|
|
937
|
-
_ref$height = _ref.height,
|
|
938
|
-
height = _ref$height === void 0 ? "3px" : _ref$height,
|
|
939
|
-
_ref$color = _ref.color,
|
|
940
|
-
color = _ref$color === void 0 ? "light" : _ref$color;
|
|
941
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
942
|
-
className: _getClassName__default["default"](color, _styleModuleImportMap$a)
|
|
943
|
-
}, /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
944
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
945
|
-
width: width,
|
|
946
|
-
height: height,
|
|
947
|
-
viewBox: "0 0 3 3"
|
|
948
|
-
}, /*#__PURE__*/React__default["default"].createElement("circle", {
|
|
949
|
-
cx: "87",
|
|
950
|
-
cy: "9",
|
|
951
|
-
r: "1",
|
|
952
|
-
fill: "inherit",
|
|
953
|
-
fillRule: "nonzero",
|
|
954
|
-
transform: "translate(-86 -8)"
|
|
955
|
-
})));
|
|
956
|
-
};
|
|
957
|
-
Dot.propTypes = {
|
|
958
|
-
/** height , width and color of the dot icon */
|
|
959
|
-
color: PropTypes__default["default"].string,
|
|
960
|
-
width: PropTypes__default["default"].string,
|
|
961
|
-
height: PropTypes__default["default"].string
|
|
962
|
-
};
|
|
963
|
-
|
|
964
|
-
var _styleModuleImportMap$9 = {
|
|
965
|
-
"./divider.m.css": {
|
|
966
|
-
"dark": "divider-m_dark__26FRi",
|
|
967
|
-
"light": "divider-m_light__w-7sy"
|
|
968
|
-
}
|
|
969
|
-
};
|
|
970
|
-
var Divider = function Divider(_ref) {
|
|
971
|
-
var _ref$width = _ref.width,
|
|
972
|
-
width = _ref$width === void 0 ? "1" : _ref$width,
|
|
973
|
-
_ref$height = _ref.height,
|
|
974
|
-
height = _ref$height === void 0 ? "10" : _ref$height,
|
|
975
|
-
_ref$color = _ref.color,
|
|
976
|
-
color = _ref$color === void 0 ? "light" : _ref$color;
|
|
977
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
978
|
-
className: _getClassName__default["default"](color, _styleModuleImportMap$9)
|
|
979
|
-
}, /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
980
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
981
|
-
width: width,
|
|
982
|
-
height: height
|
|
983
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
984
|
-
fill: "inherit",
|
|
985
|
-
d: "M0 0h1v10H0z"
|
|
986
|
-
})));
|
|
987
|
-
};
|
|
988
|
-
Divider.propTypes = {
|
|
989
|
-
/** height , width and color of the dot icon */
|
|
990
|
-
color: PropTypes__default["default"].string,
|
|
991
|
-
width: PropTypes__default["default"].string,
|
|
992
|
-
height: PropTypes__default["default"].string
|
|
993
|
-
};
|
|
994
|
-
|
|
995
|
-
var _styleModuleImportMap$8 = {
|
|
996
|
-
"./read-time.m.css": {
|
|
997
|
-
"read-time-wrapper": "read-time-m_read-time-wrapper__3GyC_",
|
|
998
|
-
"dot-indicator": "read-time-m_dot-indicator__3Sqh2",
|
|
999
|
-
"dark": "read-time-m_dark__3yRaK",
|
|
1000
|
-
"light": "read-time-m_light__1GAZu"
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
var ReadTime = function ReadTime(_ref) {
|
|
1004
|
-
var story = _ref.story,
|
|
1005
|
-
_ref$opts = _ref.opts,
|
|
1006
|
-
opts = _ref$opts === void 0 ? {} : _ref$opts,
|
|
1007
|
-
_ref$isLightTheme = _ref.isLightTheme,
|
|
1008
|
-
isLightTheme = _ref$isLightTheme === void 0 ? false : _ref$isLightTheme;
|
|
1009
|
-
var config = useStateValue() || {};
|
|
1010
|
-
var showReadTime = lodash.get(config, ["showReadTime"]) || lodash.get(opts, ["showReadTime"], true);
|
|
1011
|
-
var readTime = lodash.get(story, ["read-time"], 0);
|
|
1012
|
-
var textColor = isLightTheme ? "light" : getTextColor(config.theme);
|
|
1013
|
-
if (!showReadTime || !readTime) return null;
|
|
1014
|
-
var timeToRead = lodash.get(opts, ["localizedTimeToRead"]) || "min read";
|
|
1015
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1016
|
-
"data-test-id": "read-time",
|
|
1017
|
-
className: "arrow-component arr--read-time " + _getClassName__default["default"]("read-time-wrapper ".concat(textColor), _styleModuleImportMap$8)
|
|
1018
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1019
|
-
className: "read-time-indicator read-time-m_dot-indicator__3Sqh2"
|
|
1020
|
-
}, /*#__PURE__*/React__default["default"].createElement(Dot, {
|
|
1021
|
-
color: textColor
|
|
1022
|
-
})), /*#__PURE__*/React__default["default"].createElement("span", null, readTime, " ", timeToRead)));
|
|
1023
|
-
};
|
|
1024
|
-
ReadTime.propTypes = {
|
|
1025
|
-
story: PropTypes__default["default"].shape({
|
|
1026
|
-
"read-time": PropTypes__default["default"].number
|
|
1027
|
-
}),
|
|
1028
|
-
opts: PropTypes__default["default"].shape({
|
|
1029
|
-
showReadTime: PropTypes__default["default"].bool
|
|
1030
|
-
}),
|
|
1031
|
-
isLightTheme: PropTypes__default["default"].bool
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
|
-
var _styleModuleImportMap$7 = {
|
|
1035
|
-
"./author-with-timestamp.m.css": {
|
|
1036
|
-
"author-time-wrapper": "author-with-timestamp-m_author-time-wrapper__G7_eI",
|
|
1037
|
-
"author-image": "author-with-timestamp-m_author-image__24xrD",
|
|
1038
|
-
"dot": "author-with-timestamp-m_dot__1LHXD",
|
|
1039
|
-
"bottom-fix": "author-with-timestamp-m_bottom-fix__1rWGv",
|
|
1040
|
-
"dash": "author-with-timestamp-m_dash__2L5XC"
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
var AuthorWithTime = function AuthorWithTime(_ref) {
|
|
1044
|
-
var story = _ref.story,
|
|
1045
|
-
separator = _ref.separator,
|
|
1046
|
-
isBottom = _ref.isBottom,
|
|
1047
|
-
hideAuthorImage = _ref.hideAuthorImage,
|
|
1048
|
-
prefix = _ref.prefix,
|
|
1049
|
-
_ref$config = _ref.config,
|
|
1050
|
-
config = _ref$config === void 0 ? {} : _ref$config,
|
|
1051
|
-
isLightTheme = _ref.isLightTheme;
|
|
1052
|
-
var configState = useStateValue() || {};
|
|
1053
|
-
var isAuthor = lodash.get(config, ["showAuthor"], lodash.get(configState, ["showAuthor"], true));
|
|
1054
|
-
var isTime = lodash.get(config, ["showTime"], lodash.get(configState, ["showTime"], true));
|
|
1055
|
-
var isReadTime = lodash.get(configState, ["showReadTime"], true);
|
|
1056
|
-
var isBottomClasses = isBottom ? "bottom-fix" : "";
|
|
1057
|
-
var seperatorStyle = separator === "dot" ? "dot" : "dash";
|
|
1058
|
-
var textColor = isLightTheme ? "light" : getTextColor(configState.theme);
|
|
1059
|
-
|
|
1060
|
-
var getSeparator = function getSeparator() {
|
|
1061
|
-
if (separator === "divider") {
|
|
1062
|
-
return /*#__PURE__*/React__default["default"].createElement(Divider, {
|
|
1063
|
-
color: textColor
|
|
1064
|
-
});
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
return /*#__PURE__*/React__default["default"].createElement(Dot, {
|
|
1068
|
-
color: textColor
|
|
1069
|
-
});
|
|
1070
|
-
};
|
|
1071
|
-
|
|
1072
|
-
var getTimeStamp = function getTimeStamp() {
|
|
1073
|
-
if (!isTime) return null;
|
|
1074
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isAuthor && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1075
|
-
className: "arr-separator " + _getClassName__default["default"]("".concat(seperatorStyle), _styleModuleImportMap$7)
|
|
1076
|
-
}, getSeparator()), /*#__PURE__*/React__default["default"].createElement(TimeStamp, {
|
|
1077
|
-
story: story,
|
|
1078
|
-
config: config
|
|
1079
|
-
}), isReadTime && /*#__PURE__*/React__default["default"].createElement(ReadTime, {
|
|
1080
|
-
story: story,
|
|
1081
|
-
opts: config,
|
|
1082
|
-
isLightTheme: isLightTheme
|
|
1083
|
-
}));
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1087
|
-
className: "arr--author-time " + _getClassName__default["default"]("author-time-wrapper ".concat(isBottomClasses), _styleModuleImportMap$7)
|
|
1088
|
-
}, isAuthor ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Author, {
|
|
1089
|
-
story: story,
|
|
1090
|
-
isBottom: true,
|
|
1091
|
-
hideAuthorImage: hideAuthorImage,
|
|
1092
|
-
prefix: prefix
|
|
1093
|
-
}), getTimeStamp()) : getTimeStamp());
|
|
1094
|
-
};
|
|
1095
|
-
AuthorWithTime.propTypes = {
|
|
1096
|
-
story: PropTypes__default["default"].object,
|
|
1097
|
-
|
|
1098
|
-
/** Style of separator between the Author & Timestamp */
|
|
1099
|
-
separator: PropTypes__default["default"].oneOf(["dot", "divider"]),
|
|
1100
|
-
|
|
1101
|
-
/** hide the author image */
|
|
1102
|
-
hideAuthorImage: PropTypes__default["default"].bool,
|
|
1103
|
-
// fix author and time at the end
|
|
1104
|
-
isBottom: PropTypes__default["default"].bool,
|
|
1105
|
-
// fix prefix before the author name
|
|
1106
|
-
prefix: PropTypes__default["default"].string,
|
|
1107
|
-
config: PropTypes__default["default"].object,
|
|
1108
|
-
isLightTheme: PropTypes__default["default"].bool
|
|
1109
|
-
};
|
|
1110
|
-
AuthorWithTime.defaultProps = {
|
|
1111
|
-
separator: "dot",
|
|
1112
|
-
isBottom: false,
|
|
1113
|
-
hideAuthorImage: true,
|
|
1114
|
-
prefix: "",
|
|
1115
|
-
isLightTheme: false
|
|
1116
|
-
};
|
|
1117
|
-
|
|
1118
|
-
var ImageFallbackIcon = function ImageFallbackIcon(_ref) {
|
|
1119
|
-
var _ref$width = _ref.width,
|
|
1120
|
-
width = _ref$width === void 0 ? 40 : _ref$width,
|
|
1121
|
-
_ref$height = _ref.height,
|
|
1122
|
-
height = _ref$height === void 0 ? 30 : _ref$height,
|
|
1123
|
-
_ref$iconColor = _ref.iconColor,
|
|
1124
|
-
iconColor = _ref$iconColor === void 0 ? "#99B0CB" : _ref$iconColor;
|
|
1125
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
1126
|
-
width: width,
|
|
1127
|
-
height: height,
|
|
1128
|
-
viewBox: "0 0 102 76",
|
|
1129
|
-
version: "1.1"
|
|
1130
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
1131
|
-
id: "demo-home-copy",
|
|
1132
|
-
stroke: "none",
|
|
1133
|
-
strokeWidth: "1",
|
|
1134
|
-
fill: "none",
|
|
1135
|
-
fillRule: "evenodd",
|
|
1136
|
-
transform: "translate(-377.000000, -314.000000)"
|
|
1137
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
1138
|
-
id: "Group-13",
|
|
1139
|
-
transform: "translate(377.000000, 314.000000)"
|
|
1140
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
1141
|
-
d: "M43.2,49.7 L62.2,19.2 L87.2,59.4 L17,59.4 L32.8,39.4 L43.2,49.7 Z M29.9,28.6 C25.8683213,28.6 22.6,25.3316787 22.6,21.3 C22.6,17.2683213 25.8683213,14 29.9,14 C33.9316787,14 37.2,17.2683213 37.2,21.3 C37.2,25.3316787 33.9316787,28.6 29.9,28.6 Z",
|
|
1142
|
-
id: "Combined-Shape",
|
|
1143
|
-
fill: iconColor,
|
|
1144
|
-
fillRule: "nonzero"
|
|
1145
|
-
}), /*#__PURE__*/React__default["default"].createElement("rect", {
|
|
1146
|
-
id: "Rectangle-19",
|
|
1147
|
-
stroke: iconColor,
|
|
1148
|
-
strokeWidth: "3",
|
|
1149
|
-
x: "1.5",
|
|
1150
|
-
y: "1.5",
|
|
1151
|
-
width: "99",
|
|
1152
|
-
height: "73",
|
|
1153
|
-
rx: "3"
|
|
1154
|
-
}))));
|
|
1155
|
-
};
|
|
1156
|
-
ImageFallbackIcon.propTypes = {
|
|
1157
|
-
width: PropTypes__default["default"].object,
|
|
1158
|
-
height: PropTypes__default["default"].object,
|
|
1159
|
-
iconColor: PropTypes__default["default"].object
|
|
1160
|
-
};
|
|
1161
|
-
|
|
1162
|
-
var imageFallback = function imageFallback() {
|
|
1163
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1164
|
-
className: "arr--fallback-image fallback-m_image__1GYCJ fallback-m_image-position__3KddP"
|
|
1165
|
-
}, /*#__PURE__*/React__default["default"].createElement("figure", {
|
|
1166
|
-
className: "arr--fallback-svg fallback-m_fallback-svg__tK9fL"
|
|
1167
|
-
}, /*#__PURE__*/React__default["default"].createElement(ImageFallbackIcon, null)));
|
|
1168
|
-
};
|
|
1169
|
-
|
|
1170
|
-
var FallbackImage = function FallbackImage(_ref) {
|
|
1171
|
-
var slug = _ref.slug;
|
|
1172
|
-
|
|
1173
|
-
if (slug) {
|
|
1174
|
-
return /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
1175
|
-
href: slug,
|
|
1176
|
-
"aria-label": "image-fallback"
|
|
1177
|
-
}, imageFallback());
|
|
1178
|
-
} else {
|
|
1179
|
-
return imageFallback();
|
|
1180
|
-
}
|
|
1181
|
-
};
|
|
1182
|
-
FallbackImage.propTypes = {
|
|
1183
|
-
slug: PropTypes__default["default"].string
|
|
1184
|
-
};
|
|
1185
|
-
|
|
1186
|
-
var HyperLinkIcon = function HyperLinkIcon() {
|
|
1187
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
1188
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1189
|
-
width: "36",
|
|
1190
|
-
height: "28"
|
|
1191
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
1192
|
-
fill: "none",
|
|
1193
|
-
fillRule: "evenodd"
|
|
1194
|
-
}, /*#__PURE__*/React__default["default"].createElement("rect", {
|
|
1195
|
-
width: "36",
|
|
1196
|
-
height: "28",
|
|
1197
|
-
fill: "#3D6FCF",
|
|
1198
|
-
rx: "4"
|
|
1199
|
-
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
|
1200
|
-
stroke: "#FFF",
|
|
1201
|
-
strokeLinecap: "round",
|
|
1202
|
-
strokeLinejoin: "round",
|
|
1203
|
-
strokeWidth: "2",
|
|
1204
|
-
d: "M22 14.667v4c0 .736-.597 1.333-1.333 1.333h-7.334A1.333 1.333 0 0112 18.667v-7.334c0-.736.597-1.333 1.333-1.333h4M20 8h4v4m-7.333 3.333L24 8"
|
|
1205
|
-
})));
|
|
1206
|
-
};
|
|
1207
|
-
|
|
1208
|
-
var HyperLink = function HyperLink(_ref) {
|
|
1209
|
-
var _ref$hyperLink = _ref.hyperLink,
|
|
1210
|
-
hyperLink = _ref$hyperLink === void 0 ? "" : _ref$hyperLink;
|
|
1211
|
-
if (!hyperLink) return null;
|
|
1212
|
-
return /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
1213
|
-
href: hyperLink,
|
|
1214
|
-
"aria-label": "hyperlink-button",
|
|
1215
|
-
className: "arr--hyperlink-button hyperlink-m_hyperlink-button__1CqWx",
|
|
1216
|
-
target: "_blank",
|
|
1217
|
-
rel: "noopener noreferrer"
|
|
1218
|
-
}, /*#__PURE__*/React__default["default"].createElement(HyperLinkIcon, null));
|
|
1219
|
-
};
|
|
1220
|
-
HyperLink.propTypes = {
|
|
1221
|
-
hyperLink: PropTypes__default["default"].string
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
|
-
var _styleModuleImportMap$6 = {
|
|
1225
|
-
"./hero-image.m.css": {
|
|
1226
|
-
"hero-image": "hero-image-m_hero-image__3lraV",
|
|
1227
|
-
"right-padding": "hero-image-m_right-padding__1LkCe",
|
|
1228
|
-
"left-padding": "hero-image-m_left-padding__pYRAj",
|
|
1229
|
-
"right-padding-mob": "hero-image-m_right-padding-mob__3-uOU",
|
|
1230
|
-
"placeholder": "hero-image-m_placeholder__1omCm",
|
|
1231
|
-
"hero-image-mob": "hero-image-m_hero-image-mob__13JJp",
|
|
1232
|
-
"with-padding": "hero-image-m_with-padding__324G_",
|
|
1233
|
-
"image": "hero-image-m_image__1mz0U"
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
|
-
var HeroImage = function HeroImage(_ref) {
|
|
1237
|
-
var story = _ref.story,
|
|
1238
|
-
FullBleed = _ref.FullBleed,
|
|
1239
|
-
aspectRatio = _ref.aspectRatio,
|
|
1240
|
-
defaultWidth = _ref.defaultWidth,
|
|
1241
|
-
widths = _ref.widths,
|
|
1242
|
-
isHorizontal = _ref.isHorizontal,
|
|
1243
|
-
isHorizontalMobile = _ref.isHorizontalMobile,
|
|
1244
|
-
isHorizontalWithImageLast = _ref.isHorizontalWithImageLast,
|
|
1245
|
-
defaultFallback = _ref.defaultFallback,
|
|
1246
|
-
isStoryPageImage = _ref.isStoryPageImage,
|
|
1247
|
-
config = _ref.config;
|
|
1248
|
-
|
|
1249
|
-
var _ref2 = useStateValue() || {},
|
|
1250
|
-
_ref2$fallbackImageUr = _ref2.fallbackImageUrl,
|
|
1251
|
-
fallbackImageUrl = _ref2$fallbackImageUr === void 0 ? "" : _ref2$fallbackImageUr;
|
|
1252
|
-
|
|
1253
|
-
var _config$StoryTemplate = config.StoryTemplateIcon,
|
|
1254
|
-
StoryTemplateIcon = _config$StoryTemplate === void 0 ? function () {
|
|
1255
|
-
return null;
|
|
1256
|
-
} : _config$StoryTemplate;
|
|
1257
|
-
var showImagePlaceholder = reactRedux.useSelector(function (state) {
|
|
1258
|
-
return lodash.get(state, ["qt", "config", "showPlaceholder"]);
|
|
1259
|
-
});
|
|
1260
|
-
var getPlaceholderStyleName = showImagePlaceholder ? "placeholder" : "";
|
|
1261
|
-
var fullBleed = FullBleed ? "" : "with-padding";
|
|
1262
|
-
var heroImageClass = "hero-image";
|
|
1263
|
-
if (isHorizontal) heroImageClass = "right-padding";else if (isHorizontalWithImageLast) heroImageClass = "left-padding";
|
|
1264
|
-
var heroImageMobClasses = isHorizontalMobile ? "right-padding-mob" : "";
|
|
1265
|
-
|
|
1266
|
-
var getPadding = function getPadding(aspectRatio) {
|
|
1267
|
-
var _aspectRatio = _slicedToArray__default["default"](aspectRatio, 2),
|
|
1268
|
-
height = _aspectRatio[0],
|
|
1269
|
-
width = _aspectRatio[1];
|
|
1270
|
-
|
|
1271
|
-
if (height > 0 && width > 0) {
|
|
1272
|
-
var padding = width / height * 100;
|
|
1273
|
-
return padding;
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
return 0;
|
|
1277
|
-
};
|
|
1278
|
-
|
|
1279
|
-
var _aspectRatio2 = _slicedToArray__default["default"](aspectRatio, 2),
|
|
1280
|
-
mobileAspectRatio = _aspectRatio2[0],
|
|
1281
|
-
_aspectRatio2$ = _aspectRatio2[1],
|
|
1282
|
-
desktopAspectRatio = _aspectRatio2$ === void 0 ? mobileAspectRatio : _aspectRatio2$;
|
|
1283
|
-
|
|
1284
|
-
var isMobile = clientWidth("mobile");
|
|
1285
|
-
var imageAspectRatio = isMobile ? mobileAspectRatio : desktopAspectRatio;
|
|
1286
|
-
var imagePadding = isMobile ? getPadding(mobileAspectRatio) : getPadding(desktopAspectRatio);
|
|
1287
|
-
var slug = lodash.get(story, ["hero-image-s3-key"]) || lodash.get(story, ["alternative", "home", "default", "hero-image", "hero-image-s3-key"]);
|
|
1288
|
-
var hyperLink = lodash.get(story, ["hero-image-hyperlink"], "");
|
|
1289
|
-
|
|
1290
|
-
var fallbackImage = function fallbackImage() {
|
|
1291
|
-
if (!slug) {
|
|
1292
|
-
if (fallbackImageUrl && !isStoryPageImage) {
|
|
1293
|
-
return /*#__PURE__*/React__default["default"].createElement("figure", {
|
|
1294
|
-
style: {
|
|
1295
|
-
paddingTop: imagePadding + "%"
|
|
1296
|
-
},
|
|
1297
|
-
className: "arr--responsive-hero-image " + _getClassName__default["default"]("image ".concat(getPlaceholderStyleName), _styleModuleImportMap$6)
|
|
1298
|
-
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1299
|
-
className: "qt-image",
|
|
1300
|
-
"data-src": "".concat(fallbackImageUrl),
|
|
1301
|
-
alt: "image-fallback"
|
|
1302
|
-
}));
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, defaultFallback ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1306
|
-
"data-test-id": "arr--fallback-hero-image",
|
|
1307
|
-
style: {
|
|
1308
|
-
paddingTop: imagePadding + "%"
|
|
1309
|
-
},
|
|
1310
|
-
className: "arr--fallback-hero-image " + _getClassName__default["default"]("image ".concat(getPlaceholderStyleName), _styleModuleImportMap$6)
|
|
1311
|
-
}, /*#__PURE__*/React__default["default"].createElement(StoryTemplateIcon, {
|
|
1312
|
-
storyTemplate: story["story-template"]
|
|
1313
|
-
}), /*#__PURE__*/React__default["default"].createElement(FallbackImage, null)) : null);
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("figure", {
|
|
1317
|
-
style: {
|
|
1318
|
-
paddingTop: imagePadding + "%"
|
|
1319
|
-
},
|
|
1320
|
-
className: "arr--responsive-hero-image " + _getClassName__default["default"]("image ".concat(getPlaceholderStyleName), _styleModuleImportMap$6)
|
|
1321
|
-
}, /*#__PURE__*/React__default["default"].createElement(StoryTemplateIcon, {
|
|
1322
|
-
storyTemplate: story["story-template"]
|
|
1323
|
-
}), /*#__PURE__*/React__default["default"].createElement(components.ResponsiveHeroImage, {
|
|
1324
|
-
story: story,
|
|
1325
|
-
aspectRatio: imageAspectRatio,
|
|
1326
|
-
defaultWidth: defaultWidth,
|
|
1327
|
-
widths: widths,
|
|
1328
|
-
imgParams: {
|
|
1329
|
-
auto: ["format", "compress"],
|
|
1330
|
-
fit: "max"
|
|
1331
|
-
}
|
|
1332
|
-
})), isStoryPageImage && hyperLink && /*#__PURE__*/React__default["default"].createElement(HyperLink, {
|
|
1333
|
-
hyperLink: hyperLink
|
|
1334
|
-
}));
|
|
1335
|
-
};
|
|
1336
|
-
|
|
1337
|
-
return story && (isStoryPageImage ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1338
|
-
"data-test-id": "arr--hero-image",
|
|
1339
|
-
className: "arr--hero-image " + _getClassName__default["default"]("".concat(heroImageClass, " ").concat(fullBleed, " ").concat(heroImageMobClasses), _styleModuleImportMap$6)
|
|
1340
|
-
}, fallbackImage()) : /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
1341
|
-
"data-test-id": "arr--hero-image",
|
|
1342
|
-
href: getStoryUrl(story, "/".concat(story.slug)),
|
|
1343
|
-
externalLink: isExternalStory(story),
|
|
1344
|
-
"aria-label": "fallback-hero-image",
|
|
1345
|
-
className: "arr--hero-image " + _getClassName__default["default"]("".concat(heroImageClass, " ").concat(fullBleed, " ").concat(heroImageMobClasses), _styleModuleImportMap$6)
|
|
1346
|
-
}, fallbackImage()));
|
|
1347
|
-
};
|
|
1348
|
-
HeroImage.propTypes = {
|
|
1349
|
-
/** The Story Object from the API response */
|
|
1350
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
1351
|
-
|
|
1352
|
-
/** Removes the Hero Image padding for the image to bleed over the margin */
|
|
1353
|
-
FullBleed: PropTypes__default["default"].bool,
|
|
1354
|
-
|
|
1355
|
-
/** The default width for the image, in case the browser does not support srcset */
|
|
1356
|
-
defaultWidth: PropTypes__default["default"].number,
|
|
1357
|
-
|
|
1358
|
-
/** The list of available widths */
|
|
1359
|
-
widths: PropTypes__default["default"].array,
|
|
1360
|
-
// fatch the correct hero image
|
|
1361
|
-
aspectRatio: PropTypes__default["default"].array,
|
|
1362
|
-
// Hints for the browser to choose the best size
|
|
1363
|
-
|
|
1364
|
-
/** This prop is responsible for adding padding-right of the image and remove padding bottom of the image */
|
|
1365
|
-
isHorizontal: PropTypes__default["default"].bool,
|
|
1366
|
-
|
|
1367
|
-
/** This prop is responsible for adding padding-bottom in desktop and padding-right in mobile */
|
|
1368
|
-
isHorizontalMobile: PropTypes__default["default"].bool,
|
|
1369
|
-
// this prop is responsive for rendering fallback image on story page
|
|
1370
|
-
defaultFallback: PropTypes__default["default"].bool,
|
|
1371
|
-
isHorizontalWithImageLast: PropTypes__default["default"].bool,
|
|
1372
|
-
isStoryPageImage: PropTypes__default["default"].bool,
|
|
1373
|
-
config: PropTypes__default["default"].object
|
|
1374
|
-
};
|
|
1375
|
-
HeroImage.defaultProps = {
|
|
1376
|
-
FullBleed: true,
|
|
1377
|
-
aspectRatio: [[1, 1], [16, 9]],
|
|
1378
|
-
defaultWidth: 480,
|
|
1379
|
-
widths: [250, 480, 640],
|
|
1380
|
-
isHorizontal: false,
|
|
1381
|
-
isHorizontalMobile: false,
|
|
1382
|
-
defaultFallback: true,
|
|
1383
|
-
isStoryPageImage: false,
|
|
1384
|
-
isHorizontalWithImageLast: false,
|
|
1385
|
-
config: {}
|
|
1386
|
-
};
|
|
1387
|
-
|
|
1388
|
-
var _styleModuleImportMap$5 = {
|
|
1389
|
-
"./section.m.css": {
|
|
1390
|
-
"section": "section-m_section__2N4S3",
|
|
1391
|
-
"section-borderBottomSml": "section-m_section-borderBottomSml__2GNbo",
|
|
1392
|
-
"border-bottom": "section-m_border-bottom__3cRoD",
|
|
1393
|
-
"section-borderLeft": "section-m_section-borderLeft__3hKVj",
|
|
1394
|
-
"border-left": "section-m_border-left__2oUyp",
|
|
1395
|
-
"section-solid": "section-m_section-solid__1vB1Q",
|
|
1396
|
-
"dark": "section-m_dark__1r3C4",
|
|
1397
|
-
"light": "section-m_light__306hW"
|
|
1398
|
-
}
|
|
1399
|
-
};
|
|
1400
|
-
var SectionTag = function SectionTag(_ref) {
|
|
1401
|
-
var story = _ref.story,
|
|
1402
|
-
_ref$template = _ref.template,
|
|
1403
|
-
template = _ref$template === void 0 ? "" : _ref$template,
|
|
1404
|
-
_ref$borderColor = _ref.borderColor,
|
|
1405
|
-
borderColor = _ref$borderColor === void 0 ? "" : _ref$borderColor,
|
|
1406
|
-
isLightTheme = _ref.isLightTheme;
|
|
1407
|
-
var config = useStateValue() || {};
|
|
1408
|
-
var isSection = lodash.get(config, ["showSection"], true);
|
|
1409
|
-
var templateFromRowContext = lodash.get(config, ["sectionTagTemplate"]);
|
|
1410
|
-
var section = lodash.get(story, ["sections", 0], "");
|
|
1411
|
-
var supportedTemplates = ["borderBottomSml", "borderLeft", "solid"];
|
|
1412
|
-
var getUrl = section ? section["section-url"] : "/";
|
|
1413
|
-
var colorToApplyContrast = template === "solid" || templateFromRowContext === "solid" ? borderColor : config.theme;
|
|
1414
|
-
var textColor = isLightTheme ? "light" : getTextColor(colorToApplyContrast);
|
|
1415
|
-
var sectionTagBorderColor = rgbToHex(borderColor);
|
|
1416
|
-
var templateStyle = supportedTemplates.includes(template) ? "section section-".concat(template) : "section";
|
|
1417
|
-
|
|
1418
|
-
if (templateFromRowContext) {
|
|
1419
|
-
templateStyle = supportedTemplates.includes(templateFromRowContext) ? "section section-".concat(templateFromRowContext) : "section";
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
if (!isSection) return null;
|
|
1423
|
-
return /*#__PURE__*/React__default["default"].createElement(components.Link, {
|
|
1424
|
-
href: getUrl,
|
|
1425
|
-
className: "arrow-component arr--section-name",
|
|
1426
|
-
"aria-label": "section-name"
|
|
1427
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1428
|
-
"data-test-id": "sectionTag",
|
|
1429
|
-
style: {
|
|
1430
|
-
backgroundColor: templateStyle.includes("section-solid") ? sectionTagBorderColor : ""
|
|
1431
|
-
},
|
|
1432
|
-
className: "section-tag arrow-component " + _getClassName__default["default"]("".concat(textColor, " ").concat(templateStyle), _styleModuleImportMap$5)
|
|
1433
|
-
}, templateStyle.includes("section-borderLeft") && /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1434
|
-
className: "section-m_border-left__2oUyp",
|
|
1435
|
-
style: {
|
|
1436
|
-
color: sectionTagBorderColor
|
|
1437
|
-
}
|
|
1438
|
-
}), section["display-name"] || section["name"], /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1439
|
-
className: "section-m_border-bottom__3cRoD",
|
|
1440
|
-
style: {
|
|
1441
|
-
backgroundColor: "".concat(template === "solid" ? "" : sectionTagBorderColor)
|
|
1442
|
-
}
|
|
1443
|
-
})));
|
|
1444
|
-
};
|
|
1445
|
-
SectionTag.propTypes = {
|
|
1446
|
-
/** The Story Object from the API response */
|
|
1447
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
1448
|
-
|
|
1449
|
-
/** The style template for section tag */
|
|
1450
|
-
template: PropTypes__default["default"].oneOf(["", "borderBottomSml", "borderLeft", "solid"]),
|
|
1451
|
-
borderColor: PropTypes__default["default"].string,
|
|
1452
|
-
solidBorderColor: PropTypes__default["default"].string,
|
|
1453
|
-
isLightTheme: PropTypes__default["default"].bool
|
|
1454
|
-
};
|
|
1455
|
-
SectionTag.defaultProps = {
|
|
1456
|
-
template: "",
|
|
1457
|
-
isLightTheme: false
|
|
1458
|
-
};
|
|
1459
|
-
|
|
1460
|
-
var _styleModuleImportMap$4 = {
|
|
1461
|
-
"./storycard.m.css": {
|
|
1462
|
-
"author-timestamp-wrapper": "storycard-m_author-timestamp-wrapper__20yjp",
|
|
1463
|
-
"default-card": "storycard-m_default-card__1-POn",
|
|
1464
|
-
"horizontal-card": "storycard-m_horizontal-card___7afz",
|
|
1465
|
-
"backgroung-img": "storycard-m_backgroung-img__1FMJT",
|
|
1466
|
-
"content-overlap": "storycard-m_content-overlap__1yNHR",
|
|
1467
|
-
"border-full": "storycard-m_border-full__1nhy7",
|
|
1468
|
-
"light": "storycard-m_light__3EhXN",
|
|
1469
|
-
"dark": "storycard-m_dark__2wCTq",
|
|
1470
|
-
"border-bottom": "storycard-m_border-bottom__2_E-I",
|
|
1471
|
-
"border-boxShadow": "storycard-m_border-boxShadow__2-k3Z",
|
|
1472
|
-
"center-align": "storycard-m_center-align__1Sn8-",
|
|
1473
|
-
"content-bottom": "storycard-m_content-bottom__1QHeC",
|
|
1474
|
-
"content-full": "storycard-m_content-full__2zJmU",
|
|
1475
|
-
"content-boxShadow": "storycard-m_content-boxShadow__2IAWZ",
|
|
1476
|
-
"hero-image": "storycard-m_hero-image__1H3MB",
|
|
1477
|
-
"right-padding": "storycard-m_right-padding__12-lQ",
|
|
1478
|
-
"horizontal-mob": "storycard-m_horizontal-mob__17JG2",
|
|
1479
|
-
"content": "storycard-m_content__1Q9vq",
|
|
1480
|
-
"border-default": "storycard-m_border-default__PEZ1x",
|
|
1481
|
-
"card": "storycard-m_card__KJwRa",
|
|
1482
|
-
"horizontal-image-last": "storycard-m_horizontal-image-last__3o6LY"
|
|
1483
|
-
}
|
|
1484
|
-
};
|
|
1485
|
-
var StoryCard = function StoryCard(_ref) {
|
|
1486
|
-
var story = _ref.story,
|
|
1487
|
-
children = _ref.children,
|
|
1488
|
-
isHorizontal = _ref.isHorizontal,
|
|
1489
|
-
aspectRatio = _ref.aspectRatio,
|
|
1490
|
-
border = _ref.border,
|
|
1491
|
-
useImageAsBackground = _ref.useImageAsBackground,
|
|
1492
|
-
bgImgContentOverlap = _ref.bgImgContentOverlap,
|
|
1493
|
-
theme = _ref.theme,
|
|
1494
|
-
borderColor = _ref.borderColor,
|
|
1495
|
-
isHorizontalMobile = _ref.isHorizontalMobile,
|
|
1496
|
-
centerAlign = _ref.centerAlign,
|
|
1497
|
-
headerLevel = _ref.headerLevel,
|
|
1498
|
-
hideAuthorImage = _ref.hideAuthorImage,
|
|
1499
|
-
prefix = _ref.prefix,
|
|
1500
|
-
config = _ref.config,
|
|
1501
|
-
isHorizontalWithImageLast = _ref.isHorizontalWithImageLast;
|
|
1502
|
-
if (!story || isEmpty(story)) return /*#__PURE__*/React__default["default"].createElement("div", null);
|
|
1503
|
-
var borderOptions = ["default", "full", "bottom", "boxShadow"];
|
|
1504
|
-
var borderTemplate = borderOptions.includes(border) ? "border-".concat(border) : ""; // TODO optimize conditions
|
|
1505
|
-
|
|
1506
|
-
var horizontalCardStyle = "default-card";
|
|
1507
|
-
if (isHorizontal) horizontalCardStyle = "horizontal-card";else if (isHorizontalWithImageLast) horizontalCardStyle = "horizontal-image-last";
|
|
1508
|
-
var bgImageClasses = useImageAsBackground ? "backgroung-img" : "";
|
|
1509
|
-
var bgImgContentOverlapClass = bgImgContentOverlap ? "content-overlap" : "";
|
|
1510
|
-
var textColor = getTextColor(theme);
|
|
1511
|
-
var horizontalMobileClasses = isHorizontalMobile ? "horizontal-mob" : "";
|
|
1512
|
-
var defaultStorycard = /*#__PURE__*/React__default["default"].createElement(DefaultStoryCard, {
|
|
1513
|
-
story: story,
|
|
1514
|
-
aspectRatio: aspectRatio,
|
|
1515
|
-
border: border,
|
|
1516
|
-
isHorizontalMobile: isHorizontalMobile,
|
|
1517
|
-
isHorizontal: isHorizontal,
|
|
1518
|
-
centerAlign: centerAlign,
|
|
1519
|
-
headerLevel: headerLevel,
|
|
1520
|
-
borderColor: borderColor,
|
|
1521
|
-
hideAuthorImage: hideAuthorImage,
|
|
1522
|
-
prefix: prefix,
|
|
1523
|
-
config: config,
|
|
1524
|
-
isHorizontalWithImageLast: isHorizontalWithImageLast
|
|
1525
|
-
});
|
|
1526
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1527
|
-
"data-test-id": "story-card",
|
|
1528
|
-
style: {
|
|
1529
|
-
backgroundColor: theme,
|
|
1530
|
-
color: textColor
|
|
1531
|
-
},
|
|
1532
|
-
className: "arr--story-card " + _getClassName__default["default"]("card ".concat(horizontalCardStyle, " ").concat(borderTemplate, " ").concat(textColor, " ").concat(bgImageClasses, " ").concat(bgImgContentOverlapClass, " ").concat(horizontalMobileClasses), _styleModuleImportMap$4)
|
|
1533
|
-
}, children || defaultStorycard);
|
|
1534
|
-
};
|
|
1535
|
-
|
|
1536
|
-
var DefaultStoryCard = function DefaultStoryCard(_ref2) {
|
|
1537
|
-
var story = _ref2.story;
|
|
1538
|
-
_ref2.border;
|
|
1539
|
-
var isHorizontal = _ref2.isHorizontal,
|
|
1540
|
-
aspectRatio = _ref2.aspectRatio,
|
|
1541
|
-
headerLevel = _ref2.headerLevel,
|
|
1542
|
-
_ref2$isHorizontalMob = _ref2.isHorizontalMobile,
|
|
1543
|
-
isHorizontalMobile = _ref2$isHorizontalMob === void 0 ? false : _ref2$isHorizontalMob,
|
|
1544
|
-
_ref2$centerAlign = _ref2.centerAlign,
|
|
1545
|
-
centerAlign = _ref2$centerAlign === void 0 ? false : _ref2$centerAlign,
|
|
1546
|
-
borderColor = _ref2.borderColor,
|
|
1547
|
-
hideAuthorImage = _ref2.hideAuthorImage,
|
|
1548
|
-
prefix = _ref2.prefix,
|
|
1549
|
-
isHorizontalWithImageLast = _ref2.isHorizontalWithImageLast,
|
|
1550
|
-
config = _ref2.config;
|
|
1551
|
-
var alignment = centerAlign ? "center-align" : "";
|
|
1552
|
-
var SectionTagborderColor = rgbToHex(borderColor);
|
|
1553
|
-
var _config$localizationC = config.localizationConfig,
|
|
1554
|
-
localizationConfig = _config$localizationC === void 0 ? {} : _config$localizationC;
|
|
1555
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isHorizontal ? /*#__PURE__*/React__default["default"].createElement(HeroImage, {
|
|
1556
|
-
config: config,
|
|
1557
|
-
story: story,
|
|
1558
|
-
isHorizontal: true,
|
|
1559
|
-
isHorizontalMobile: isHorizontalMobile,
|
|
1560
|
-
aspectRatio: aspectRatio
|
|
1561
|
-
}) : isHorizontalWithImageLast ? /*#__PURE__*/React__default["default"].createElement(HeroImage, {
|
|
1562
|
-
config: config,
|
|
1563
|
-
story: story,
|
|
1564
|
-
isHorizontalWithImageLast: true,
|
|
1565
|
-
isHorizontalMobile: isHorizontalMobile,
|
|
1566
|
-
aspectRatio: aspectRatio
|
|
1567
|
-
}) : /*#__PURE__*/React__default["default"].createElement(HeroImage, {
|
|
1568
|
-
story: story,
|
|
1569
|
-
config: config,
|
|
1570
|
-
isHorizontalMobile: isHorizontalMobile,
|
|
1571
|
-
aspectRatio: aspectRatio
|
|
1572
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1573
|
-
className: "arr--story-content " + _getClassName__default["default"]("content ".concat(alignment), _styleModuleImportMap$4)
|
|
1574
|
-
}, /*#__PURE__*/React__default["default"].createElement(SectionTag, {
|
|
1575
|
-
story: story,
|
|
1576
|
-
borderColor: SectionTagborderColor
|
|
1577
|
-
}), /*#__PURE__*/React__default["default"].createElement(Headline, {
|
|
1578
|
-
story: story,
|
|
1579
|
-
headerLevel: headerLevel,
|
|
1580
|
-
premiumStoryIconConfig: config
|
|
1581
|
-
}), /*#__PURE__*/React__default["default"].createElement(AuthorWithTime, {
|
|
1582
|
-
config: localizationConfig,
|
|
1583
|
-
story: story,
|
|
1584
|
-
isBottom: true,
|
|
1585
|
-
prefix: prefix,
|
|
1586
|
-
hideAuthorImage: hideAuthorImage
|
|
1587
|
-
}), /*#__PURE__*/React__default["default"].createElement(Subheadline, {
|
|
1588
|
-
story: story
|
|
1589
|
-
})));
|
|
1590
|
-
};
|
|
1591
|
-
|
|
1592
|
-
DefaultStoryCard.propTypes = {
|
|
1593
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
1594
|
-
border: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string]),
|
|
1595
|
-
isBottom: PropTypes__default["default"].bool,
|
|
1596
|
-
isHorizontal: PropTypes__default["default"].bool,
|
|
1597
|
-
aspectRatio: PropTypes__default["default"].oneOfType([PropTypes__default["default"].array]),
|
|
1598
|
-
isHorizontalMobile: PropTypes__default["default"].bool,
|
|
1599
|
-
centerAlign: PropTypes__default["default"].bool,
|
|
1600
|
-
headerLevel: PropTypes__default["default"].string,
|
|
1601
|
-
borderColor: PropTypes__default["default"].string,
|
|
1602
|
-
hideAuthorImage: PropTypes__default["default"].bool,
|
|
1603
|
-
prefix: PropTypes__default["default"].string,
|
|
1604
|
-
config: PropTypes__default["default"].object,
|
|
1605
|
-
isHorizontalWithImageLast: PropTypes__default["default"].bool
|
|
1606
|
-
};
|
|
1607
|
-
StoryCard.propTypes = {
|
|
1608
|
-
/** The Story Object from the API response */
|
|
1609
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
1610
|
-
children: PropTypes__default["default"].node,
|
|
1611
|
-
|
|
1612
|
-
/** Flip the Story Card to Horizonal mode */
|
|
1613
|
-
isHorizontal: PropTypes__default["default"].bool,
|
|
1614
|
-
|
|
1615
|
-
/** Add border to the Story Card */
|
|
1616
|
-
border: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string]),
|
|
1617
|
-
// story card with background image
|
|
1618
|
-
useImageAsBackground: PropTypes__default["default"].bool,
|
|
1619
|
-
// story card content overlap with image
|
|
1620
|
-
bgImgContentOverlap: PropTypes__default["default"].bool,
|
|
1621
|
-
|
|
1622
|
-
/** add aspect ratio for hero image */
|
|
1623
|
-
aspectRatio: PropTypes__default["default"].oneOfType([PropTypes__default["default"].array]),
|
|
1624
|
-
|
|
1625
|
-
/** add theme(dark /light/custom color) for storycard */
|
|
1626
|
-
theme: PropTypes__default["default"].string,
|
|
1627
|
-
|
|
1628
|
-
/** flip the story card mobile design horizontal */
|
|
1629
|
-
isHorizontalMobile: PropTypes__default["default"].bool,
|
|
1630
|
-
// make content center align in desktop and left align in mobile
|
|
1631
|
-
centerAlign: PropTypes__default["default"].bool,
|
|
1632
|
-
headerLevel: PropTypes__default["default"].string,
|
|
1633
|
-
borderColor: PropTypes__default["default"].string,
|
|
1634
|
-
// handle author image through storycard
|
|
1635
|
-
hideAuthorImage: PropTypes__default["default"].bool,
|
|
1636
|
-
// handle author prefix through storycard
|
|
1637
|
-
prefix: PropTypes__default["default"].string,
|
|
1638
|
-
config: PropTypes__default["default"].object,
|
|
1639
|
-
isHorizontalWithImageLast: PropTypes__default["default"].bool
|
|
1640
|
-
};
|
|
1641
|
-
StoryCard.defaultProps = {
|
|
1642
|
-
isHorizontal: false,
|
|
1643
|
-
isHorizontalMobile: false,
|
|
1644
|
-
border: "default",
|
|
1645
|
-
theme: "",
|
|
1646
|
-
centerAlign: false,
|
|
1647
|
-
borderColor: "",
|
|
1648
|
-
isHorizontalWithImageLast: false
|
|
1649
|
-
};
|
|
1650
|
-
|
|
1651
|
-
var _styleModuleImportMap$3 = {
|
|
1652
|
-
"./storycardContent.m.css": {
|
|
1653
|
-
"wrapper": "storycardContent-m_wrapper__TEmfA",
|
|
1654
|
-
"horizontal-content-wrapper": "storycardContent-m_horizontal-content-wrapper__NgpuC",
|
|
1655
|
-
"border-full": "storycardContent-m_border-full__2km37"
|
|
1656
|
-
}
|
|
1657
|
-
};
|
|
1658
|
-
var StorycardContent = function StorycardContent(_ref) {
|
|
1659
|
-
var story = _ref.story,
|
|
1660
|
-
children = _ref.children,
|
|
1661
|
-
theme = _ref.theme,
|
|
1662
|
-
border = _ref.border,
|
|
1663
|
-
isHorizontalMobile = _ref.isHorizontalMobile,
|
|
1664
|
-
headerLevel = _ref.headerLevel,
|
|
1665
|
-
borderColor = _ref.borderColor,
|
|
1666
|
-
config = _ref.config;
|
|
1667
|
-
var textColor = getTextColor(theme);
|
|
1668
|
-
var borderOptions = ["full"];
|
|
1669
|
-
var SectionTagborderColor = rgbToHex(borderColor);
|
|
1670
|
-
var borderTemplate = borderOptions.includes(border) ? "border-".concat(border) : "";
|
|
1671
|
-
var horizontalCard = isHorizontalMobile ? "horizontal-content-wrapper" : "";
|
|
1672
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1673
|
-
"data-test-id": "story-card-content",
|
|
1674
|
-
style: {
|
|
1675
|
-
backgroundColor: theme,
|
|
1676
|
-
color: textColor
|
|
1677
|
-
},
|
|
1678
|
-
className: "arr--content-wrapper " + _getClassName__default["default"]("wrapper ".concat(borderTemplate, " ").concat(horizontalCard), _styleModuleImportMap$3)
|
|
1679
|
-
}, children || /*#__PURE__*/React__default["default"].createElement(DefaultStoryCardContent, {
|
|
1680
|
-
story: story,
|
|
1681
|
-
headerLevel: headerLevel,
|
|
1682
|
-
isHorizontalMobile: isHorizontalMobile,
|
|
1683
|
-
borderColor: SectionTagborderColor,
|
|
1684
|
-
config: config
|
|
1685
|
-
}));
|
|
1686
|
-
};
|
|
1687
|
-
|
|
1688
|
-
var DefaultStoryCardContent = function DefaultStoryCardContent(_ref2) {
|
|
1689
|
-
var story = _ref2.story,
|
|
1690
|
-
headerLevel = _ref2.headerLevel,
|
|
1691
|
-
borderColor = _ref2.borderColor,
|
|
1692
|
-
_ref2$config = _ref2.config,
|
|
1693
|
-
config = _ref2$config === void 0 ? {} : _ref2$config;
|
|
1694
|
-
var SectionTagborderColor = rgbToHex(borderColor);
|
|
1695
|
-
var _config$localizationC = config.localizationConfig,
|
|
1696
|
-
localizationConfig = _config$localizationC === void 0 ? {} : _config$localizationC;
|
|
1697
|
-
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(SectionTag, {
|
|
1698
|
-
story: story,
|
|
1699
|
-
borderColor: SectionTagborderColor
|
|
1700
|
-
}), /*#__PURE__*/React__default["default"].createElement(Headline, {
|
|
1701
|
-
story: story,
|
|
1702
|
-
headerLevel: headerLevel,
|
|
1703
|
-
premiumStoryIconConfig: config
|
|
1704
|
-
}), /*#__PURE__*/React__default["default"].createElement(AuthorWithTime, {
|
|
1705
|
-
config: localizationConfig,
|
|
1706
|
-
story: story
|
|
1707
|
-
}));
|
|
1708
|
-
};
|
|
1709
|
-
|
|
1710
|
-
DefaultStoryCardContent.propTypes = {
|
|
1711
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
1712
|
-
border: PropTypes__default["default"].string,
|
|
1713
|
-
theme: PropTypes__default["default"].string,
|
|
1714
|
-
isHorizontalMobile: PropTypes__default["default"].bool,
|
|
1715
|
-
headerLevel: PropTypes__default["default"].string,
|
|
1716
|
-
borderColor: PropTypes__default["default"].string,
|
|
1717
|
-
config: PropTypes__default["default"].object
|
|
1718
|
-
};
|
|
1719
|
-
StorycardContent.propTypes = {
|
|
1720
|
-
story: PropTypes__default["default"].object.isRequired,
|
|
1721
|
-
children: PropTypes__default["default"].node,
|
|
1722
|
-
theme: PropTypes__default["default"].string,
|
|
1723
|
-
border: PropTypes__default["default"].string,
|
|
1724
|
-
isHorizontalMobile: PropTypes__default["default"].bool,
|
|
1725
|
-
headerLevel: PropTypes__default["default"].string,
|
|
1726
|
-
borderColor: PropTypes__default["default"].string,
|
|
1727
|
-
config: PropTypes__default["default"].object
|
|
1728
|
-
};
|
|
1729
|
-
|
|
1730
|
-
var _styleModuleImportMap$2 = {
|
|
1731
|
-
"./load-more.m.css": {
|
|
1732
|
-
"button": "load-more-m_button__1mmf1",
|
|
1733
|
-
"default": "load-more-m_default__2_k4V",
|
|
1734
|
-
"dark": "load-more-m_dark__3dfzb",
|
|
1735
|
-
"light": "load-more-m_light__ePZQI"
|
|
1736
|
-
}
|
|
1737
|
-
};
|
|
1738
|
-
|
|
1739
|
-
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; }
|
|
1740
|
-
|
|
1741
|
-
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; }
|
|
1742
|
-
var LoadmoreButton = function LoadmoreButton(_ref) {
|
|
1743
|
-
var _ref$config = _ref.config,
|
|
1744
|
-
config = _ref$config === void 0 ? {} : _ref$config,
|
|
1745
|
-
collection = _ref.collection,
|
|
1746
|
-
_ref$template = _ref.template,
|
|
1747
|
-
template = _ref$template === void 0 ? "SubsequentLoadCount" : _ref$template,
|
|
1748
|
-
onClick = _ref.onClick,
|
|
1749
|
-
navigate = _ref.navigate,
|
|
1750
|
-
qtConfig = _ref.qtConfig;
|
|
1751
|
-
var _config$showButton = config.showButton,
|
|
1752
|
-
showButton = _config$showButton === void 0 ? true : _config$showButton,
|
|
1753
|
-
_config$buttonText = config.buttonText,
|
|
1754
|
-
buttonText = _config$buttonText === void 0 ? "Read More" : _config$buttonText,
|
|
1755
|
-
_config$theme = config.theme,
|
|
1756
|
-
theme = _config$theme === void 0 ? "" : _config$theme,
|
|
1757
|
-
_config$customUrlPath = config.customUrlPath,
|
|
1758
|
-
customUrlPath = _config$customUrlPath === void 0 ? "" : _config$customUrlPath;
|
|
1759
|
-
if (!showButton) return null;
|
|
1760
|
-
var textColor = getTextColor(theme);
|
|
1761
|
-
var slug = customUrlPath ? "/".concat(customUrlPath) : generateNavigateSlug(collection, _objectSpread(_objectSpread({}, qtConfig), config));
|
|
1762
|
-
return template === "SubsequentLoadCount" ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1763
|
-
onClick: onClick,
|
|
1764
|
-
"data-test-id": "load-more",
|
|
1765
|
-
className: "arr--button " + _getClassName__default["default"]("button ".concat(textColor, " default"), _styleModuleImportMap$2)
|
|
1766
|
-
}, buttonText) : /*#__PURE__*/React__default["default"].createElement(components.LinkBase, {
|
|
1767
|
-
href: slug,
|
|
1768
|
-
navigateTo: navigate,
|
|
1769
|
-
"data-test-id": "load-more",
|
|
1770
|
-
"aria-label": "load-more"
|
|
1771
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1772
|
-
className: "arr--button " + _getClassName__default["default"]("button ".concat(textColor, " default"), _styleModuleImportMap$2)
|
|
1773
|
-
}, buttonText));
|
|
1774
|
-
};
|
|
1775
|
-
LoadmoreButton.propTypes = {
|
|
1776
|
-
collection: PropTypes__default["default"].object,
|
|
1777
|
-
template: PropTypes__default["default"].string,
|
|
1778
|
-
config: PropTypes__default["default"].object,
|
|
1779
|
-
onClick: PropTypes__default["default"].func,
|
|
1780
|
-
navigate: PropTypes__default["default"].func,
|
|
1781
|
-
qtConfig: PropTypes__default["default"].object
|
|
1782
|
-
};
|
|
1783
|
-
|
|
1784
|
-
var LeftArrow = function LeftArrow(_ref) {
|
|
1785
|
-
var _ref$color = _ref.color,
|
|
1786
|
-
color = _ref$color === void 0 ? "#333" : _ref$color;
|
|
1787
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
1788
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1789
|
-
width: "16",
|
|
1790
|
-
height: "16",
|
|
1791
|
-
viewBox: "0 0 10 16"
|
|
1792
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
1793
|
-
fill: "none",
|
|
1794
|
-
fillRule: "nonzero"
|
|
1795
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
1796
|
-
d: "M17 20H-7V-4h24z",
|
|
1797
|
-
opacity: ".384"
|
|
1798
|
-
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
|
1799
|
-
stroke: color,
|
|
1800
|
-
d: "M9 16L1 8l8-8"
|
|
1801
|
-
})));
|
|
1802
|
-
};
|
|
1803
|
-
LeftArrow.propTypes = {
|
|
1804
|
-
color: PropTypes__default["default"].string
|
|
1805
|
-
};
|
|
1806
|
-
|
|
1807
|
-
var RightArrow = function RightArrow(_ref) {
|
|
1808
|
-
var _ref$color = _ref.color,
|
|
1809
|
-
color = _ref$color === void 0 ? "#333" : _ref$color;
|
|
1810
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
1811
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1812
|
-
width: "16",
|
|
1813
|
-
height: "16",
|
|
1814
|
-
viewBox: "0 0 10 16"
|
|
1815
|
-
}, /*#__PURE__*/React__default["default"].createElement("g", {
|
|
1816
|
-
fill: "none",
|
|
1817
|
-
fillRule: "nonzero"
|
|
1818
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
1819
|
-
d: "M-7-4h24v24H-7z",
|
|
1820
|
-
opacity: ".384"
|
|
1821
|
-
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
|
1822
|
-
stroke: color,
|
|
1823
|
-
d: "M1 0l8 8-8 8"
|
|
1824
|
-
})));
|
|
1825
|
-
};
|
|
1826
|
-
RightArrow.propTypes = {
|
|
1827
|
-
color: PropTypes__default["default"].string
|
|
1828
|
-
};
|
|
1829
|
-
|
|
1830
|
-
var _styleModuleImportMap$1 = {
|
|
1831
|
-
"./slider-arrow.m.css": {
|
|
1832
|
-
"arrow": "slider-arrow-m_arrow__1eBUU",
|
|
1833
|
-
"left-arrow-dark": "slider-arrow-m_left-arrow-dark__3mTJS",
|
|
1834
|
-
"right-arrow-dark": "slider-arrow-m_right-arrow-dark__3hWZe",
|
|
1835
|
-
"left-arrow-light": "slider-arrow-m_left-arrow-light__2ipUK",
|
|
1836
|
-
"right-arrow-light": "slider-arrow-m_right-arrow-light__3omMU",
|
|
1837
|
-
"left-arrow-ltr": "slider-arrow-m_left-arrow-ltr__1ngNF",
|
|
1838
|
-
"right-arrow-ltr": "slider-arrow-m_right-arrow-ltr__2svWX",
|
|
1839
|
-
"left-arrow-rtl": "slider-arrow-m_left-arrow-rtl__2ynyn",
|
|
1840
|
-
"right-arrow-rtl": "slider-arrow-m_right-arrow-rtl__1GjPz"
|
|
1841
|
-
}
|
|
1842
|
-
};
|
|
1843
|
-
var SliderArrow = function SliderArrow(_ref) {
|
|
1844
|
-
var selectedIndex = _ref.selectedIndex,
|
|
1845
|
-
previousClick = _ref.previousClick,
|
|
1846
|
-
nextClick = _ref.nextClick,
|
|
1847
|
-
noOfItems = _ref.noOfItems,
|
|
1848
|
-
perView = _ref.perView,
|
|
1849
|
-
languageDirection = _ref.languageDirection;
|
|
1850
|
-
|
|
1851
|
-
if (noOfItems < 1) {
|
|
1852
|
-
return null;
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
var config = useStateValue() || {};
|
|
1856
|
-
var textColor = getTextColor(config.theme);
|
|
1857
|
-
|
|
1858
|
-
var rightArrowView = function rightArrowView() {
|
|
1859
|
-
if (selectedIndex >= noOfItems - perView) return false;
|
|
1860
|
-
return true;
|
|
1861
|
-
};
|
|
1862
|
-
|
|
1863
|
-
var getLeftArrowClassName = languageDirection === "rtl" ? "left-arrow-rtl" : "left-arrow-ltr";
|
|
1864
|
-
var getRightArrowClassName = languageDirection === "rtl" ? "right-arrow-rtl" : "right-arrow-ltr";
|
|
1865
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, selectedIndex !== 0 ? /*#__PURE__*/React__default["default"].createElement("button", {
|
|
1866
|
-
onClick: previousClick,
|
|
1867
|
-
className: ("left-arrow ".concat(getLeftArrowClassName) ? "left-arrow ".concat(getLeftArrowClassName) + " " : "") + _getClassName__default["default"]("arrow left-arrow-".concat(textColor, " ").concat(getLeftArrowClassName), _styleModuleImportMap$1)
|
|
1868
|
-
}, /*#__PURE__*/React__default["default"].createElement(LeftArrow, {
|
|
1869
|
-
color: textColor === "dark" ? "#fff" : "#333"
|
|
1870
|
-
})) : null, selectedIndex < noOfItems - 1 && rightArrowView() ? /*#__PURE__*/React__default["default"].createElement("button", {
|
|
1871
|
-
onClick: nextClick,
|
|
1872
|
-
className: ("right-arrow ".concat(getRightArrowClassName) ? "right-arrow ".concat(getRightArrowClassName) + " " : "") + _getClassName__default["default"]("arrow right-arrow-".concat(textColor, " ").concat(getRightArrowClassName), _styleModuleImportMap$1)
|
|
1873
|
-
}, /*#__PURE__*/React__default["default"].createElement(RightArrow, {
|
|
1874
|
-
color: textColor === "dark" ? "#fff" : "#333"
|
|
1875
|
-
})) : null);
|
|
1876
|
-
};
|
|
1877
|
-
SliderArrow.propTypes = {
|
|
1878
|
-
noOfItems: PropTypes.number,
|
|
1879
|
-
perView: PropTypes.number,
|
|
1880
|
-
slideIndicator: PropTypes.string,
|
|
1881
|
-
previousClick: PropTypes.func,
|
|
1882
|
-
nextClick: PropTypes.func,
|
|
1883
|
-
selectedIndex: PropTypes.number,
|
|
1884
|
-
languageDirection: PropTypes.string
|
|
1885
|
-
};
|
|
1886
|
-
|
|
1887
|
-
var _styleModuleImportMap = {
|
|
1888
|
-
"./slider-indicator.m.css": {
|
|
1889
|
-
"indicators": "slider-indicator-m_indicators__3MNXc",
|
|
1890
|
-
"indicator": "slider-indicator-m_indicator__gTv3x",
|
|
1891
|
-
"indicator-button": "slider-indicator-m_indicator-button__1e82r",
|
|
1892
|
-
"indicator-dots": "slider-indicator-m_indicator-dots__2TR3H",
|
|
1893
|
-
"indicator-dots-dark": "slider-indicator-m_indicator-dots-dark__sGrev",
|
|
1894
|
-
"indicator-dots-light": "slider-indicator-m_indicator-dots-light__2nPn-",
|
|
1895
|
-
"indicator-dashes": "slider-indicator-m_indicator-dashes__DyNCE",
|
|
1896
|
-
"indicator-dashes-dark": "slider-indicator-m_indicator-dashes-dark__VrqJI",
|
|
1897
|
-
"indicator-dashes-light": "slider-indicator-m_indicator-dashes-light__34ESx"
|
|
1898
|
-
}
|
|
1899
|
-
};
|
|
1900
|
-
var SliderIndicator = function SliderIndicator(_ref) {
|
|
1901
|
-
var indicatorItems = _ref.indicatorItems,
|
|
1902
|
-
indicatorClick = _ref.indicatorClick,
|
|
1903
|
-
selectedIndex = _ref.selectedIndex,
|
|
1904
|
-
indicatorType = _ref.indicatorType;
|
|
1905
|
-
|
|
1906
|
-
if (indicatorItems.length < 1) {
|
|
1907
|
-
return null;
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
var config = useStateValue() || {};
|
|
1911
|
-
var textColor = getTextColor(config.theme);
|
|
1912
|
-
return /*#__PURE__*/React__default["default"].createElement("ul", {
|
|
1913
|
-
className: "slider-indicators slider-indicator-m_indicators__3MNXc"
|
|
1914
|
-
}, indicatorItems.map(function (_, index) {
|
|
1915
|
-
return /*#__PURE__*/React__default["default"].createElement("li", {
|
|
1916
|
-
key: "slider-".concat(index),
|
|
1917
|
-
className: "indicator slider-indicator-m_indicator__gTv3x",
|
|
1918
|
-
onClick: function onClick(e) {
|
|
1919
|
-
return indicatorClick(e, index);
|
|
1920
|
-
}
|
|
1921
|
-
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
1922
|
-
"aria-pressed": selectedIndex === index ? "true" : "false",
|
|
1923
|
-
className: ("indicator-button indicator-".concat(indicatorType) ? "indicator-button indicator-".concat(indicatorType) + " " : "") + _getClassName__default["default"]("indicator-button indicator-".concat(indicatorType, " indicator-").concat(indicatorType, "-").concat(textColor), _styleModuleImportMap)
|
|
1924
|
-
}));
|
|
1925
|
-
}));
|
|
1926
|
-
};
|
|
1927
|
-
SliderIndicator.propTypes = {
|
|
1928
|
-
indicatorItems: PropTypes.array,
|
|
1929
|
-
perView: PropTypes.number,
|
|
1930
|
-
indicatorType: PropTypes.string,
|
|
1931
|
-
indicatorClick: PropTypes.func,
|
|
1932
|
-
selectedIndex: PropTypes.number
|
|
1933
|
-
};
|
|
1934
|
-
|
|
1935
|
-
var smoothScroll = function smoothScroll(node, topOrLeft, horizontal) {
|
|
1936
|
-
var _node$scrollTo;
|
|
1937
|
-
|
|
1938
|
-
node.scrollTo((_node$scrollTo = {}, _defineProperty__default["default"](_node$scrollTo, horizontal ? "left" : "top", topOrLeft), _defineProperty__default["default"](_node$scrollTo, "behavior", "smooth"), _node$scrollTo));
|
|
1939
|
-
};
|
|
1940
|
-
|
|
1941
|
-
var updateItemSelection = function updateItemSelection(index, languageDirection, scroller, noOfItems) {
|
|
1942
|
-
var getScrollValue = Math.floor(scroller.current.scrollWidth * (index / noOfItems));
|
|
1943
|
-
var scrollValue = languageDirection === "rtl" ? getScrollValue * -1 : getScrollValue;
|
|
1944
|
-
smoothScroll(scroller.current, scrollValue, true);
|
|
1945
|
-
};
|
|
1946
|
-
|
|
1947
|
-
var setIndicatorValue = function setIndicatorValue(func, ms) {
|
|
1948
|
-
var timeout;
|
|
1949
|
-
return function () {
|
|
1950
|
-
clearTimeout(timeout);
|
|
1951
|
-
timeout = setTimeout(function () {
|
|
1952
|
-
timeout = null;
|
|
1953
|
-
func();
|
|
1954
|
-
}, ms);
|
|
1955
|
-
};
|
|
1956
|
-
};
|
|
1957
|
-
|
|
1958
|
-
var ScrollSnap = function ScrollSnap(_ref) {
|
|
1959
|
-
var children = _ref.children,
|
|
1960
|
-
isArrow = _ref.isArrow,
|
|
1961
|
-
interval = _ref.interval,
|
|
1962
|
-
isInfinite = _ref.isInfinite,
|
|
1963
|
-
pauseOnHover = _ref.pauseOnHover,
|
|
1964
|
-
perView = _ref.perView,
|
|
1965
|
-
slideIndicator = _ref.slideIndicator;
|
|
1966
|
-
|
|
1967
|
-
var _useState = React.useState(0),
|
|
1968
|
-
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1969
|
-
selectedIndex = _useState2[0],
|
|
1970
|
-
setSelectedIndex = _useState2[1];
|
|
1971
|
-
|
|
1972
|
-
var _useState3 = React.useState(false),
|
|
1973
|
-
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
1974
|
-
autoScroll = _useState4[0],
|
|
1975
|
-
setAutoScroll = _useState4[1];
|
|
1976
|
-
|
|
1977
|
-
var languageDirection = reactRedux.useSelector(function (state) {
|
|
1978
|
-
return lodash.get(state, ["qt", "config", "language", "direction"], "ltr");
|
|
1979
|
-
});
|
|
1980
|
-
var noOfItems = children ? children.length : 0;
|
|
1981
|
-
var scroller = React.useRef(null);
|
|
1982
|
-
var numberOfIndicatorsToShow = children.length - (perView - 1);
|
|
1983
|
-
var indicatorItems = children.slice(0, numberOfIndicatorsToShow);
|
|
1984
|
-
React.useEffect(function () {
|
|
1985
|
-
if (scroller.current) {
|
|
1986
|
-
scroller.current.addEventListener("scroll", setIndicatorValue(function () {
|
|
1987
|
-
var value = Math.round(scroller.current.scrollLeft / scroller.current.scrollWidth * noOfItems);
|
|
1988
|
-
setSelectedIndex(Math.abs(value));
|
|
1989
|
-
}, 150)); // For Default Selection if selectedIndex is not 0 then manually select it
|
|
1990
|
-
|
|
1991
|
-
if (selectedIndex !== 0) {
|
|
1992
|
-
updateItemSelection(selectedIndex);
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
return function () {
|
|
1997
|
-
scroller.current.removeEventListener("scroll", setIndicatorValue);
|
|
1998
|
-
};
|
|
1999
|
-
}, []); // Infinite scroll
|
|
2000
|
-
|
|
2001
|
-
React.useEffect(function () {
|
|
2002
|
-
if (isInfinite && !autoScroll) {
|
|
2003
|
-
var timer = setInterval(function () {
|
|
2004
|
-
infiniteScroll();
|
|
2005
|
-
}, interval);
|
|
2006
|
-
return function () {
|
|
2007
|
-
clearInterval(timer);
|
|
2008
|
-
};
|
|
2009
|
-
}
|
|
2010
|
-
}, [isInfinite, autoScroll]);
|
|
2011
|
-
|
|
2012
|
-
var infiniteScroll = function infiniteScroll() {
|
|
2013
|
-
setSelectedIndex(function (value) {
|
|
2014
|
-
var newIndex = value === noOfItems - perView ? 0 : value + 1;
|
|
2015
|
-
updateItemSelection(newIndex, languageDirection, scroller, noOfItems);
|
|
2016
|
-
return newIndex;
|
|
2017
|
-
});
|
|
2018
|
-
};
|
|
2019
|
-
|
|
2020
|
-
var pauseAutoPlay = function pauseAutoPlay() {
|
|
2021
|
-
pauseOnHover && setAutoScroll(!autoScroll);
|
|
2022
|
-
};
|
|
2023
|
-
|
|
2024
|
-
var indicatorClick = function indicatorClick(e, newIndex) {
|
|
2025
|
-
e.preventDefault();
|
|
2026
|
-
e.stopPropagation();
|
|
2027
|
-
setSelectedIndex(newIndex);
|
|
2028
|
-
updateItemSelection(newIndex, languageDirection, scroller, noOfItems);
|
|
2029
|
-
};
|
|
2030
|
-
|
|
2031
|
-
var nextClick = function nextClick(e) {
|
|
2032
|
-
e.preventDefault();
|
|
2033
|
-
e.stopPropagation();
|
|
2034
|
-
|
|
2035
|
-
if (selectedIndex < noOfItems) {
|
|
2036
|
-
var newIndex = selectedIndex + 1;
|
|
2037
|
-
setSelectedIndex(newIndex);
|
|
2038
|
-
updateItemSelection(newIndex, languageDirection, scroller, noOfItems);
|
|
2039
|
-
}
|
|
2040
|
-
};
|
|
2041
|
-
|
|
2042
|
-
var previousClick = function previousClick(e) {
|
|
2043
|
-
e.preventDefault();
|
|
2044
|
-
e.stopPropagation();
|
|
2045
|
-
var newIndex = selectedIndex - 1;
|
|
2046
|
-
setSelectedIndex(newIndex);
|
|
2047
|
-
updateItemSelection(newIndex, languageDirection, scroller, noOfItems);
|
|
2048
|
-
};
|
|
2049
|
-
|
|
2050
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2051
|
-
className: "scroll-snap-container"
|
|
2052
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2053
|
-
className: "scroll-snap-wrapper scroll-snap-m_wrapper__1Rz9v",
|
|
2054
|
-
onMouseEnter: pauseAutoPlay,
|
|
2055
|
-
onMouseLeave: pauseAutoPlay
|
|
2056
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2057
|
-
ref: scroller,
|
|
2058
|
-
className: "scroll-snap-carousel scroll-snap-m_carousel__2m3cg"
|
|
2059
|
-
}, children), isArrow && /*#__PURE__*/React__default["default"].createElement(SliderArrow, {
|
|
2060
|
-
noOfItems: noOfItems,
|
|
2061
|
-
perView: perView,
|
|
2062
|
-
previousClick: previousClick,
|
|
2063
|
-
nextClick: nextClick,
|
|
2064
|
-
selectedIndex: selectedIndex,
|
|
2065
|
-
languageDirection: languageDirection
|
|
2066
|
-
})), children.length > perView && slideIndicator !== "none" && /*#__PURE__*/React__default["default"].createElement(SliderIndicator, {
|
|
2067
|
-
indicatorItems: indicatorItems,
|
|
2068
|
-
indicatorClick: indicatorClick,
|
|
2069
|
-
selectedIndex: selectedIndex,
|
|
2070
|
-
indicatorType: slideIndicator
|
|
2071
|
-
}));
|
|
2072
|
-
};
|
|
2073
|
-
ScrollSnap.defaultProps = {
|
|
2074
|
-
isArrow: true,
|
|
2075
|
-
isInfinite: false,
|
|
2076
|
-
interval: 4000,
|
|
2077
|
-
pauseOnHover: true,
|
|
2078
|
-
perView: 1,
|
|
2079
|
-
slideIndicator: "dots"
|
|
2080
|
-
};
|
|
2081
|
-
ScrollSnap.propTypes = {
|
|
2082
|
-
children: PropTypes.array.isRequired,
|
|
2083
|
-
isArrow: PropTypes.bool,
|
|
2084
|
-
isInfinite: PropTypes.bool,
|
|
2085
|
-
interval: PropTypes.number,
|
|
2086
|
-
pauseOnHover: PropTypes.bool,
|
|
2087
|
-
perView: PropTypes.number,
|
|
2088
|
-
slideIndicator: PropTypes.string
|
|
2089
|
-
};
|
|
2090
|
-
|
|
2091
|
-
var FourStorySliderBase = function FourStorySliderBase(_ref) {
|
|
2092
|
-
var collection = _ref.collection,
|
|
2093
|
-
_ref$config = _ref.config,
|
|
2094
|
-
config = _ref$config === void 0 ? {} : _ref$config;
|
|
2095
|
-
var _config$collectionNam = config.collectionNameBorderColor,
|
|
2096
|
-
collectionNameBorderColor = _config$collectionNam === void 0 ? "" : _config$collectionNam,
|
|
2097
|
-
_config$borderColor = config.borderColor,
|
|
2098
|
-
borderColor = _config$borderColor === void 0 ? "" : _config$borderColor,
|
|
2099
|
-
_config$theme = config.theme,
|
|
2100
|
-
theme = _config$theme === void 0 ? "" : _config$theme,
|
|
2101
|
-
_config$border = config.border,
|
|
2102
|
-
border = _config$border === void 0 ? "" : _config$border,
|
|
2103
|
-
_config$collectionNam2 = config.collectionNameTemplate,
|
|
2104
|
-
collectionNameTemplate = _config$collectionNam2 === void 0 ? "" : _config$collectionNam2,
|
|
2105
|
-
_config$numberOfStori = config.numberOfStoriesToShow,
|
|
2106
|
-
numberOfStoriesToShow = _config$numberOfStori === void 0 ? 0 : _config$numberOfStori,
|
|
2107
|
-
_config$footerButton = config.footerButton,
|
|
2108
|
-
footerButton = _config$footerButton === void 0 ? "" : _config$footerButton,
|
|
2109
|
-
_config$footerSlotCon = config.footerSlotConfig,
|
|
2110
|
-
footerSlotConfig = _config$footerSlotCon === void 0 ? {} : _config$footerSlotCon,
|
|
2111
|
-
_config$navigationArr = config.navigationArrows,
|
|
2112
|
-
navigationArrows = _config$navigationArr === void 0 ? true : _config$navigationArr,
|
|
2113
|
-
_config$slideIndicato = config.slideIndicator,
|
|
2114
|
-
slideIndicator = _config$slideIndicato === void 0 ? "none" : _config$slideIndicato,
|
|
2115
|
-
_config$isInfinite = config.isInfinite,
|
|
2116
|
-
isInfinite = _config$isInfinite === void 0 ? false : _config$isInfinite;
|
|
2117
|
-
var footerSlot = footerSlotConfig.footerSlot;
|
|
2118
|
-
var items = components.collectionToStories(collection);
|
|
2119
|
-
|
|
2120
|
-
if (items.length < 1) {
|
|
2121
|
-
return null;
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
var dispatch = reactRedux.useDispatch();
|
|
2125
|
-
var qtConfig = reactRedux.useSelector(function (state) {
|
|
2126
|
-
return lodash.get(state, ["qt", "config"], {});
|
|
2127
|
-
});
|
|
2128
|
-
var url = generateNavigateSlug(collection, qtConfig);
|
|
2129
|
-
|
|
2130
|
-
var _useState = React.useState(1),
|
|
2131
|
-
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
2132
|
-
perView = _useState2[0],
|
|
2133
|
-
setPerView = _useState2[1];
|
|
2134
|
-
|
|
2135
|
-
var showNumberOfStoriesToShow = getNumberOfStoriesToShow(numberOfStoriesToShow);
|
|
2136
|
-
var textColor = getTextColor(theme);
|
|
2137
|
-
var footerSlotComp = footerSlot ? footerSlot() : null;
|
|
2138
|
-
React.useEffect(function () {
|
|
2139
|
-
var deviceWidth = lodash.get(global, ["innerWidth"], 480);
|
|
2140
|
-
if (deviceWidth > 992) setPerView(4);else if (deviceWidth > 764) setPerView(3);else setPerView(1);
|
|
2141
|
-
}, []);
|
|
2142
|
-
|
|
2143
|
-
var getItems = function getItems() {
|
|
2144
|
-
return items.slice(0, showNumberOfStoriesToShow).map(function (story, index) {
|
|
2145
|
-
return /*#__PURE__*/React__default["default"].createElement(StoryCard, {
|
|
2146
|
-
story: story,
|
|
2147
|
-
theme: theme,
|
|
2148
|
-
border: border,
|
|
2149
|
-
key: index,
|
|
2150
|
-
config: config
|
|
2151
|
-
}, /*#__PURE__*/React__default["default"].createElement(HeroImage, {
|
|
2152
|
-
config: config,
|
|
2153
|
-
story: story,
|
|
2154
|
-
aspectRatio: [[16, 9]]
|
|
2155
|
-
}), /*#__PURE__*/React__default["default"].createElement(StorycardContent, {
|
|
2156
|
-
story: story,
|
|
2157
|
-
border: border,
|
|
2158
|
-
borderColor: borderColor,
|
|
2159
|
-
config: config
|
|
2160
|
-
}));
|
|
2161
|
-
});
|
|
2162
|
-
};
|
|
2163
|
-
|
|
2164
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2165
|
-
className: "full-width-with-padding arrow-component",
|
|
2166
|
-
"data-test-id": "four-story-slider",
|
|
2167
|
-
style: {
|
|
2168
|
-
backgroundColor: theme,
|
|
2169
|
-
color: textColor
|
|
2170
|
-
}
|
|
2171
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2172
|
-
className: "four-story-slider-m_four-story-slider-wrapper__1WZcd"
|
|
2173
|
-
}, /*#__PURE__*/React__default["default"].createElement(CollectionName, {
|
|
2174
|
-
collection: collection,
|
|
2175
|
-
collectionNameTemplate: collectionNameTemplate,
|
|
2176
|
-
collectionNameBorderColor: collectionNameBorderColor
|
|
2177
|
-
}), items.length > 4 ? /*#__PURE__*/React__default["default"].createElement(ScrollSnap, {
|
|
2178
|
-
isArrow: navigationArrows,
|
|
2179
|
-
perView: perView,
|
|
2180
|
-
slideIndicator: slideIndicator,
|
|
2181
|
-
isInfinite: isInfinite
|
|
2182
|
-
}, getItems()) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2183
|
-
className: "four-story-slider-m_story-grid__NcDMl"
|
|
2184
|
-
}, getItems()), /*#__PURE__*/React__default["default"].createElement(LoadmoreButton, {
|
|
2185
|
-
collection: collection,
|
|
2186
|
-
template: footerButton,
|
|
2187
|
-
config: config,
|
|
2188
|
-
navigate: function navigate() {
|
|
2189
|
-
return navigateTo(dispatch, url);
|
|
2190
|
-
},
|
|
2191
|
-
qtConfig: qtConfig
|
|
2192
|
-
}), footerSlotComp));
|
|
2193
|
-
};
|
|
2194
|
-
FourStorySliderBase.propTypes = {
|
|
2195
|
-
/** collection is the array of objects which is returning by API */
|
|
2196
|
-
collection: PropTypes__default["default"].object.isRequired,
|
|
2197
|
-
|
|
2198
|
-
/** The config for the Row */
|
|
2199
|
-
config: PropTypes__default["default"].shape({
|
|
2200
|
-
// section tag border color
|
|
2201
|
-
borderColor: PropTypes__default["default"].string,
|
|
2202
|
-
// background color of the row
|
|
2203
|
-
theme: PropTypes__default["default"].string,
|
|
2204
|
-
border: PropTypes__default["default"].string,
|
|
2205
|
-
footerButton: PropTypes__default["default"].string,
|
|
2206
|
-
// configure ad slot widget and story
|
|
2207
|
-
collectionNameTemplate: PropTypes__default["default"].string,
|
|
2208
|
-
autoplaySpeed: PropTypes__default["default"].number,
|
|
2209
|
-
// speed of the slider(ms)
|
|
2210
|
-
numberOfStoriesToShow: PropTypes__default["default"].number,
|
|
2211
|
-
// no of slides in slider
|
|
2212
|
-
collectionNameBorderColor: PropTypes__default["default"].string
|
|
2213
|
-
})
|
|
2214
|
-
};
|
|
2215
|
-
FourStorySliderBase.defaultProps = {
|
|
2216
|
-
theme: "#ffffff",
|
|
2217
|
-
slotConfig: "story",
|
|
2218
|
-
border: ""
|
|
2219
|
-
};
|
|
2220
|
-
var FourStorySlider = StateProvider(FourStorySliderBase);
|
|
2221
|
-
|
|
2222
|
-
exports.FourStorySlider = FourStorySlider;
|
|
2223
|
-
exports.FourStorySliderBase = FourStorySliderBase;
|