@financial-times/x-teaser 15.1.3 → 16.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 CHANGED
@@ -30,6 +30,7 @@ export interface Features {
30
30
  showMeta?: boolean
31
31
  showTitle?: boolean
32
32
  showStandfirst?: boolean
33
+ showPremiumLabel?: boolean
33
34
  showStatus?: boolean
34
35
  showImage?: boolean
35
36
  showHeadshot?: boolean
@@ -472,17 +472,33 @@ var AlwaysShowTimestamp = props => {
472
472
  }
473
473
  };
474
474
 
475
+ function PremiumLabel() {
476
+ return xEngine.h("div", {
477
+ className: "x-teaser__premium-label"
478
+ }, xEngine.h("span", {
479
+ className: "o-labels o-labels--premium o-labels--content-premium"
480
+ }, "Premium"), xEngine.h("span", {
481
+ className: "o3-visually-hidden"
482
+ }, "\xA0content"));
483
+ }
484
+
475
485
  var Status = props => {
476
- if (props.status) {
477
- return xEngine.h(LiveBlogStatus, props);
486
+ var _props$indicators;
487
+ if (props.showPremiumLabel && (props === null || props === void 0 || (_props$indicators = props.indicators) === null || _props$indicators === void 0 ? void 0 : _props$indicators.accessLevel) === 'premium') {
488
+ return xEngine.h(PremiumLabel, props);
478
489
  }
479
- if (props.publishedDate) {
480
- if (props.useRelativeTimeIfToday) {
481
- return xEngine.h(AlwaysShowTimestamp, props);
482
- } else if (props.useRelativeTime) {
483
- return xEngine.h(RelativeTime, props);
484
- } else {
485
- return xEngine.h(TimeStamp, props);
490
+ if (props.showStatus) {
491
+ if (props.status) {
492
+ return xEngine.h(LiveBlogStatus, props);
493
+ }
494
+ if (props.publishedDate) {
495
+ if (props.useRelativeTimeIfToday) {
496
+ return xEngine.h(AlwaysShowTimestamp, props);
497
+ } else if (props.useRelativeTime) {
498
+ return xEngine.h(RelativeTime, props);
499
+ } else {
500
+ return xEngine.h(TimeStamp, props);
501
+ }
486
502
  }
487
503
  }
488
504
  return null;
@@ -517,13 +533,10 @@ var Title = ({
517
533
  headlineTesting,
518
534
  relativeUrl,
519
535
  url,
520
- indicators,
521
536
  ...props
522
537
  }) => {
523
538
  const displayTitle = headlineTesting && altTitle ? altTitle : title;
524
539
  const displayUrl = relativeUrl || url;
525
- // o-labels--premium left for backwards compatibility for o-labels v3
526
- const premiumClass = 'o-labels o-labels--premium o-labels--content-premium';
527
540
  let ariaLabel;
528
541
  if (props.type === 'video') {
529
542
  ariaLabel = `Watch video ${displayTitle}`;
@@ -540,11 +553,7 @@ var Title = ({
540
553
  className: 'js-teaser-heading-link',
541
554
  'aria-label': ariaLabel
542
555
  }
543
- }), displayTitle), indicators && indicators.accessLevel === 'premium' ? xEngine.h("span", null, ' ', xEngine.h("span", {
544
- className: premiumClass
545
- }, "Premium"), xEngine.h("span", {
546
- className: "o3-visually-hidden"
547
- }, "\xA0content")) : null);
556
+ }), displayTitle));
548
557
  };
549
558
 
550
559
  // Re-format the data for use with o-video
@@ -594,6 +603,7 @@ const Small = {
594
603
  useRelativeTime: true,
595
604
  showMeta: true,
596
605
  showTitle: true,
606
+ showPremiumLabel: true,
597
607
  showStatus: true
598
608
  };
599
609
  const SmallHeavy = {
@@ -602,6 +612,7 @@ const SmallHeavy = {
602
612
  showMeta: true,
603
613
  showTitle: true,
604
614
  showStandfirst: true,
615
+ showPremiumLabel: true,
605
616
  showStatus: true,
606
617
  showImage: true,
607
618
  imageSize: 'Small'
@@ -612,6 +623,7 @@ const Large = {
612
623
  showMeta: true,
613
624
  showTitle: true,
614
625
  showStandfirst: true,
626
+ showPremiumLabel: true,
615
627
  showStatus: true,
616
628
  showImage: true,
617
629
  imageSize: 'Medium'
@@ -621,6 +633,7 @@ const Hero = {
621
633
  useRelativeTime: true,
622
634
  showMeta: true,
623
635
  showTitle: true,
636
+ showPremiumLabel: true,
624
637
  showStatus: true,
625
638
  showImage: true,
626
639
  imageSize: 'Medium'
@@ -631,6 +644,7 @@ const HeroNarrow = {
631
644
  showMeta: true,
632
645
  showTitle: true,
633
646
  showStandfirst: true,
647
+ showPremiumLabel: true,
634
648
  showStatus: true
635
649
  };
636
650
  const HeroVideo = {
@@ -646,6 +660,7 @@ const HeroOverlay = {
646
660
  useRelativeTime: true,
647
661
  showMeta: true,
648
662
  showTitle: true,
663
+ showPremiumLabel: true,
649
664
  showStatus: true,
650
665
  showImage: true,
651
666
  imageSize: 'XL',
@@ -657,6 +672,7 @@ const TopStory = {
657
672
  showMeta: true,
658
673
  showTitle: true,
659
674
  showStandfirst: true,
675
+ showPremiumLabel: true,
660
676
  showStatus: true,
661
677
  showRelatedLinks: true
662
678
  };
@@ -666,6 +682,7 @@ const TopStoryLandscape = {
666
682
  showMeta: true,
667
683
  showTitle: true,
668
684
  showStandfirst: true,
685
+ showPremiumLabel: true,
669
686
  showStatus: true,
670
687
  showImage: true,
671
688
  imageSize: 'XL',
@@ -684,7 +701,7 @@ var presets = {
684
701
  TopStoryLandscape
685
702
  };
686
703
 
687
- 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);
704
+ 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, xEngine.h(Status, props), 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);
688
705
 
689
706
  exports.Container = Container;
690
707
  exports.Content = Content;
@@ -560,17 +560,33 @@ var AlwaysShowTimestamp = (function (props) {
560
560
  }
561
561
  });
562
562
 
563
+ function PremiumLabel() {
564
+ return xEngine.h("div", {
565
+ className: "x-teaser__premium-label"
566
+ }, xEngine.h("span", {
567
+ className: "o-labels o-labels--premium o-labels--content-premium"
568
+ }, "Premium"), xEngine.h("span", {
569
+ className: "o3-visually-hidden"
570
+ }, "\xA0content"));
571
+ }
572
+
563
573
  var Status = (function (props) {
564
- if (props.status) {
565
- return xEngine.h(LiveBlogStatus, props);
574
+ var _props$indicators;
575
+ if (props.showPremiumLabel && (props === null || props === void 0 || (_props$indicators = props.indicators) === null || _props$indicators === void 0 ? void 0 : _props$indicators.accessLevel) === 'premium') {
576
+ return xEngine.h(PremiumLabel, props);
566
577
  }
567
- if (props.publishedDate) {
568
- if (props.useRelativeTimeIfToday) {
569
- return xEngine.h(AlwaysShowTimestamp, props);
570
- } else if (props.useRelativeTime) {
571
- return xEngine.h(RelativeTime, props);
572
- } else {
573
- return xEngine.h(TimeStamp, props);
578
+ if (props.showStatus) {
579
+ if (props.status) {
580
+ return xEngine.h(LiveBlogStatus, props);
581
+ }
582
+ if (props.publishedDate) {
583
+ if (props.useRelativeTimeIfToday) {
584
+ return xEngine.h(AlwaysShowTimestamp, props);
585
+ } else if (props.useRelativeTime) {
586
+ return xEngine.h(RelativeTime, props);
587
+ } else {
588
+ return xEngine.h(TimeStamp, props);
589
+ }
574
590
  }
575
591
  }
576
592
  return null;
@@ -599,19 +615,16 @@ var Standfirst = (function (_ref) {
599
615
  }), displayStandfirst)) : null;
600
616
  });
601
617
 
602
- var _excluded$3 = ["title", "altTitle", "headlineTesting", "relativeUrl", "url", "indicators"];
618
+ var _excluded$3 = ["title", "altTitle", "headlineTesting", "relativeUrl", "url"];
603
619
  var Title = (function (_ref) {
604
620
  var title = _ref.title,
605
621
  altTitle = _ref.altTitle,
606
622
  headlineTesting = _ref.headlineTesting,
607
623
  relativeUrl = _ref.relativeUrl,
608
624
  url = _ref.url,
609
- indicators = _ref.indicators,
610
625
  props = _objectWithoutProperties(_ref, _excluded$3);
611
626
  var displayTitle = headlineTesting && altTitle ? altTitle : title;
612
627
  var displayUrl = relativeUrl || url;
613
- // o-labels--premium left for backwards compatibility for o-labels v3
614
- var premiumClass = 'o-labels o-labels--premium o-labels--content-premium';
615
628
  var ariaLabel;
616
629
  if (props.type === 'video') {
617
630
  ariaLabel = "Watch video ".concat(displayTitle);
@@ -628,11 +641,7 @@ var Title = (function (_ref) {
628
641
  className: 'js-teaser-heading-link',
629
642
  'aria-label': ariaLabel
630
643
  }
631
- }), displayTitle), indicators && indicators.accessLevel === 'premium' ? xEngine.h("span", null, ' ', xEngine.h("span", {
632
- className: premiumClass
633
- }, "Premium"), xEngine.h("span", {
634
- className: "o3-visually-hidden"
635
- }, "\xA0content")) : null);
644
+ }), displayTitle));
636
645
  });
637
646
 
638
647
  // Re-format the data for use with o-video
@@ -687,6 +696,7 @@ var Small = {
687
696
  useRelativeTime: true,
688
697
  showMeta: true,
689
698
  showTitle: true,
699
+ showPremiumLabel: true,
690
700
  showStatus: true
691
701
  };
692
702
  var SmallHeavy = {
@@ -695,6 +705,7 @@ var SmallHeavy = {
695
705
  showMeta: true,
696
706
  showTitle: true,
697
707
  showStandfirst: true,
708
+ showPremiumLabel: true,
698
709
  showStatus: true,
699
710
  showImage: true,
700
711
  imageSize: 'Small'
@@ -705,6 +716,7 @@ var Large = {
705
716
  showMeta: true,
706
717
  showTitle: true,
707
718
  showStandfirst: true,
719
+ showPremiumLabel: true,
708
720
  showStatus: true,
709
721
  showImage: true,
710
722
  imageSize: 'Medium'
@@ -714,6 +726,7 @@ var Hero = {
714
726
  useRelativeTime: true,
715
727
  showMeta: true,
716
728
  showTitle: true,
729
+ showPremiumLabel: true,
717
730
  showStatus: true,
718
731
  showImage: true,
719
732
  imageSize: 'Medium'
@@ -724,6 +737,7 @@ var HeroNarrow = {
724
737
  showMeta: true,
725
738
  showTitle: true,
726
739
  showStandfirst: true,
740
+ showPremiumLabel: true,
727
741
  showStatus: true
728
742
  };
729
743
  var HeroVideo = {
@@ -739,6 +753,7 @@ var HeroOverlay = {
739
753
  useRelativeTime: true,
740
754
  showMeta: true,
741
755
  showTitle: true,
756
+ showPremiumLabel: true,
742
757
  showStatus: true,
743
758
  showImage: true,
744
759
  imageSize: 'XL',
@@ -750,6 +765,7 @@ var TopStory = {
750
765
  showMeta: true,
751
766
  showTitle: true,
752
767
  showStandfirst: true,
768
+ showPremiumLabel: true,
753
769
  showStatus: true,
754
770
  showRelatedLinks: true
755
771
  };
@@ -759,6 +775,7 @@ var TopStoryLandscape = {
759
775
  showMeta: true,
760
776
  showTitle: true,
761
777
  showStandfirst: true,
778
+ showPremiumLabel: true,
762
779
  showStatus: true,
763
780
  showImage: true,
764
781
  imageSize: 'XL',
@@ -778,7 +795,7 @@ var presets = {
778
795
  };
779
796
 
780
797
  var Teaser = function Teaser(props) {
781
- 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);
798
+ 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, xEngine.h(Status, props), 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);
782
799
  };
783
800
 
784
801
  exports.Container = Container;
@@ -466,17 +466,33 @@ var AlwaysShowTimestamp = props => {
466
466
  }
467
467
  };
468
468
 
469
+ function PremiumLabel() {
470
+ return h("div", {
471
+ className: "x-teaser__premium-label"
472
+ }, h("span", {
473
+ className: "o-labels o-labels--premium o-labels--content-premium"
474
+ }, "Premium"), h("span", {
475
+ className: "o3-visually-hidden"
476
+ }, "\xA0content"));
477
+ }
478
+
469
479
  var Status = props => {
470
- if (props.status) {
471
- return h(LiveBlogStatus, props);
480
+ var _props$indicators;
481
+ if (props.showPremiumLabel && (props === null || props === void 0 || (_props$indicators = props.indicators) === null || _props$indicators === void 0 ? void 0 : _props$indicators.accessLevel) === 'premium') {
482
+ return h(PremiumLabel, props);
472
483
  }
473
- if (props.publishedDate) {
474
- if (props.useRelativeTimeIfToday) {
475
- return h(AlwaysShowTimestamp, props);
476
- } else if (props.useRelativeTime) {
477
- return h(RelativeTime, props);
478
- } else {
479
- return h(TimeStamp, props);
484
+ if (props.showStatus) {
485
+ if (props.status) {
486
+ return h(LiveBlogStatus, props);
487
+ }
488
+ if (props.publishedDate) {
489
+ if (props.useRelativeTimeIfToday) {
490
+ return h(AlwaysShowTimestamp, props);
491
+ } else if (props.useRelativeTime) {
492
+ return h(RelativeTime, props);
493
+ } else {
494
+ return h(TimeStamp, props);
495
+ }
480
496
  }
481
497
  }
482
498
  return null;
@@ -511,13 +527,10 @@ var Title = ({
511
527
  headlineTesting,
512
528
  relativeUrl,
513
529
  url,
514
- indicators,
515
530
  ...props
516
531
  }) => {
517
532
  const displayTitle = headlineTesting && altTitle ? altTitle : title;
518
533
  const displayUrl = relativeUrl || url;
519
- // o-labels--premium left for backwards compatibility for o-labels v3
520
- const premiumClass = 'o-labels o-labels--premium o-labels--content-premium';
521
534
  let ariaLabel;
522
535
  if (props.type === 'video') {
523
536
  ariaLabel = `Watch video ${displayTitle}`;
@@ -534,11 +547,7 @@ var Title = ({
534
547
  className: 'js-teaser-heading-link',
535
548
  'aria-label': ariaLabel
536
549
  }
537
- }), displayTitle), indicators && indicators.accessLevel === 'premium' ? h("span", null, ' ', h("span", {
538
- className: premiumClass
539
- }, "Premium"), h("span", {
540
- className: "o3-visually-hidden"
541
- }, "\xA0content")) : null);
550
+ }), displayTitle));
542
551
  };
543
552
 
544
553
  // Re-format the data for use with o-video
@@ -588,6 +597,7 @@ const Small = {
588
597
  useRelativeTime: true,
589
598
  showMeta: true,
590
599
  showTitle: true,
600
+ showPremiumLabel: true,
591
601
  showStatus: true
592
602
  };
593
603
  const SmallHeavy = {
@@ -596,6 +606,7 @@ const SmallHeavy = {
596
606
  showMeta: true,
597
607
  showTitle: true,
598
608
  showStandfirst: true,
609
+ showPremiumLabel: true,
599
610
  showStatus: true,
600
611
  showImage: true,
601
612
  imageSize: 'Small'
@@ -606,6 +617,7 @@ const Large = {
606
617
  showMeta: true,
607
618
  showTitle: true,
608
619
  showStandfirst: true,
620
+ showPremiumLabel: true,
609
621
  showStatus: true,
610
622
  showImage: true,
611
623
  imageSize: 'Medium'
@@ -615,6 +627,7 @@ const Hero = {
615
627
  useRelativeTime: true,
616
628
  showMeta: true,
617
629
  showTitle: true,
630
+ showPremiumLabel: true,
618
631
  showStatus: true,
619
632
  showImage: true,
620
633
  imageSize: 'Medium'
@@ -625,6 +638,7 @@ const HeroNarrow = {
625
638
  showMeta: true,
626
639
  showTitle: true,
627
640
  showStandfirst: true,
641
+ showPremiumLabel: true,
628
642
  showStatus: true
629
643
  };
630
644
  const HeroVideo = {
@@ -640,6 +654,7 @@ const HeroOverlay = {
640
654
  useRelativeTime: true,
641
655
  showMeta: true,
642
656
  showTitle: true,
657
+ showPremiumLabel: true,
643
658
  showStatus: true,
644
659
  showImage: true,
645
660
  imageSize: 'XL',
@@ -651,6 +666,7 @@ const TopStory = {
651
666
  showMeta: true,
652
667
  showTitle: true,
653
668
  showStandfirst: true,
669
+ showPremiumLabel: true,
654
670
  showStatus: true,
655
671
  showRelatedLinks: true
656
672
  };
@@ -660,6 +676,7 @@ const TopStoryLandscape = {
660
676
  showMeta: true,
661
677
  showTitle: true,
662
678
  showStandfirst: true,
679
+ showPremiumLabel: true,
663
680
  showStatus: true,
664
681
  showImage: true,
665
682
  imageSize: 'XL',
@@ -678,6 +695,6 @@ var presets = {
678
695
  TopStoryLandscape
679
696
  };
680
697
 
681
- 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);
698
+ 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, h(Status, props), 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);
682
699
 
683
700
  export { Container, Content, CustomSlot, Headshot, Image, Meta, RelatedLinks, Standfirst, Status, Teaser, Title, Video, presets };
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@financial-times/x-teaser",
3
- "version": "15.1.3",
3
+ "version": "16.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",
7
7
  "module": "dist/Teaser.esm.js",
8
8
  "browser": "dist/Teaser.es5.js",
9
+ "style": "src/Teaser.scss",
9
10
  "types": "Props.d.ts",
10
11
  "scripts": {
11
12
  "build": "node rollup.js",
@@ -17,7 +18,7 @@
17
18
  "author": "",
18
19
  "license": "ISC",
19
20
  "dependencies": {
20
- "@financial-times/x-engine": "^15.1.3",
21
+ "@financial-times/x-engine": "^16.0.0",
21
22
  "date-fns": "^2.30.0",
22
23
  "dateformat": "^3.0.3"
23
24
  },
package/readme.md CHANGED
@@ -113,6 +113,7 @@ As covered in the [features](#features) documentation the teaser properties, or
113
113
  | `showMeta` | Boolean |
114
114
  | `showTitle` | Boolean |
115
115
  | `showStandfirst` | Boolean |
116
+ | `showPremiumLabel` | Boolean |
116
117
  | `showStatus` | Boolean |
117
118
  | `showImage` | Boolean |
118
119
  | `showHeadshot` | Boolean | Takes precedence over image |
@@ -0,0 +1,10 @@
1
+ import { h } from '@financial-times/x-engine'
2
+
3
+ export default function PremiumLabel() {
4
+ return (
5
+ <div className="x-teaser__premium-label">
6
+ <span className="o-labels o-labels--premium o-labels--content-premium">Premium</span>
7
+ <span className="o3-visually-hidden">&nbsp;content</span>
8
+ </div>
9
+ )
10
+ }
package/src/Status.jsx CHANGED
@@ -3,19 +3,26 @@ import TimeStamp from './TimeStamp'
3
3
  import RelativeTime from './RelativeTime'
4
4
  import LiveBlogStatus from './LiveBlogStatus'
5
5
  import AlwaysShowTimestamp from './AlwaysShowTimestamp'
6
+ import PremiumLabel from './PremiumLabel'
6
7
 
7
8
  export default (props) => {
8
- if (props.status) {
9
- return <LiveBlogStatus {...props} />
9
+ if (props.showPremiumLabel && props?.indicators?.accessLevel === 'premium') {
10
+ return <PremiumLabel {...props} />
10
11
  }
11
12
 
12
- if (props.publishedDate) {
13
- if (props.useRelativeTimeIfToday) {
14
- return <AlwaysShowTimestamp {...props} />
15
- } else if (props.useRelativeTime) {
16
- return <RelativeTime {...props} />
17
- } else {
18
- return <TimeStamp {...props} />
13
+ if (props.showStatus) {
14
+ if (props.status) {
15
+ return <LiveBlogStatus {...props} />
16
+ }
17
+
18
+ if (props.publishedDate) {
19
+ if (props.useRelativeTimeIfToday) {
20
+ return <AlwaysShowTimestamp {...props} />
21
+ } else if (props.useRelativeTime) {
22
+ return <RelativeTime {...props} />
23
+ } else {
24
+ return <TimeStamp {...props} />
25
+ }
19
26
  }
20
27
  }
21
28
 
package/src/Teaser.jsx CHANGED
@@ -21,7 +21,7 @@ const Teaser = (props) => (
21
21
  {media(props) === 'video' ? <Video {...props} /> : null}
22
22
  {props.showTitle ? <Title {...props} /> : null}
23
23
  {props.showStandfirst ? <Standfirst {...props} /> : null}
24
- {props.showStatus ? <Status {...props} /> : null}
24
+ <Status {...props} />
25
25
  {props.showCustomSlot ? <CustomSlot {...props} /> : null}
26
26
  {media(props) === 'headshot' ? <Headshot {...props} /> : null}
27
27
  </Content>
@@ -0,0 +1,8 @@
1
+ @import '@financial-times/o3-foundation/css/core.css';
2
+
3
+ // Theses styles copy the spacing from o-teaser__timestamp
4
+ // as the premium label is replacing it
5
+ .x-teaser__premium-label {
6
+ margin-top: auto;
7
+ padding-top: var(--o3-spacing-2xs);
8
+ }
package/src/Title.jsx CHANGED
@@ -1,11 +1,9 @@
1
1
  import { h } from '@financial-times/x-engine'
2
2
  import Link from './Link'
3
3
 
4
- export default ({ title, altTitle, headlineTesting, relativeUrl, url, indicators, ...props }) => {
4
+ export default ({ title, altTitle, headlineTesting, relativeUrl, url, ...props }) => {
5
5
  const displayTitle = headlineTesting && altTitle ? altTitle : title
6
6
  const displayUrl = relativeUrl || url
7
- // o-labels--premium left for backwards compatibility for o-labels v3
8
- const premiumClass = 'o-labels o-labels--premium o-labels--content-premium'
9
7
  let ariaLabel
10
8
  if (props.type === 'video') {
11
9
  ariaLabel = `Watch video ${displayTitle}`
@@ -27,13 +25,6 @@ export default ({ title, altTitle, headlineTesting, relativeUrl, url, indicators
27
25
  >
28
26
  {displayTitle}
29
27
  </Link>
30
- {indicators && indicators.accessLevel === 'premium' ? (
31
- <span>
32
- {' '}
33
- <span className={premiumClass}>Premium</span>
34
- <span className="o3-visually-hidden">&nbsp;content</span>
35
- </span>
36
- ) : null}
37
28
  </div>
38
29
  )
39
30
  }
@@ -5,6 +5,7 @@ const Small = {
5
5
  useRelativeTime: true,
6
6
  showMeta: true,
7
7
  showTitle: true,
8
+ showPremiumLabel: true,
8
9
  showStatus: true
9
10
  }
10
11
 
@@ -14,6 +15,7 @@ const SmallHeavy = {
14
15
  showMeta: true,
15
16
  showTitle: true,
16
17
  showStandfirst: true,
18
+ showPremiumLabel: true,
17
19
  showStatus: true,
18
20
  showImage: true,
19
21
  imageSize: 'Small'
@@ -25,6 +27,7 @@ const Large = {
25
27
  showMeta: true,
26
28
  showTitle: true,
27
29
  showStandfirst: true,
30
+ showPremiumLabel: true,
28
31
  showStatus: true,
29
32
  showImage: true,
30
33
  imageSize: 'Medium'
@@ -35,6 +38,7 @@ const Hero = {
35
38
  useRelativeTime: true,
36
39
  showMeta: true,
37
40
  showTitle: true,
41
+ showPremiumLabel: true,
38
42
  showStatus: true,
39
43
  showImage: true,
40
44
  imageSize: 'Medium'
@@ -46,6 +50,7 @@ const HeroNarrow = {
46
50
  showMeta: true,
47
51
  showTitle: true,
48
52
  showStandfirst: true,
53
+ showPremiumLabel: true,
49
54
  showStatus: true
50
55
  }
51
56
 
@@ -63,6 +68,7 @@ const HeroOverlay = {
63
68
  useRelativeTime: true,
64
69
  showMeta: true,
65
70
  showTitle: true,
71
+ showPremiumLabel: true,
66
72
  showStatus: true,
67
73
  showImage: true,
68
74
  imageSize: 'XL',
@@ -75,6 +81,7 @@ const TopStory = {
75
81
  showMeta: true,
76
82
  showTitle: true,
77
83
  showStandfirst: true,
84
+ showPremiumLabel: true,
78
85
  showStatus: true,
79
86
  showRelatedLinks: true
80
87
  }
@@ -85,6 +92,7 @@ const TopStoryLandscape = {
85
92
  showMeta: true,
86
93
  showTitle: true,
87
94
  showStandfirst: true,
95
+ showPremiumLabel: true,
88
96
  showStatus: true,
89
97
  showImage: true,
90
98
  imageSize: 'XL',
@@ -2,11 +2,13 @@ import { Teaser } from '../src/Teaser'
2
2
  import React from 'react'
3
3
  import BuildService from '../../../.storybook/build-service'
4
4
 
5
+ import '../src/Teaser.scss'
6
+
5
7
  const dependencies = {
6
- 'o-date': '^5.0.0',
7
- 'o-labels': '^6.0.0',
8
- 'o-teaser': '^6.0.0',
9
- 'o-video': '^7.0.0'
8
+ 'o-date': '^5.3.0',
9
+ 'o-labels': '^7.0.1',
10
+ 'o-teaser': '^7.1.3',
11
+ 'o-video': '^8.0.0'
10
12
  }
11
13
 
12
14
  const { argTypes } = require('./argTypes')