@financial-times/x-teaser 19.0.1 → 20.0.0-beta.2
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 +18 -2
- package/__fixtures__/article.json +11 -0
- package/__fixtures__/content-package.json +11 -0
- package/__fixtures__/opinion.json +14 -0
- package/__fixtures__/package-item.json +11 -0
- package/__fixtures__/podcast.json +7 -0
- package/__fixtures__/top-story.json +11 -0
- package/__fixtures__/video.json +11 -0
- package/__tests__/__snapshots__/snapshots.test.js.snap +494 -148
- package/__tests__/same-label.test.js +19 -0
- package/dist/Teaser.cjs.js +171 -52
- package/dist/Teaser.es5.js +263 -76
- package/dist/Teaser.esm.js +171 -53
- package/package.json +6 -2
- package/readme.md +22 -11
- package/src/Byline.jsx +51 -0
- package/src/MetaLink.jsx +43 -17
- package/src/PremiumLabel.jsx +1 -4
- package/src/Teaser.jsx +10 -1
- package/src/Title.jsx +15 -1
- package/src/concerns/constants.js +1 -0
- package/src/concerns/presets.js +29 -2
- package/src/concerns/rules.js +6 -1
- package/src/concerns/same-label.js +3 -0
- package/storybook/index.jsx +1 -3
- package/src/Teaser.scss +0 -12
package/Props.d.ts
CHANGED
|
@@ -29,12 +29,15 @@ export type ImageSize = 'XS' | 'Small' | 'Medium' | 'Large' | 'XL' | 'XXL'
|
|
|
29
29
|
export interface Features {
|
|
30
30
|
showMeta?: boolean
|
|
31
31
|
showTitle?: boolean
|
|
32
|
+
showTitlePrefix?: boolean
|
|
32
33
|
showStandfirst?: boolean
|
|
33
34
|
showPremiumLabel?: boolean
|
|
34
35
|
showExclusiveLabel?: boolean
|
|
35
36
|
showStatus?: boolean
|
|
36
37
|
showImage?: boolean
|
|
37
38
|
showHeadshot?: boolean
|
|
39
|
+
showByline?: boolean
|
|
40
|
+
showBylineHeadshot?: boolean
|
|
38
41
|
showVideo?: boolean
|
|
39
42
|
showRelatedLinks?: boolean
|
|
40
43
|
showCustomSlot?: boolean
|
|
@@ -55,21 +58,27 @@ export interface General {
|
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
export interface Meta {
|
|
58
|
-
/**
|
|
61
|
+
/** @deprecated - is being phased out in favour of `titlePrefix`,
|
|
62
|
+
* which will be used more sparingly
|
|
63
|
+
* Usually a brand, or a genre, or content type */
|
|
59
64
|
metaPrefixText?: string
|
|
60
65
|
metaSuffixText?: string
|
|
66
|
+
/** @deprecated - use metaLinks instead */
|
|
61
67
|
metaLink?: MetaLink
|
|
62
|
-
/**
|
|
68
|
+
/** @deprecated - use metaLinks instead
|
|
69
|
+
* Fallback used if the parentId is the same as the display concept */
|
|
63
70
|
metaAltLink?: MetaLink
|
|
64
71
|
/** Promoted content type */
|
|
65
72
|
promotedPrefixText?: string
|
|
66
73
|
promotedSuffixText?: string
|
|
74
|
+
metaLinks?: [linkText: string, relativeUrl: string][]
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
export interface Title {
|
|
70
78
|
title: string
|
|
71
79
|
/** Used for testing headline variations */
|
|
72
80
|
altTitle?: string
|
|
81
|
+
titlePrefix?: string
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
export interface Standfirst {
|
|
@@ -94,6 +103,7 @@ export interface Image {
|
|
|
94
103
|
imageLazyLoad?: Boolean | String
|
|
95
104
|
}
|
|
96
105
|
|
|
106
|
+
/** @deprecated - use byline instead */
|
|
97
107
|
export interface Headshot {
|
|
98
108
|
headshot?: String
|
|
99
109
|
headshotTint?: String
|
|
@@ -129,6 +139,7 @@ export interface Variants {
|
|
|
129
139
|
// Sub-props
|
|
130
140
|
//
|
|
131
141
|
|
|
142
|
+
/** @deprecated - use metaLinks property instead */
|
|
132
143
|
export interface MetaLink {
|
|
133
144
|
url: string
|
|
134
145
|
/** Preferred if available */
|
|
@@ -164,6 +175,10 @@ export interface Indicators {
|
|
|
164
175
|
isScoop?: boolean
|
|
165
176
|
}
|
|
166
177
|
|
|
178
|
+
export interface Byline {
|
|
179
|
+
byline?: [text: string, relativeUrl?: string, headshotUrl?: string][]
|
|
180
|
+
}
|
|
181
|
+
|
|
167
182
|
export interface TeaserProps
|
|
168
183
|
extends Features,
|
|
169
184
|
General,
|
|
@@ -173,6 +188,7 @@ export interface TeaserProps
|
|
|
173
188
|
Status,
|
|
174
189
|
Image,
|
|
175
190
|
Headshot,
|
|
191
|
+
Byline,
|
|
176
192
|
Video,
|
|
177
193
|
RelatedLinks,
|
|
178
194
|
Context,
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
"url": "#",
|
|
19
19
|
"prefLabel": "FT Investigations"
|
|
20
20
|
},
|
|
21
|
+
"titlePrefix": "FT Investigation",
|
|
22
|
+
"metaLinks": [
|
|
23
|
+
[
|
|
24
|
+
"Sexual misconduct allegations",
|
|
25
|
+
"#"
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"FT Investigations",
|
|
29
|
+
"#"
|
|
30
|
+
]
|
|
31
|
+
],
|
|
21
32
|
"image": {
|
|
22
33
|
"url": "http://prod-upp-image-read.ft.com/a25832ea-0053-11e8-9650-9c0ad2d7c5b5",
|
|
23
34
|
"width": 2048,
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
"url": "#",
|
|
19
19
|
"prefLabel": "FT Series"
|
|
20
20
|
},
|
|
21
|
+
"titlePrefix": null,
|
|
22
|
+
"metaLinks": [
|
|
23
|
+
[
|
|
24
|
+
"FT Magazine",
|
|
25
|
+
"#"
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"FT Series",
|
|
29
|
+
"#"
|
|
30
|
+
]
|
|
31
|
+
],
|
|
21
32
|
"image": {
|
|
22
33
|
"url": "http://prod-upp-image-read.ft.com/7e97f5b6-578d-11e8-b8b2-d6ceb45fa9d0",
|
|
23
34
|
"width": 2048,
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
"url": "#",
|
|
19
19
|
"prefLabel": "Anti-Semitism"
|
|
20
20
|
},
|
|
21
|
+
"titlePrefix": null,
|
|
22
|
+
"metaLinks": [
|
|
23
|
+
[
|
|
24
|
+
"Antisemitism",
|
|
25
|
+
"/anti-semitism"
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"Religion",
|
|
29
|
+
"/religion"
|
|
30
|
+
]
|
|
31
|
+
],
|
|
21
32
|
"image": {
|
|
22
33
|
"url": "http://prod-upp-image-read.ft.com/1005ca96-364b-11e8-8b98-2f31af407cc8",
|
|
23
34
|
"width": 2048,
|
|
@@ -28,6 +39,9 @@
|
|
|
28
39
|
"isOpinion": true,
|
|
29
40
|
"isColumn": true
|
|
30
41
|
},
|
|
42
|
+
"byline": [
|
|
43
|
+
["Gideon Rachman", "/gideon-rachman", "fthead-v1:gideon-rachman"]
|
|
44
|
+
],
|
|
31
45
|
"showHeadshot": true,
|
|
32
46
|
"status": "",
|
|
33
47
|
"headshotTint": "",
|
|
@@ -12,6 +12,17 @@
|
|
|
12
12
|
"url": "#",
|
|
13
13
|
"prefLabel": "Financial crisis: Are we safer now? "
|
|
14
14
|
},
|
|
15
|
+
"titlePrefix": null,
|
|
16
|
+
"metaLinks": [
|
|
17
|
+
[
|
|
18
|
+
"Financial crisis: Are we safer now? ",
|
|
19
|
+
"#"
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"Global Economy",
|
|
23
|
+
"/global-economy"
|
|
24
|
+
]
|
|
25
|
+
],
|
|
15
26
|
"image": {
|
|
16
27
|
"url": "http://prod-upp-image-read.ft.com/a25832ea-0053-11e8-9650-9c0ad2d7c5b5",
|
|
17
28
|
"width": 2048,
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
"prefLabel": "Tech Tonic podcast"
|
|
14
14
|
},
|
|
15
15
|
"metaAltLink": "",
|
|
16
|
+
"titlePrefix": null,
|
|
17
|
+
"metaLinks": [
|
|
18
|
+
[
|
|
19
|
+
"Tech Tonic podcast",
|
|
20
|
+
"#"
|
|
21
|
+
]
|
|
22
|
+
],
|
|
16
23
|
"image": {
|
|
17
24
|
"url": "https://www.ft.com/__origami/service/image/v2/images/raw/http%3A%2F%2Fprod-upp-image-read.ft.com%2F5d1a54aa-f49b-11e8-ae55-df4bf40f9d0d?source=next&fit=scale-down&compression=best&width=240",
|
|
18
25
|
"width": 2048,
|
|
@@ -19,6 +19,17 @@
|
|
|
19
19
|
"url": "#",
|
|
20
20
|
"prefLabel": "FT Investigations"
|
|
21
21
|
},
|
|
22
|
+
"titlePrefix": "FT Investigation",
|
|
23
|
+
"metaLinks": [
|
|
24
|
+
[
|
|
25
|
+
"Sexual misconduct allegations",
|
|
26
|
+
"#"
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
"Charity",
|
|
30
|
+
"#"
|
|
31
|
+
]
|
|
32
|
+
],
|
|
22
33
|
"image": {
|
|
23
34
|
"url": "http://prod-upp-image-read.ft.com/a25832ea-0053-11e8-9650-9c0ad2d7c5b5",
|
|
24
35
|
"width": 2048,
|
package/__fixtures__/video.json
CHANGED
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
"url": "#",
|
|
18
18
|
"prefLabel": "US"
|
|
19
19
|
},
|
|
20
|
+
"titlePrefix": null,
|
|
21
|
+
"metaLinks": [
|
|
22
|
+
[
|
|
23
|
+
"Global Trade",
|
|
24
|
+
"#"
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"Global Economy",
|
|
28
|
+
"#"
|
|
29
|
+
]
|
|
30
|
+
],
|
|
20
31
|
"image": {
|
|
21
32
|
"url": "http://com.ft.imagepublish.upp-prod-eu.s3.amazonaws.com/a27ce49b-85b8-445b-b883-db6e2f533194",
|
|
22
33
|
"width": 1920,
|