@financial-times/x-teaser 14.6.5 → 14.7.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 +1 -0
- package/dist/Teaser.cjs.js +10 -1
- package/dist/Teaser.es5.js +11 -1
- package/dist/Teaser.esm.js +10 -1
- package/package.json +2 -2
- package/readme.md +14 -12
- package/src/PromotionaContent.jsx +7 -0
- package/src/Teaser.jsx +2 -0
- package/src/concerns/rules.js +4 -0
package/Props.d.ts
CHANGED
package/dist/Teaser.cjs.js
CHANGED
|
@@ -24,6 +24,9 @@ const rulesets = {
|
|
|
24
24
|
if (props.showImage && props.image && props.image.url) {
|
|
25
25
|
return 'image';
|
|
26
26
|
}
|
|
27
|
+
if (props.showPromotionalContent && props.promotionalContent) {
|
|
28
|
+
return 'promotionalContent';
|
|
29
|
+
}
|
|
27
30
|
},
|
|
28
31
|
theme: props => {
|
|
29
32
|
if (props.theme) {
|
|
@@ -577,6 +580,12 @@ var Video = (props => xEngine.h("div", {
|
|
|
577
580
|
className: "o--if-no-js"
|
|
578
581
|
}, xEngine.h(Image, props))));
|
|
579
582
|
|
|
583
|
+
const PromotionalContent = ({
|
|
584
|
+
promotionalContent
|
|
585
|
+
}) => xEngine.h("div", {
|
|
586
|
+
className: "o-teaser__promotional-content"
|
|
587
|
+
}, promotionalContent);
|
|
588
|
+
|
|
580
589
|
const Small = {
|
|
581
590
|
layout: Layouts.Small,
|
|
582
591
|
useRelativeTime: true,
|
|
@@ -672,7 +681,7 @@ var presets = {
|
|
|
672
681
|
TopStoryLandscape
|
|
673
682
|
};
|
|
674
683
|
|
|
675
|
-
const Teaser = props => xEngine.h(Container, props, xEngine.h(Content, null, props.showMeta ? xEngine.h(Meta, props) : null, media(props) === 'video' ? xEngine.h(Video, props) : null, props.showTitle ? xEngine.h(Title, props) : null, props.showStandfirst ? xEngine.h(Standfirst, props) : null, props.showStatus ? xEngine.h(Status, props) : null, props.showCustomSlot ? xEngine.h(CustomSlot, props) : null, media(props) === 'headshot' ? xEngine.h(Headshot, props) : null), media(props) === 'image' ? xEngine.h(Image, props) : null, props.showRelatedLinks ? xEngine.h(RelatedLinks, props) : null);
|
|
684
|
+
const Teaser = props => xEngine.h(Container, props, xEngine.h(Content, null, props.showMeta ? xEngine.h(Meta, props) : null, media(props) === 'video' ? xEngine.h(Video, props) : null, props.showTitle ? xEngine.h(Title, props) : null, props.showStandfirst ? xEngine.h(Standfirst, props) : null, props.showStatus ? xEngine.h(Status, props) : null, props.showCustomSlot ? xEngine.h(CustomSlot, props) : null, media(props) === 'headshot' ? xEngine.h(Headshot, props) : null), media(props) === 'promotionalContent' ? xEngine.h(PromotionalContent, props) : null, media(props) === 'image' ? xEngine.h(Image, props) : null, props.showRelatedLinks ? xEngine.h(RelatedLinks, props) : null);
|
|
676
685
|
|
|
677
686
|
exports.Container = Container;
|
|
678
687
|
exports.Content = Content;
|
package/dist/Teaser.es5.js
CHANGED
|
@@ -24,6 +24,9 @@ var rulesets = {
|
|
|
24
24
|
if (props.showImage && props.image && props.image.url) {
|
|
25
25
|
return 'image';
|
|
26
26
|
}
|
|
27
|
+
if (props.showPromotionalContent && props.promotionalContent) {
|
|
28
|
+
return 'promotionalContent';
|
|
29
|
+
}
|
|
27
30
|
},
|
|
28
31
|
theme: function theme(props) {
|
|
29
32
|
if (props.theme) {
|
|
@@ -669,6 +672,13 @@ var Video = (function (props) {
|
|
|
669
672
|
}, xEngine.h(Image, props)));
|
|
670
673
|
});
|
|
671
674
|
|
|
675
|
+
var PromotionalContent = function PromotionalContent(_ref) {
|
|
676
|
+
var promotionalContent = _ref.promotionalContent;
|
|
677
|
+
return xEngine.h("div", {
|
|
678
|
+
className: "o-teaser__promotional-content"
|
|
679
|
+
}, promotionalContent);
|
|
680
|
+
};
|
|
681
|
+
|
|
672
682
|
var Small = {
|
|
673
683
|
layout: Layouts.Small,
|
|
674
684
|
useRelativeTime: true,
|
|
@@ -765,7 +775,7 @@ var presets = {
|
|
|
765
775
|
};
|
|
766
776
|
|
|
767
777
|
var Teaser = function Teaser(props) {
|
|
768
|
-
return xEngine.h(Container, props, xEngine.h(Content, null, props.showMeta ? xEngine.h(Meta, props) : null, media(props) === 'video' ? xEngine.h(Video, props) : null, props.showTitle ? xEngine.h(Title, props) : null, props.showStandfirst ? xEngine.h(Standfirst, props) : null, props.showStatus ? xEngine.h(Status, props) : null, props.showCustomSlot ? xEngine.h(CustomSlot, props) : null, media(props) === 'headshot' ? xEngine.h(Headshot, props) : null), media(props) === 'image' ? xEngine.h(Image, props) : null, props.showRelatedLinks ? xEngine.h(RelatedLinks, props) : null);
|
|
778
|
+
return xEngine.h(Container, props, xEngine.h(Content, null, props.showMeta ? xEngine.h(Meta, props) : null, media(props) === 'video' ? xEngine.h(Video, props) : null, props.showTitle ? xEngine.h(Title, props) : null, props.showStandfirst ? xEngine.h(Standfirst, props) : null, props.showStatus ? xEngine.h(Status, props) : null, props.showCustomSlot ? xEngine.h(CustomSlot, props) : null, media(props) === 'headshot' ? xEngine.h(Headshot, props) : null), media(props) === 'promotionalContent' ? xEngine.h(PromotionalContent, props) : null, media(props) === 'image' ? xEngine.h(Image, props) : null, props.showRelatedLinks ? xEngine.h(RelatedLinks, props) : null);
|
|
769
779
|
};
|
|
770
780
|
|
|
771
781
|
exports.Container = Container;
|
package/dist/Teaser.esm.js
CHANGED
|
@@ -18,6 +18,9 @@ const rulesets = {
|
|
|
18
18
|
if (props.showImage && props.image && props.image.url) {
|
|
19
19
|
return 'image';
|
|
20
20
|
}
|
|
21
|
+
if (props.showPromotionalContent && props.promotionalContent) {
|
|
22
|
+
return 'promotionalContent';
|
|
23
|
+
}
|
|
21
24
|
},
|
|
22
25
|
theme: props => {
|
|
23
26
|
if (props.theme) {
|
|
@@ -571,6 +574,12 @@ var Video = (props => h("div", {
|
|
|
571
574
|
className: "o--if-no-js"
|
|
572
575
|
}, h(Image, props))));
|
|
573
576
|
|
|
577
|
+
const PromotionalContent = ({
|
|
578
|
+
promotionalContent
|
|
579
|
+
}) => h("div", {
|
|
580
|
+
className: "o-teaser__promotional-content"
|
|
581
|
+
}, promotionalContent);
|
|
582
|
+
|
|
574
583
|
const Small = {
|
|
575
584
|
layout: Layouts.Small,
|
|
576
585
|
useRelativeTime: true,
|
|
@@ -666,6 +675,6 @@ var presets = {
|
|
|
666
675
|
TopStoryLandscape
|
|
667
676
|
};
|
|
668
677
|
|
|
669
|
-
const Teaser = props => h(Container, props, h(Content, null, props.showMeta ? h(Meta, props) : null, media(props) === 'video' ? h(Video, props) : null, props.showTitle ? h(Title, props) : null, props.showStandfirst ? h(Standfirst, props) : null, props.showStatus ? h(Status, props) : null, props.showCustomSlot ? h(CustomSlot, props) : null, media(props) === 'headshot' ? h(Headshot, props) : null), media(props) === 'image' ? h(Image, props) : null, props.showRelatedLinks ? h(RelatedLinks, props) : null);
|
|
678
|
+
const Teaser = props => h(Container, props, h(Content, null, props.showMeta ? h(Meta, props) : null, media(props) === 'video' ? h(Video, props) : null, props.showTitle ? h(Title, props) : null, props.showStandfirst ? h(Standfirst, props) : null, props.showStatus ? h(Status, props) : null, props.showCustomSlot ? h(CustomSlot, props) : null, media(props) === 'headshot' ? h(Headshot, props) : null), media(props) === 'promotionalContent' ? h(PromotionalContent, props) : null, media(props) === 'image' ? h(Image, props) : null, props.showRelatedLinks ? h(RelatedLinks, props) : null);
|
|
670
679
|
|
|
671
680
|
export { Container, Content, CustomSlot, Headshot, Image, Meta, RelatedLinks, Standfirst, Status, Teaser, Title, Video, presets };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/x-teaser",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.7.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": "^14.
|
|
20
|
+
"@financial-times/x-engine": "^14.7.0",
|
|
21
21
|
"date-fns": "^2.30.0",
|
|
22
22
|
"dateformat": "^3.0.3"
|
|
23
23
|
},
|
package/readme.md
CHANGED
|
@@ -29,6 +29,7 @@ Because teasers are very complex with thousands of possible permutations the com
|
|
|
29
29
|
- Headshot, an image of the content author when content is published in their column
|
|
30
30
|
- Video, for video content able to play videos in-situ
|
|
31
31
|
- Custom slot, a free slot to insert custom components or markup
|
|
32
|
+
- Promotional content, a slot to insert promotional content of different types such as but not limited to: clips, interactive graphics, etc.
|
|
32
33
|
|
|
33
34
|

|
|
34
35
|
|
|
@@ -107,18 +108,19 @@ As covered in the [features](#features) documentation the teaser properties, or
|
|
|
107
108
|
|
|
108
109
|
#### Feature Props
|
|
109
110
|
|
|
110
|
-
| Feature
|
|
111
|
-
|
|
|
112
|
-
| `showMeta`
|
|
113
|
-
| `showTitle`
|
|
114
|
-
| `showStandfirst`
|
|
115
|
-
| `showStatus`
|
|
116
|
-
| `showImage`
|
|
117
|
-
| `showHeadshot`
|
|
118
|
-
| `showVideo`
|
|
119
|
-
| `showGuidance`
|
|
120
|
-
| `showRelatedLinks`
|
|
121
|
-
| `showCustomSlot`
|
|
111
|
+
| Feature | Type | Notes |
|
|
112
|
+
| ------------------------ | ------- | --------------------------------------- |
|
|
113
|
+
| `showMeta` | Boolean |
|
|
114
|
+
| `showTitle` | Boolean |
|
|
115
|
+
| `showStandfirst` | Boolean |
|
|
116
|
+
| `showStatus` | Boolean |
|
|
117
|
+
| `showImage` | Boolean |
|
|
118
|
+
| `showHeadshot` | Boolean | Takes precedence over image |
|
|
119
|
+
| `showVideo` | Boolean | Takes precedence over image or headshot |
|
|
120
|
+
| `showGuidance` | Boolean | Show video captions guidance |
|
|
121
|
+
| `showRelatedLinks` | Boolean |
|
|
122
|
+
| `showCustomSlot` | Boolean |
|
|
123
|
+
| `showPromotionalContent` | Boolean |
|
|
122
124
|
|
|
123
125
|
#### General Props
|
|
124
126
|
|
package/src/Teaser.jsx
CHANGED
|
@@ -10,6 +10,7 @@ import Status from './Status'
|
|
|
10
10
|
import Standfirst from './Standfirst'
|
|
11
11
|
import Title from './Title'
|
|
12
12
|
import Video from './Video'
|
|
13
|
+
import PromotionalContent from './PromotionaContent'
|
|
13
14
|
import { media } from './concerns/rules'
|
|
14
15
|
import presets from './concerns/presets'
|
|
15
16
|
|
|
@@ -24,6 +25,7 @@ const Teaser = (props) => (
|
|
|
24
25
|
{props.showCustomSlot ? <CustomSlot {...props} /> : null}
|
|
25
26
|
{media(props) === 'headshot' ? <Headshot {...props} /> : null}
|
|
26
27
|
</Content>
|
|
28
|
+
{media(props) === 'promotionalContent' ? <PromotionalContent {...props} /> : null}
|
|
27
29
|
{media(props) === 'image' ? <Image {...props} /> : null}
|
|
28
30
|
{props.showRelatedLinks ? <RelatedLinks {...props} /> : null}
|
|
29
31
|
</Container>
|
package/src/concerns/rules.js
CHANGED
|
@@ -16,6 +16,10 @@ const rulesets = {
|
|
|
16
16
|
if (props.showImage && props.image && props.image.url) {
|
|
17
17
|
return 'image'
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
if (props.showPromotionalContent && props.promotionalContent) {
|
|
21
|
+
return 'promotionalContent'
|
|
22
|
+
}
|
|
19
23
|
},
|
|
20
24
|
theme: (props) => {
|
|
21
25
|
if (props.theme) {
|