@financial-times/x-teaser 17.0.5 → 18.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/Props.d.ts +4 -0
- package/dist/Teaser.cjs.js +9 -9
- package/dist/Teaser.es5.js +10 -9
- package/dist/Teaser.esm.js +9 -9
- package/package.json +2 -2
- package/readme.md +6 -0
- package/src/LiveBlogStatus.jsx +11 -8
- package/src/concerns/rules.js +1 -1
- package/storybook/argTypes.js +5 -1
- package/storybook/article.js +3 -1
- package/storybook/index.jsx +3 -3
package/Props.d.ts
CHANGED
package/dist/Teaser.cjs.js
CHANGED
|
@@ -32,7 +32,7 @@ const rulesets = {
|
|
|
32
32
|
if (props.theme) {
|
|
33
33
|
return props.theme;
|
|
34
34
|
}
|
|
35
|
-
if (props.status === 'inprogress') {
|
|
35
|
+
if (props.status === 'inprogress' && props.allowLiveTeaserStyling) {
|
|
36
36
|
return 'live';
|
|
37
37
|
}
|
|
38
38
|
if (props.indicators && props.indicators.isOpinion) {
|
|
@@ -437,23 +437,23 @@ var RelativeTime = ({
|
|
|
437
437
|
}, displayTime(relativeDate))) : null;
|
|
438
438
|
};
|
|
439
439
|
|
|
440
|
-
const LiveBlogLabels = {
|
|
441
|
-
inprogress: 'Live',
|
|
442
|
-
comingsoon: 'Coming Soon',
|
|
443
|
-
closed: ''
|
|
444
|
-
};
|
|
445
440
|
const LiveBlogModifiers = {
|
|
446
441
|
inprogress: 'live',
|
|
447
442
|
comingsoon: 'pending',
|
|
448
443
|
closed: 'closed'
|
|
449
444
|
};
|
|
450
445
|
var LiveBlogStatus = ({
|
|
451
|
-
status
|
|
446
|
+
status,
|
|
447
|
+
allowLiveTeaserStyling = false
|
|
452
448
|
}) => status && status !== 'closed' ? xEngine.h("div", {
|
|
453
449
|
className: `o-teaser__timestamp o-teaser__timestamp--${LiveBlogModifiers[status]}`
|
|
454
|
-
}, xEngine.h("span", {
|
|
450
|
+
}, status === 'comingsoon' && xEngine.h("span", {
|
|
455
451
|
className: "o-teaser__timestamp-prefix"
|
|
456
|
-
}, `
|
|
452
|
+
}, ` Coming Soon `), status === 'inprogress' && xEngine.h("span", {
|
|
453
|
+
className: `o-labels-indicator o-labels-indicator--live ${allowLiveTeaserStyling ? null : 'o-labels-indicator--badge'}`
|
|
454
|
+
}, xEngine.h("span", {
|
|
455
|
+
className: "o-labels-indicator__status"
|
|
456
|
+
}, ` Live `))) : null;
|
|
457
457
|
|
|
458
458
|
/**
|
|
459
459
|
* Timestamp shown always, the default 4h limit does not apply here
|
package/dist/Teaser.es5.js
CHANGED
|
@@ -32,7 +32,7 @@ var rulesets = {
|
|
|
32
32
|
if (props.theme) {
|
|
33
33
|
return props.theme;
|
|
34
34
|
}
|
|
35
|
-
if (props.status === 'inprogress') {
|
|
35
|
+
if (props.status === 'inprogress' && props.allowLiveTeaserStyling) {
|
|
36
36
|
return 'live';
|
|
37
37
|
}
|
|
38
38
|
if (props.indicators && props.indicators.isOpinion) {
|
|
@@ -524,23 +524,24 @@ var RelativeTime = (function (_ref) {
|
|
|
524
524
|
}, displayTime(relativeDate))) : null;
|
|
525
525
|
});
|
|
526
526
|
|
|
527
|
-
var LiveBlogLabels = {
|
|
528
|
-
inprogress: 'Live',
|
|
529
|
-
comingsoon: 'Coming Soon',
|
|
530
|
-
closed: ''
|
|
531
|
-
};
|
|
532
527
|
var LiveBlogModifiers = {
|
|
533
528
|
inprogress: 'live',
|
|
534
529
|
comingsoon: 'pending',
|
|
535
530
|
closed: 'closed'
|
|
536
531
|
};
|
|
537
532
|
var LiveBlogStatus = (function (_ref) {
|
|
538
|
-
var status = _ref.status
|
|
533
|
+
var status = _ref.status,
|
|
534
|
+
_ref$allowLiveTeaserS = _ref.allowLiveTeaserStyling,
|
|
535
|
+
allowLiveTeaserStyling = _ref$allowLiveTeaserS === void 0 ? false : _ref$allowLiveTeaserS;
|
|
539
536
|
return status && status !== 'closed' ? xEngine.h("div", {
|
|
540
537
|
className: "o-teaser__timestamp o-teaser__timestamp--".concat(LiveBlogModifiers[status])
|
|
541
|
-
}, xEngine.h("span", {
|
|
538
|
+
}, status === 'comingsoon' && xEngine.h("span", {
|
|
542
539
|
className: "o-teaser__timestamp-prefix"
|
|
543
|
-
}, " "
|
|
540
|
+
}, " Coming Soon "), status === 'inprogress' && xEngine.h("span", {
|
|
541
|
+
className: "o-labels-indicator o-labels-indicator--live ".concat(allowLiveTeaserStyling ? null : 'o-labels-indicator--badge')
|
|
542
|
+
}, xEngine.h("span", {
|
|
543
|
+
className: "o-labels-indicator__status"
|
|
544
|
+
}, " Live "))) : null;
|
|
544
545
|
});
|
|
545
546
|
|
|
546
547
|
/**
|
package/dist/Teaser.esm.js
CHANGED
|
@@ -26,7 +26,7 @@ const rulesets = {
|
|
|
26
26
|
if (props.theme) {
|
|
27
27
|
return props.theme;
|
|
28
28
|
}
|
|
29
|
-
if (props.status === 'inprogress') {
|
|
29
|
+
if (props.status === 'inprogress' && props.allowLiveTeaserStyling) {
|
|
30
30
|
return 'live';
|
|
31
31
|
}
|
|
32
32
|
if (props.indicators && props.indicators.isOpinion) {
|
|
@@ -431,23 +431,23 @@ var RelativeTime = ({
|
|
|
431
431
|
}, displayTime(relativeDate))) : null;
|
|
432
432
|
};
|
|
433
433
|
|
|
434
|
-
const LiveBlogLabels = {
|
|
435
|
-
inprogress: 'Live',
|
|
436
|
-
comingsoon: 'Coming Soon',
|
|
437
|
-
closed: ''
|
|
438
|
-
};
|
|
439
434
|
const LiveBlogModifiers = {
|
|
440
435
|
inprogress: 'live',
|
|
441
436
|
comingsoon: 'pending',
|
|
442
437
|
closed: 'closed'
|
|
443
438
|
};
|
|
444
439
|
var LiveBlogStatus = ({
|
|
445
|
-
status
|
|
440
|
+
status,
|
|
441
|
+
allowLiveTeaserStyling = false
|
|
446
442
|
}) => status && status !== 'closed' ? h("div", {
|
|
447
443
|
className: `o-teaser__timestamp o-teaser__timestamp--${LiveBlogModifiers[status]}`
|
|
448
|
-
}, h("span", {
|
|
444
|
+
}, status === 'comingsoon' && h("span", {
|
|
449
445
|
className: "o-teaser__timestamp-prefix"
|
|
450
|
-
}, `
|
|
446
|
+
}, ` Coming Soon `), status === 'inprogress' && h("span", {
|
|
447
|
+
className: `o-labels-indicator o-labels-indicator--live ${allowLiveTeaserStyling ? null : 'o-labels-indicator--badge'}`
|
|
448
|
+
}, h("span", {
|
|
449
|
+
className: "o-labels-indicator__status"
|
|
450
|
+
}, ` Live `))) : null;
|
|
451
451
|
|
|
452
452
|
/**
|
|
453
453
|
* Timestamp shown always, the default 4h limit does not apply here
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/x-teaser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.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",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"author": "",
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@financial-times/x-engine": "^
|
|
21
|
+
"@financial-times/x-engine": "^18.0.0",
|
|
22
22
|
"date-fns": "^2.30.0",
|
|
23
23
|
"dateformat": "^3.0.3"
|
|
24
24
|
},
|
package/readme.md
CHANGED
|
@@ -257,6 +257,12 @@ As covered in the [features](#features) documentation the teaser properties, or
|
|
|
257
257
|
| `isExclusive` | Boolean |
|
|
258
258
|
| `isScoop` | Boolean |
|
|
259
259
|
|
|
260
|
+
#### Special Styling Props
|
|
261
|
+
|
|
262
|
+
| Property | Type | Notes |
|
|
263
|
+
| ------------------------ | ------- | ------------------------------------------ |
|
|
264
|
+
| `allowLiveTeaserStyling` | Boolean | Apply `o-teaser--live` class to Container. :memo: *Consumers need to include the o-teaser styling in their applications too.* |
|
|
265
|
+
|
|
260
266
|
### Presets
|
|
261
267
|
|
|
262
268
|
Because there are so many options presets are available for the most commonly used configurations, these are:-
|
package/src/LiveBlogStatus.jsx
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { h } from '@financial-times/x-engine'
|
|
2
2
|
|
|
3
|
-
const LiveBlogLabels = {
|
|
4
|
-
inprogress: 'Live',
|
|
5
|
-
comingsoon: 'Coming Soon',
|
|
6
|
-
closed: ''
|
|
7
|
-
}
|
|
8
|
-
|
|
9
3
|
const LiveBlogModifiers = {
|
|
10
4
|
inprogress: 'live',
|
|
11
5
|
comingsoon: 'pending',
|
|
12
6
|
closed: 'closed'
|
|
13
7
|
}
|
|
14
8
|
|
|
15
|
-
export default ({ status }) =>
|
|
9
|
+
export default ({ status, allowLiveTeaserStyling = false }) =>
|
|
16
10
|
status && status !== 'closed' ? (
|
|
17
11
|
<div className={`o-teaser__timestamp o-teaser__timestamp--${LiveBlogModifiers[status]}`}>
|
|
18
|
-
<span className="o-teaser__timestamp-prefix">{`
|
|
12
|
+
{status === 'comingsoon' && <span className="o-teaser__timestamp-prefix">{` Coming Soon `}</span>}
|
|
13
|
+
{status === 'inprogress' && (
|
|
14
|
+
<span
|
|
15
|
+
className={`o-labels-indicator o-labels-indicator--live ${
|
|
16
|
+
allowLiveTeaserStyling ? null : 'o-labels-indicator--badge'
|
|
17
|
+
}`}
|
|
18
|
+
>
|
|
19
|
+
<span className="o-labels-indicator__status">{` Live `}</span>
|
|
20
|
+
</span>
|
|
21
|
+
)}
|
|
19
22
|
</div>
|
|
20
23
|
) : null
|
package/src/concerns/rules.js
CHANGED
package/storybook/argTypes.js
CHANGED
|
@@ -47,5 +47,9 @@ exports.argTypes = {
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
publishedDate: { name: 'Published Date', control: { type: 'date' } },
|
|
50
|
-
firstPublishedDate: { name: 'First Published Date', control: { type: 'date' } }
|
|
50
|
+
firstPublishedDate: { name: 'First Published Date', control: { type: 'date' } },
|
|
51
|
+
allowLiveTeaserStyling: {
|
|
52
|
+
name: 'allowLiveTeaserStyling',
|
|
53
|
+
control: 'boolean'
|
|
54
|
+
}
|
|
51
55
|
}
|
package/storybook/article.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const { presets } = require('../')
|
|
2
2
|
|
|
3
|
-
exports.args = Object.assign(require('../__fixtures__/article.json'), presets.SmallHeavy
|
|
3
|
+
exports.args = Object.assign(require('../__fixtures__/article.json'), presets.SmallHeavy, {
|
|
4
|
+
allowLiveTeaserStyling: false
|
|
5
|
+
})
|
|
4
6
|
|
|
5
7
|
// This reference is only required for hot module loading in development
|
|
6
8
|
// <https://webpack.js.org/concepts/hot-module-replacement/>
|
package/storybook/index.jsx
CHANGED
|
@@ -5,9 +5,9 @@ import BuildService from '../../../.storybook/build-service'
|
|
|
5
5
|
import '../src/Teaser.scss'
|
|
6
6
|
|
|
7
7
|
const dependencies = {
|
|
8
|
-
'o-date': '^
|
|
9
|
-
'o-labels': '^7.0
|
|
10
|
-
'o-teaser': '^
|
|
8
|
+
'o-date': '^7.0.1',
|
|
9
|
+
'o-labels': '^7.1.0',
|
|
10
|
+
'o-teaser': '^8.0.1',
|
|
11
11
|
'o-video': '^8.0.0'
|
|
12
12
|
}
|
|
13
13
|
|