@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 CHANGED
@@ -36,6 +36,7 @@ export interface Features {
36
36
  showVideo?: boolean
37
37
  showRelatedLinks?: boolean
38
38
  showCustomSlot?: boolean
39
+ showPromotionalContent?: boolean
39
40
  }
40
41
 
41
42
  export interface General {
@@ -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;
@@ -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;
@@ -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.6.5",
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.6.5",
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
  ![screenshot of a teaser with features highlighted](https://user-images.githubusercontent.com/271645/38372758-7b55beac-38e7-11e8-9529-6286f384b7ce.png)
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 | Type | Notes |
111
- | ------------------ | ------- | --------------------------------------- |
112
- | `showMeta` | Boolean |
113
- | `showTitle` | Boolean |
114
- | `showStandfirst` | Boolean |
115
- | `showStatus` | Boolean |
116
- | `showImage` | Boolean |
117
- | `showHeadshot` | Boolean | Takes precedence over image |
118
- | `showVideo` | Boolean | Takes precedence over image or headshot |
119
- | `showGuidance` | Boolean | Show video captions guidance |
120
- | `showRelatedLinks` | Boolean |
121
- | `showCustomSlot` | Boolean |
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
 
@@ -0,0 +1,7 @@
1
+ import { h } from '@financial-times/x-engine'
2
+
3
+ const PromotionalContent = ({ promotionalContent }) => (
4
+ <div className="o-teaser__promotional-content">{promotionalContent}</div>
5
+ )
6
+
7
+ export default PromotionalContent
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>
@@ -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) {