@financial-times/x-teaser 14.9.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Teaser.cjs.js +37 -38
- package/dist/Teaser.es5.js +1 -2
- package/dist/Teaser.esm.js +37 -38
- package/package.json +2 -2
- package/src/Title.jsx +3 -2
- package/storybook/index.jsx +0 -2
package/dist/Teaser.cjs.js
CHANGED
|
@@ -75,7 +75,7 @@ const dynamicModifiers = props => {
|
|
|
75
75
|
}
|
|
76
76
|
return modifiers;
|
|
77
77
|
};
|
|
78
|
-
var Container =
|
|
78
|
+
var Container = props => {
|
|
79
79
|
const computed = dynamicModifiers(props);
|
|
80
80
|
// Modifier props may be a string rather than a string[] so concat, don't spread.
|
|
81
81
|
const variants = [props.type, props.layout].concat(props.modifiers, computed);
|
|
@@ -85,13 +85,13 @@ var Container = (props => {
|
|
|
85
85
|
"data-id": props.id,
|
|
86
86
|
"data-trackable": props.dataTrackable
|
|
87
87
|
}, props.children);
|
|
88
|
-
}
|
|
88
|
+
};
|
|
89
89
|
|
|
90
|
-
var Content = (
|
|
90
|
+
var Content = ({
|
|
91
91
|
children = []
|
|
92
92
|
}) => xEngine.h("div", {
|
|
93
93
|
className: "o-teaser__content"
|
|
94
|
-
}, children)
|
|
94
|
+
}, children);
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Render
|
|
@@ -110,11 +110,11 @@ const render = action => {
|
|
|
110
110
|
return action;
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
var CustomSlot = (
|
|
113
|
+
var CustomSlot = ({
|
|
114
114
|
customSlot
|
|
115
115
|
}) => customSlot ? xEngine.h("div", {
|
|
116
116
|
className: "o-teaser__action"
|
|
117
|
-
}, render(customSlot)) : null
|
|
117
|
+
}, render(customSlot)) : null;
|
|
118
118
|
|
|
119
119
|
const ImageSizes = {
|
|
120
120
|
Headshot: 75,
|
|
@@ -125,7 +125,6 @@ const ImageSizes = {
|
|
|
125
125
|
XL: 640,
|
|
126
126
|
XXL: 1180 // max width of FT.com page
|
|
127
127
|
};
|
|
128
|
-
|
|
129
128
|
const Layouts = {
|
|
130
129
|
Small: 'small',
|
|
131
130
|
Large: 'large',
|
|
@@ -160,7 +159,7 @@ function imageService(url, width, options) {
|
|
|
160
159
|
|
|
161
160
|
// these colours are tweaked from o-colors palette colours to make headshots look less washed out
|
|
162
161
|
const DEFAULT_TINT = '054593,d6d5d3';
|
|
163
|
-
var Headshot = (
|
|
162
|
+
var Headshot = ({
|
|
164
163
|
headshot,
|
|
165
164
|
headshotTint
|
|
166
165
|
}) => {
|
|
@@ -175,7 +174,7 @@ var Headshot = (({
|
|
|
175
174
|
"aria-hidden": "true",
|
|
176
175
|
src: imageService(headshot, ImageSizes.Headshot, options)
|
|
177
176
|
}) : null;
|
|
178
|
-
}
|
|
177
|
+
};
|
|
179
178
|
|
|
180
179
|
const BaseLink = ({
|
|
181
180
|
url,
|
|
@@ -190,13 +189,13 @@ const BaseLink = ({
|
|
|
190
189
|
return xEngine.h("span", attrs, children);
|
|
191
190
|
}
|
|
192
191
|
};
|
|
193
|
-
var Link = (
|
|
192
|
+
var Link = ({
|
|
194
193
|
customElements = {},
|
|
195
194
|
...props
|
|
196
195
|
}) => {
|
|
197
196
|
const Link = customElements.Link || BaseLink;
|
|
198
197
|
return xEngine.h(Link, props);
|
|
199
|
-
}
|
|
198
|
+
};
|
|
200
199
|
|
|
201
200
|
/**
|
|
202
201
|
* Aspect Ratio
|
|
@@ -234,7 +233,7 @@ const LazyImage = ({
|
|
|
234
233
|
alt: alt
|
|
235
234
|
});
|
|
236
235
|
};
|
|
237
|
-
var Image = (
|
|
236
|
+
var Image = ({
|
|
238
237
|
relativeUrl,
|
|
239
238
|
url,
|
|
240
239
|
image,
|
|
@@ -274,7 +273,7 @@ var Image = (({
|
|
|
274
273
|
lazyLoad: imageLazyLoad,
|
|
275
274
|
alt: alt
|
|
276
275
|
}))));
|
|
277
|
-
}
|
|
276
|
+
};
|
|
278
277
|
|
|
279
278
|
const sameId = (context = {}, id) => {
|
|
280
279
|
return id && context && context.parentId && id === context.parentId;
|
|
@@ -282,7 +281,7 @@ const sameId = (context = {}, id) => {
|
|
|
282
281
|
const sameLabel = (context = {}, label) => {
|
|
283
282
|
return label && context && context.parentLabel && label === context.parentLabel;
|
|
284
283
|
};
|
|
285
|
-
var MetaLink = (
|
|
284
|
+
var MetaLink = ({
|
|
286
285
|
metaPrefixText,
|
|
287
286
|
metaLink,
|
|
288
287
|
metaAltLink,
|
|
@@ -308,9 +307,9 @@ var MetaLink = (({
|
|
|
308
307
|
}, displayLink.prefLabel) : null, showSuffixText ? xEngine.h("span", {
|
|
309
308
|
className: "o-teaser__tag-suffix"
|
|
310
309
|
}, metaSuffixText) : null);
|
|
311
|
-
}
|
|
310
|
+
};
|
|
312
311
|
|
|
313
|
-
var Promoted = (
|
|
312
|
+
var Promoted = ({
|
|
314
313
|
promotedPrefixText,
|
|
315
314
|
promotedSuffixText
|
|
316
315
|
}) => xEngine.h("div", {
|
|
@@ -319,12 +318,12 @@ var Promoted = (({
|
|
|
319
318
|
className: "o-teaser__promoted-prefix"
|
|
320
319
|
}, promotedPrefixText), " by", xEngine.h("span", {
|
|
321
320
|
className: "o-teaser__promoted-by"
|
|
322
|
-
}, ` ${promotedSuffixText} `))
|
|
321
|
+
}, ` ${promotedSuffixText} `));
|
|
323
322
|
|
|
324
|
-
var Meta =
|
|
323
|
+
var Meta = props => {
|
|
325
324
|
const showPromoted = props.promotedPrefixText && props.promotedSuffixText;
|
|
326
325
|
return showPromoted ? xEngine.h(Promoted, props) : xEngine.h(MetaLink, props);
|
|
327
|
-
}
|
|
326
|
+
};
|
|
328
327
|
|
|
329
328
|
const renderLink = ({
|
|
330
329
|
id,
|
|
@@ -343,20 +342,20 @@ const renderLink = ({
|
|
|
343
342
|
href: displayUrl
|
|
344
343
|
}, title));
|
|
345
344
|
};
|
|
346
|
-
var RelatedLinks = (
|
|
345
|
+
var RelatedLinks = ({
|
|
347
346
|
relatedLinks = []
|
|
348
347
|
}) => relatedLinks && relatedLinks.length ? xEngine.h("ul", {
|
|
349
348
|
className: "o-teaser__related"
|
|
350
|
-
}, relatedLinks.map(renderLink)) : null
|
|
349
|
+
}, relatedLinks.map(renderLink)) : null;
|
|
351
350
|
|
|
352
|
-
var TimeStamp = (
|
|
351
|
+
var TimeStamp = ({
|
|
353
352
|
publishedDate
|
|
354
353
|
}) => xEngine.h("div", {
|
|
355
354
|
className: "o-teaser__timestamp"
|
|
356
355
|
}, xEngine.h("time", {
|
|
357
356
|
className: "o-teaser__timestamp-date",
|
|
358
357
|
dateTime: dateformat(publishedDate, dateformat.masks.isoDateTime, true)
|
|
359
|
-
}, dateformat(publishedDate, dateformat.masks.longDate, true)))
|
|
358
|
+
}, dateformat(publishedDate, dateformat.masks.longDate, true)));
|
|
360
359
|
|
|
361
360
|
/**
|
|
362
361
|
* To Date
|
|
@@ -419,7 +418,7 @@ const displayTime = date => {
|
|
|
419
418
|
const suffix = hours === 0 ? '' : `${plural} ago`;
|
|
420
419
|
return `${hours} ${suffix}`;
|
|
421
420
|
};
|
|
422
|
-
var RelativeTime = (
|
|
421
|
+
var RelativeTime = ({
|
|
423
422
|
publishedDate,
|
|
424
423
|
firstPublishedDate,
|
|
425
424
|
showAlways = false
|
|
@@ -436,7 +435,7 @@ var RelativeTime = (({
|
|
|
436
435
|
"data-o-date-format": showAlways ? 'time-ago-limit-24-hours' : 'time-ago-limit-4-hours',
|
|
437
436
|
dateTime: dateformat(publishedDate, dateformat.masks.isoDateTime, true)
|
|
438
437
|
}, status ? '' : displayTime(relativeDate))) : null;
|
|
439
|
-
}
|
|
438
|
+
};
|
|
440
439
|
|
|
441
440
|
const LiveBlogLabels = {
|
|
442
441
|
inprogress: 'Live',
|
|
@@ -448,20 +447,20 @@ const LiveBlogModifiers = {
|
|
|
448
447
|
comingsoon: 'pending',
|
|
449
448
|
closed: 'closed'
|
|
450
449
|
};
|
|
451
|
-
var LiveBlogStatus = (
|
|
450
|
+
var LiveBlogStatus = ({
|
|
452
451
|
status
|
|
453
452
|
}) => status && status !== 'closed' ? xEngine.h("div", {
|
|
454
453
|
className: `o-teaser__timestamp o-teaser__timestamp--${LiveBlogModifiers[status]}`
|
|
455
454
|
}, xEngine.h("span", {
|
|
456
455
|
className: "o-teaser__timestamp-prefix"
|
|
457
|
-
}, ` ${LiveBlogLabels[status]} `)) : null
|
|
456
|
+
}, ` ${LiveBlogLabels[status]} `)) : null;
|
|
458
457
|
|
|
459
458
|
/**
|
|
460
459
|
* Timestamp shown always, the default 4h limit does not apply here
|
|
461
460
|
* If same calendar day, we show relative time e.g. X hours ago or Updated X min ago
|
|
462
461
|
* If different calendar day, we show full Date time e.g. June 9, 2021
|
|
463
462
|
*/
|
|
464
|
-
var AlwaysShowTimestamp =
|
|
463
|
+
var AlwaysShowTimestamp = props => {
|
|
465
464
|
const localTodayDate = new Date().toISOString().substr(0, 10); // keep only the date bit
|
|
466
465
|
const dateToCompare = new Date(props.publishedDate).toISOString().substr(0, 10);
|
|
467
466
|
if (dateFns.differenceInCalendarDays(localTodayDate, dateToCompare) >= 1) {
|
|
@@ -471,9 +470,9 @@ var AlwaysShowTimestamp = (props => {
|
|
|
471
470
|
showAlways: true
|
|
472
471
|
}));
|
|
473
472
|
}
|
|
474
|
-
}
|
|
473
|
+
};
|
|
475
474
|
|
|
476
|
-
var Status =
|
|
475
|
+
var Status = props => {
|
|
477
476
|
if (props.status) {
|
|
478
477
|
return xEngine.h(LiveBlogStatus, props);
|
|
479
478
|
}
|
|
@@ -487,9 +486,9 @@ var Status = (props => {
|
|
|
487
486
|
}
|
|
488
487
|
}
|
|
489
488
|
return null;
|
|
490
|
-
}
|
|
489
|
+
};
|
|
491
490
|
|
|
492
|
-
var Standfirst = (
|
|
491
|
+
var Standfirst = ({
|
|
493
492
|
standfirst,
|
|
494
493
|
altStandfirst,
|
|
495
494
|
headlineTesting,
|
|
@@ -510,9 +509,9 @@ var Standfirst = (({
|
|
|
510
509
|
className: 'js-teaser-standfirst-link'
|
|
511
510
|
}
|
|
512
511
|
}), displayStandfirst)) : null;
|
|
513
|
-
}
|
|
512
|
+
};
|
|
514
513
|
|
|
515
|
-
var Title = (
|
|
514
|
+
var Title = ({
|
|
516
515
|
title,
|
|
517
516
|
altTitle,
|
|
518
517
|
headlineTesting,
|
|
@@ -544,9 +543,9 @@ var Title = (({
|
|
|
544
543
|
}), displayTitle), indicators && indicators.accessLevel === 'premium' ? xEngine.h("span", null, ' ', xEngine.h("span", {
|
|
545
544
|
className: premiumClass
|
|
546
545
|
}, "Premium"), xEngine.h("span", {
|
|
547
|
-
className: "
|
|
546
|
+
className: "o3-visually-hidden"
|
|
548
547
|
}, "\xA0content")) : null);
|
|
549
|
-
}
|
|
548
|
+
};
|
|
550
549
|
|
|
551
550
|
// Re-format the data for use with o-video
|
|
552
551
|
const formatData = props => JSON.stringify({
|
|
@@ -576,13 +575,13 @@ const Embed = props => {
|
|
|
576
575
|
"data-o-video-systemcode": props.systemCode
|
|
577
576
|
}));
|
|
578
577
|
};
|
|
579
|
-
var Video =
|
|
578
|
+
var Video = props => xEngine.h("div", {
|
|
580
579
|
className: "o-teaser__video"
|
|
581
580
|
}, xEngine.h("div", {
|
|
582
581
|
className: "o--if-js"
|
|
583
582
|
}, xEngine.h(Embed, props)), xEngine.h("div", {
|
|
584
583
|
className: "o--if-no-js"
|
|
585
|
-
}, xEngine.h(Image, props)))
|
|
584
|
+
}, xEngine.h(Image, props)));
|
|
586
585
|
|
|
587
586
|
const PromotionalContent = ({
|
|
588
587
|
promotionalContent
|
package/dist/Teaser.es5.js
CHANGED
|
@@ -134,7 +134,6 @@ var ImageSizes = {
|
|
|
134
134
|
XL: 640,
|
|
135
135
|
XXL: 1180 // max width of FT.com page
|
|
136
136
|
};
|
|
137
|
-
|
|
138
137
|
var Layouts = {
|
|
139
138
|
Small: 'small',
|
|
140
139
|
Large: 'large',
|
|
@@ -632,7 +631,7 @@ var Title = (function (_ref) {
|
|
|
632
631
|
}), displayTitle), indicators && indicators.accessLevel === 'premium' ? xEngine.h("span", null, ' ', xEngine.h("span", {
|
|
633
632
|
className: premiumClass
|
|
634
633
|
}, "Premium"), xEngine.h("span", {
|
|
635
|
-
className: "
|
|
634
|
+
className: "o3-visually-hidden"
|
|
636
635
|
}, "\xA0content")) : null);
|
|
637
636
|
});
|
|
638
637
|
|
package/dist/Teaser.esm.js
CHANGED
|
@@ -69,7 +69,7 @@ const dynamicModifiers = props => {
|
|
|
69
69
|
}
|
|
70
70
|
return modifiers;
|
|
71
71
|
};
|
|
72
|
-
var Container =
|
|
72
|
+
var Container = props => {
|
|
73
73
|
const computed = dynamicModifiers(props);
|
|
74
74
|
// Modifier props may be a string rather than a string[] so concat, don't spread.
|
|
75
75
|
const variants = [props.type, props.layout].concat(props.modifiers, computed);
|
|
@@ -79,13 +79,13 @@ var Container = (props => {
|
|
|
79
79
|
"data-id": props.id,
|
|
80
80
|
"data-trackable": props.dataTrackable
|
|
81
81
|
}, props.children);
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
83
|
|
|
84
|
-
var Content = (
|
|
84
|
+
var Content = ({
|
|
85
85
|
children = []
|
|
86
86
|
}) => h("div", {
|
|
87
87
|
className: "o-teaser__content"
|
|
88
|
-
}, children)
|
|
88
|
+
}, children);
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Render
|
|
@@ -104,11 +104,11 @@ const render = action => {
|
|
|
104
104
|
return action;
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
-
var CustomSlot = (
|
|
107
|
+
var CustomSlot = ({
|
|
108
108
|
customSlot
|
|
109
109
|
}) => customSlot ? h("div", {
|
|
110
110
|
className: "o-teaser__action"
|
|
111
|
-
}, render(customSlot)) : null
|
|
111
|
+
}, render(customSlot)) : null;
|
|
112
112
|
|
|
113
113
|
const ImageSizes = {
|
|
114
114
|
Headshot: 75,
|
|
@@ -119,7 +119,6 @@ const ImageSizes = {
|
|
|
119
119
|
XL: 640,
|
|
120
120
|
XXL: 1180 // max width of FT.com page
|
|
121
121
|
};
|
|
122
|
-
|
|
123
122
|
const Layouts = {
|
|
124
123
|
Small: 'small',
|
|
125
124
|
Large: 'large',
|
|
@@ -154,7 +153,7 @@ function imageService(url, width, options) {
|
|
|
154
153
|
|
|
155
154
|
// these colours are tweaked from o-colors palette colours to make headshots look less washed out
|
|
156
155
|
const DEFAULT_TINT = '054593,d6d5d3';
|
|
157
|
-
var Headshot = (
|
|
156
|
+
var Headshot = ({
|
|
158
157
|
headshot,
|
|
159
158
|
headshotTint
|
|
160
159
|
}) => {
|
|
@@ -169,7 +168,7 @@ var Headshot = (({
|
|
|
169
168
|
"aria-hidden": "true",
|
|
170
169
|
src: imageService(headshot, ImageSizes.Headshot, options)
|
|
171
170
|
}) : null;
|
|
172
|
-
}
|
|
171
|
+
};
|
|
173
172
|
|
|
174
173
|
const BaseLink = ({
|
|
175
174
|
url,
|
|
@@ -184,13 +183,13 @@ const BaseLink = ({
|
|
|
184
183
|
return h("span", attrs, children);
|
|
185
184
|
}
|
|
186
185
|
};
|
|
187
|
-
var Link = (
|
|
186
|
+
var Link = ({
|
|
188
187
|
customElements = {},
|
|
189
188
|
...props
|
|
190
189
|
}) => {
|
|
191
190
|
const Link = customElements.Link || BaseLink;
|
|
192
191
|
return h(Link, props);
|
|
193
|
-
}
|
|
192
|
+
};
|
|
194
193
|
|
|
195
194
|
/**
|
|
196
195
|
* Aspect Ratio
|
|
@@ -228,7 +227,7 @@ const LazyImage = ({
|
|
|
228
227
|
alt: alt
|
|
229
228
|
});
|
|
230
229
|
};
|
|
231
|
-
var Image = (
|
|
230
|
+
var Image = ({
|
|
232
231
|
relativeUrl,
|
|
233
232
|
url,
|
|
234
233
|
image,
|
|
@@ -268,7 +267,7 @@ var Image = (({
|
|
|
268
267
|
lazyLoad: imageLazyLoad,
|
|
269
268
|
alt: alt
|
|
270
269
|
}))));
|
|
271
|
-
}
|
|
270
|
+
};
|
|
272
271
|
|
|
273
272
|
const sameId = (context = {}, id) => {
|
|
274
273
|
return id && context && context.parentId && id === context.parentId;
|
|
@@ -276,7 +275,7 @@ const sameId = (context = {}, id) => {
|
|
|
276
275
|
const sameLabel = (context = {}, label) => {
|
|
277
276
|
return label && context && context.parentLabel && label === context.parentLabel;
|
|
278
277
|
};
|
|
279
|
-
var MetaLink = (
|
|
278
|
+
var MetaLink = ({
|
|
280
279
|
metaPrefixText,
|
|
281
280
|
metaLink,
|
|
282
281
|
metaAltLink,
|
|
@@ -302,9 +301,9 @@ var MetaLink = (({
|
|
|
302
301
|
}, displayLink.prefLabel) : null, showSuffixText ? h("span", {
|
|
303
302
|
className: "o-teaser__tag-suffix"
|
|
304
303
|
}, metaSuffixText) : null);
|
|
305
|
-
}
|
|
304
|
+
};
|
|
306
305
|
|
|
307
|
-
var Promoted = (
|
|
306
|
+
var Promoted = ({
|
|
308
307
|
promotedPrefixText,
|
|
309
308
|
promotedSuffixText
|
|
310
309
|
}) => h("div", {
|
|
@@ -313,12 +312,12 @@ var Promoted = (({
|
|
|
313
312
|
className: "o-teaser__promoted-prefix"
|
|
314
313
|
}, promotedPrefixText), " by", h("span", {
|
|
315
314
|
className: "o-teaser__promoted-by"
|
|
316
|
-
}, ` ${promotedSuffixText} `))
|
|
315
|
+
}, ` ${promotedSuffixText} `));
|
|
317
316
|
|
|
318
|
-
var Meta =
|
|
317
|
+
var Meta = props => {
|
|
319
318
|
const showPromoted = props.promotedPrefixText && props.promotedSuffixText;
|
|
320
319
|
return showPromoted ? h(Promoted, props) : h(MetaLink, props);
|
|
321
|
-
}
|
|
320
|
+
};
|
|
322
321
|
|
|
323
322
|
const renderLink = ({
|
|
324
323
|
id,
|
|
@@ -337,20 +336,20 @@ const renderLink = ({
|
|
|
337
336
|
href: displayUrl
|
|
338
337
|
}, title));
|
|
339
338
|
};
|
|
340
|
-
var RelatedLinks = (
|
|
339
|
+
var RelatedLinks = ({
|
|
341
340
|
relatedLinks = []
|
|
342
341
|
}) => relatedLinks && relatedLinks.length ? h("ul", {
|
|
343
342
|
className: "o-teaser__related"
|
|
344
|
-
}, relatedLinks.map(renderLink)) : null
|
|
343
|
+
}, relatedLinks.map(renderLink)) : null;
|
|
345
344
|
|
|
346
|
-
var TimeStamp = (
|
|
345
|
+
var TimeStamp = ({
|
|
347
346
|
publishedDate
|
|
348
347
|
}) => h("div", {
|
|
349
348
|
className: "o-teaser__timestamp"
|
|
350
349
|
}, h("time", {
|
|
351
350
|
className: "o-teaser__timestamp-date",
|
|
352
351
|
dateTime: dateformat(publishedDate, dateformat.masks.isoDateTime, true)
|
|
353
|
-
}, dateformat(publishedDate, dateformat.masks.longDate, true)))
|
|
352
|
+
}, dateformat(publishedDate, dateformat.masks.longDate, true)));
|
|
354
353
|
|
|
355
354
|
/**
|
|
356
355
|
* To Date
|
|
@@ -413,7 +412,7 @@ const displayTime = date => {
|
|
|
413
412
|
const suffix = hours === 0 ? '' : `${plural} ago`;
|
|
414
413
|
return `${hours} ${suffix}`;
|
|
415
414
|
};
|
|
416
|
-
var RelativeTime = (
|
|
415
|
+
var RelativeTime = ({
|
|
417
416
|
publishedDate,
|
|
418
417
|
firstPublishedDate,
|
|
419
418
|
showAlways = false
|
|
@@ -430,7 +429,7 @@ var RelativeTime = (({
|
|
|
430
429
|
"data-o-date-format": showAlways ? 'time-ago-limit-24-hours' : 'time-ago-limit-4-hours',
|
|
431
430
|
dateTime: dateformat(publishedDate, dateformat.masks.isoDateTime, true)
|
|
432
431
|
}, status ? '' : displayTime(relativeDate))) : null;
|
|
433
|
-
}
|
|
432
|
+
};
|
|
434
433
|
|
|
435
434
|
const LiveBlogLabels = {
|
|
436
435
|
inprogress: 'Live',
|
|
@@ -442,20 +441,20 @@ const LiveBlogModifiers = {
|
|
|
442
441
|
comingsoon: 'pending',
|
|
443
442
|
closed: 'closed'
|
|
444
443
|
};
|
|
445
|
-
var LiveBlogStatus = (
|
|
444
|
+
var LiveBlogStatus = ({
|
|
446
445
|
status
|
|
447
446
|
}) => status && status !== 'closed' ? h("div", {
|
|
448
447
|
className: `o-teaser__timestamp o-teaser__timestamp--${LiveBlogModifiers[status]}`
|
|
449
448
|
}, h("span", {
|
|
450
449
|
className: "o-teaser__timestamp-prefix"
|
|
451
|
-
}, ` ${LiveBlogLabels[status]} `)) : null
|
|
450
|
+
}, ` ${LiveBlogLabels[status]} `)) : null;
|
|
452
451
|
|
|
453
452
|
/**
|
|
454
453
|
* Timestamp shown always, the default 4h limit does not apply here
|
|
455
454
|
* If same calendar day, we show relative time e.g. X hours ago or Updated X min ago
|
|
456
455
|
* If different calendar day, we show full Date time e.g. June 9, 2021
|
|
457
456
|
*/
|
|
458
|
-
var AlwaysShowTimestamp =
|
|
457
|
+
var AlwaysShowTimestamp = props => {
|
|
459
458
|
const localTodayDate = new Date().toISOString().substr(0, 10); // keep only the date bit
|
|
460
459
|
const dateToCompare = new Date(props.publishedDate).toISOString().substr(0, 10);
|
|
461
460
|
if (differenceInCalendarDays(localTodayDate, dateToCompare) >= 1) {
|
|
@@ -465,9 +464,9 @@ var AlwaysShowTimestamp = (props => {
|
|
|
465
464
|
showAlways: true
|
|
466
465
|
}));
|
|
467
466
|
}
|
|
468
|
-
}
|
|
467
|
+
};
|
|
469
468
|
|
|
470
|
-
var Status =
|
|
469
|
+
var Status = props => {
|
|
471
470
|
if (props.status) {
|
|
472
471
|
return h(LiveBlogStatus, props);
|
|
473
472
|
}
|
|
@@ -481,9 +480,9 @@ var Status = (props => {
|
|
|
481
480
|
}
|
|
482
481
|
}
|
|
483
482
|
return null;
|
|
484
|
-
}
|
|
483
|
+
};
|
|
485
484
|
|
|
486
|
-
var Standfirst = (
|
|
485
|
+
var Standfirst = ({
|
|
487
486
|
standfirst,
|
|
488
487
|
altStandfirst,
|
|
489
488
|
headlineTesting,
|
|
@@ -504,9 +503,9 @@ var Standfirst = (({
|
|
|
504
503
|
className: 'js-teaser-standfirst-link'
|
|
505
504
|
}
|
|
506
505
|
}), displayStandfirst)) : null;
|
|
507
|
-
}
|
|
506
|
+
};
|
|
508
507
|
|
|
509
|
-
var Title = (
|
|
508
|
+
var Title = ({
|
|
510
509
|
title,
|
|
511
510
|
altTitle,
|
|
512
511
|
headlineTesting,
|
|
@@ -538,9 +537,9 @@ var Title = (({
|
|
|
538
537
|
}), displayTitle), indicators && indicators.accessLevel === 'premium' ? h("span", null, ' ', h("span", {
|
|
539
538
|
className: premiumClass
|
|
540
539
|
}, "Premium"), h("span", {
|
|
541
|
-
className: "
|
|
540
|
+
className: "o3-visually-hidden"
|
|
542
541
|
}, "\xA0content")) : null);
|
|
543
|
-
}
|
|
542
|
+
};
|
|
544
543
|
|
|
545
544
|
// Re-format the data for use with o-video
|
|
546
545
|
const formatData = props => JSON.stringify({
|
|
@@ -570,13 +569,13 @@ const Embed = props => {
|
|
|
570
569
|
"data-o-video-systemcode": props.systemCode
|
|
571
570
|
}));
|
|
572
571
|
};
|
|
573
|
-
var Video =
|
|
572
|
+
var Video = props => h("div", {
|
|
574
573
|
className: "o-teaser__video"
|
|
575
574
|
}, h("div", {
|
|
576
575
|
className: "o--if-js"
|
|
577
576
|
}, h(Embed, props)), h("div", {
|
|
578
577
|
className: "o--if-no-js"
|
|
579
|
-
}, h(Image, props)))
|
|
578
|
+
}, h(Image, props)));
|
|
580
579
|
|
|
581
580
|
const PromotionalContent = ({
|
|
582
581
|
promotionalContent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/x-teaser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "This module provides templates for use with o-teaser. Teasers are used to present content.",
|
|
5
5
|
"source": "src/Teaser.jsx",
|
|
6
6
|
"main": "dist/Teaser.cjs.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@financial-times/x-engine": "^
|
|
20
|
+
"@financial-times/x-engine": "^15.0.0",
|
|
21
21
|
"date-fns": "^2.30.0",
|
|
22
22
|
"dateformat": "^3.0.3"
|
|
23
23
|
},
|
package/src/Title.jsx
CHANGED
|
@@ -23,14 +23,15 @@ export default ({ title, altTitle, headlineTesting, relativeUrl, url, indicators
|
|
|
23
23
|
'data-trackable-context-story-link': 'heading-link',
|
|
24
24
|
className: 'js-teaser-heading-link',
|
|
25
25
|
'aria-label': ariaLabel
|
|
26
|
-
}}
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
27
28
|
{displayTitle}
|
|
28
29
|
</Link>
|
|
29
30
|
{indicators && indicators.accessLevel === 'premium' ? (
|
|
30
31
|
<span>
|
|
31
32
|
{' '}
|
|
32
33
|
<span className={premiumClass}>Premium</span>
|
|
33
|
-
<span className="
|
|
34
|
+
<span className="o3-visually-hidden"> content</span>
|
|
34
35
|
</span>
|
|
35
36
|
) : null}
|
|
36
37
|
</div>
|
package/storybook/index.jsx
CHANGED