@financial-times/cp-content-pipeline-ui 9.5.0 → 9.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/CHANGELOG.md +46 -0
- package/lib/components/content-tree/Flourish/index.js +2 -2
- package/lib/components/content-tree/Flourish/index.js.map +1 -1
- package/lib/components/content-tree/Flourish/test/snapshot.spec.js +13 -0
- package/lib/components/content-tree/Flourish/test/snapshot.spec.js.map +1 -1
- package/lib/components/content-tree/Heading/index.js +4 -3
- package/lib/components/content-tree/Heading/index.js.map +1 -1
- package/lib/components/content-tree/ImageSet/index.d.ts +3 -1
- package/lib/components/content-tree/ImageSet/index.js +2 -1
- package/lib/components/content-tree/ImageSet/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/content-tree/Clip/test/__snapshots__/snapshot.spec.tsx.snap +440 -440
- package/src/components/content-tree/Flourish/index.tsx +9 -1
- package/src/components/content-tree/Flourish/test/snapshot.spec.tsx +18 -0
- package/src/components/content-tree/Heading/index.tsx +14 -3
- package/src/components/content-tree/ImageSet/index.tsx +6 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -10,7 +10,14 @@ interface FlourishProps extends ContentProps<ContentTreeWorkarounds.Flourish> {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const Flourish: React.FC<FlourishProps> = ({
|
|
13
|
-
content: {
|
|
13
|
+
content: {
|
|
14
|
+
id,
|
|
15
|
+
flourishType,
|
|
16
|
+
description,
|
|
17
|
+
layoutWidth,
|
|
18
|
+
fallbackImage,
|
|
19
|
+
fragmentIdentifier,
|
|
20
|
+
},
|
|
14
21
|
iFrame = false,
|
|
15
22
|
inArticleBody = true,
|
|
16
23
|
}) => {
|
|
@@ -39,6 +46,7 @@ const Flourish: React.FC<FlourishProps> = ({
|
|
|
39
46
|
|
|
40
47
|
return (
|
|
41
48
|
<div
|
|
49
|
+
id={fragmentIdentifier}
|
|
42
50
|
className={classnames({
|
|
43
51
|
'n-content-layout': inArticleBody,
|
|
44
52
|
flourish: iFrame,
|
|
@@ -88,6 +88,24 @@ describe('Flourish component', () => {
|
|
|
88
88
|
)
|
|
89
89
|
expect(container).toMatchSnapshot()
|
|
90
90
|
})
|
|
91
|
+
|
|
92
|
+
it('renders with fragmentIdentifier as ID', () => {
|
|
93
|
+
const { container } = render(
|
|
94
|
+
<Flourish
|
|
95
|
+
content={{
|
|
96
|
+
type: 'flourish',
|
|
97
|
+
id: '123',
|
|
98
|
+
fragmentIdentifier: 'test',
|
|
99
|
+
flourishType: 'bar',
|
|
100
|
+
description: 'foo',
|
|
101
|
+
layoutWidth: 'full-grid',
|
|
102
|
+
fallbackImage: anImage,
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
const flourishElement = container.querySelector('[id="test"]')
|
|
107
|
+
expect(flourishElement).toBeTruthy()
|
|
108
|
+
})
|
|
91
109
|
})
|
|
92
110
|
|
|
93
111
|
it('sets the hideTitle param in the iframe url to true when not in article body', async () => {
|
|
@@ -7,22 +7,33 @@ const Heading: React.FC<
|
|
|
7
7
|
> = (props) => {
|
|
8
8
|
if (!React.Children.count(props.children)) return null
|
|
9
9
|
|
|
10
|
+
const { fragmentIdentifier } = props.content
|
|
11
|
+
|
|
10
12
|
switch (props.content.level) {
|
|
11
13
|
case 'chapter':
|
|
12
14
|
return (
|
|
13
|
-
<h2
|
|
15
|
+
<h2
|
|
16
|
+
id={fragmentIdentifier}
|
|
17
|
+
className="n-content-heading-2 o3-editorial-typography-chapter"
|
|
18
|
+
>
|
|
14
19
|
{props.children}
|
|
15
20
|
</h2>
|
|
16
21
|
)
|
|
17
22
|
case 'subheading':
|
|
18
23
|
return (
|
|
19
|
-
<h3
|
|
24
|
+
<h3
|
|
25
|
+
id={fragmentIdentifier}
|
|
26
|
+
className="n-content-heading-3 o3-editorial-typography-subheading"
|
|
27
|
+
>
|
|
20
28
|
{props.children}
|
|
21
29
|
</h3>
|
|
22
30
|
)
|
|
23
31
|
case 'label':
|
|
24
32
|
return (
|
|
25
|
-
<h5
|
|
33
|
+
<h5
|
|
34
|
+
id={fragmentIdentifier}
|
|
35
|
+
className="n-content-heading-5 o3-type-label"
|
|
36
|
+
>
|
|
26
37
|
{props.children}
|
|
27
38
|
</h5>
|
|
28
39
|
)
|
|
@@ -216,7 +216,9 @@ export const FallbackImage: React.FC<FallbackImageProps> = (props) => {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
export interface ImageSetProps
|
|
219
|
-
extends ContentProps<
|
|
219
|
+
extends ContentProps<
|
|
220
|
+
ComponentWorkarounds.ImageSet & { fragmentIdentifier?: string }
|
|
221
|
+
> {
|
|
220
222
|
isMainImage?: boolean
|
|
221
223
|
}
|
|
222
224
|
|
|
@@ -229,6 +231,8 @@ const ImageSet: React.FC<ImageSetProps> = (props) => {
|
|
|
229
231
|
|
|
230
232
|
const { reduceFullBleedImages } = useContext(PresentationFlagsContext)
|
|
231
233
|
|
|
234
|
+
const { fragmentIdentifier } = imageSet
|
|
235
|
+
|
|
232
236
|
const Wrapper =
|
|
233
237
|
// HACK:20240618:IM don't stretch out the main image to the full grid in
|
|
234
238
|
// the app as it can clash with the right hand rail
|
|
@@ -243,6 +247,7 @@ const ImageSet: React.FC<ImageSetProps> = (props) => {
|
|
|
243
247
|
return (
|
|
244
248
|
<Wrapper>
|
|
245
249
|
<figure
|
|
250
|
+
id={fragmentIdentifier}
|
|
246
251
|
className={
|
|
247
252
|
(imageSet.picture.layoutWidth &&
|
|
248
253
|
figureClassNameMap[imageSet.picture.layoutWidth]) ??
|