@financial-times/cp-content-pipeline-ui 9.13.0 → 9.14.1
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 +25 -0
- package/lib/components/ContentLayout/index.d.ts +2 -1
- package/lib/components/ContentLayout/index.js +1 -1
- package/lib/components/ContentLayout/index.js.map +1 -1
- package/lib/components/ContentLayout/test/snapshot.spec.d.ts +1 -0
- package/lib/components/ContentLayout/test/snapshot.spec.js +33 -0
- package/lib/components/ContentLayout/test/snapshot.spec.js.map +1 -0
- package/lib/components/RichText/index.js +4 -0
- package/lib/components/RichText/index.js.map +1 -1
- package/lib/components/content-tree/Clip/template/component.js +1 -1
- package/lib/components/content-tree/Clip/template/component.js.map +1 -1
- package/lib/components/content-tree/Timeline/TimelineEvent.d.ts +7 -0
- package/lib/components/content-tree/Timeline/TimelineEvent.js +17 -0
- package/lib/components/content-tree/Timeline/TimelineEvent.js.map +1 -0
- package/lib/components/content-tree/Timeline/index.d.ts +6 -0
- package/lib/components/content-tree/Timeline/index.js +17 -0
- package/lib/components/content-tree/Timeline/index.js.map +1 -0
- package/lib/components/content-tree/Timeline/test/TimelineEvent.spec.d.ts +1 -0
- package/lib/components/content-tree/Timeline/test/TimelineEvent.spec.js +48 -0
- package/lib/components/content-tree/Timeline/test/TimelineEvent.spec.js.map +1 -0
- package/lib/components/content-tree/Timeline/test/snapshot.spec.d.ts +1 -0
- package/lib/components/content-tree/Timeline/test/snapshot.spec.js +17 -0
- package/lib/components/content-tree/Timeline/test/snapshot.spec.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/main.scss +1 -0
- package/package.json +5 -5
- package/src/components/ContentLayout/index.tsx +3 -7
- package/src/components/ContentLayout/test/__snapshots__/snapshot.spec.tsx.snap +80 -0
- package/src/components/ContentLayout/test/snapshot.spec.tsx +47 -0
- package/src/components/RichText/index.tsx +4 -0
- package/src/components/content-tree/Clip/template/component.tsx +1 -1
- package/src/components/content-tree/Timeline/TimelineEvent.tsx +25 -0
- package/src/components/content-tree/Timeline/client/main.scss +55 -0
- package/src/components/content-tree/Timeline/index.tsx +19 -0
- package/src/components/content-tree/Timeline/test/TimelineEvent.spec.tsx +66 -0
- package/src/components/content-tree/Timeline/test/__snapshots__/TimelineEvent.spec.tsx.snap +94 -0
- package/src/components/content-tree/Timeline/test/__snapshots__/snapshot.spec.tsx.snap +20 -0
- package/src/components/content-tree/Timeline/test/snapshot.spec.tsx +15 -0
- package/src/index.ts +2 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@import "@financial-times/o3-foundation/css/core.css";
|
|
2
|
+
|
|
3
|
+
.cp-timeline {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
|
|
7
|
+
.cp-timeline-event {
|
|
8
|
+
flex-basis: 100%;
|
|
9
|
+
padding-left: var(--o3-spacing-s);
|
|
10
|
+
margin-left: 0;
|
|
11
|
+
margin-top: 0;
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
&::before {
|
|
16
|
+
content: "";
|
|
17
|
+
width: 2px;
|
|
18
|
+
background: var(--o3-color-palette-black);
|
|
19
|
+
height: 100%;
|
|
20
|
+
display: block;
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: var(--o3-spacing-5xs);
|
|
23
|
+
top: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.cp-timeline-event__heading {
|
|
27
|
+
position: relative;
|
|
28
|
+
margin-top: var(--o3-spacing-s);
|
|
29
|
+
margin-bottom: var(--o3-spacing-5xs);
|
|
30
|
+
|
|
31
|
+
.cp-timeline-event__heading-title {
|
|
32
|
+
font-weight: var(--o3-font-weight-semibold);
|
|
33
|
+
&::before {
|
|
34
|
+
content: "";
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 6px;
|
|
37
|
+
left: -23px;
|
|
38
|
+
height: var(--o3-spacing-4xs);
|
|
39
|
+
width: var(--o3-spacing-4xs);
|
|
40
|
+
border-radius: 50%;
|
|
41
|
+
background-color: var(--o3-color-palette-black);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
p {
|
|
47
|
+
margin-bottom: var(--o3-spacing-4xs);
|
|
48
|
+
margin-top: var(--o3-spacing-5xs);
|
|
49
|
+
font-family: var(--o3-type-body-base-font-family);
|
|
50
|
+
font-size: var(--o3-type-body-base-font-size);
|
|
51
|
+
font-weight: var(--o3-type-body-base-font-weight);
|
|
52
|
+
line-height: var(--o3-type-body-base-line-height);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ContentLayout } from '../../ContentLayout'
|
|
3
|
+
|
|
4
|
+
interface TimelineProps {
|
|
5
|
+
children?: React.ReactNode
|
|
6
|
+
}
|
|
7
|
+
/*
|
|
8
|
+
* @description Timeline component is used to render a simple timeline of events.
|
|
9
|
+
* @param children - The content to be displayed in the layout.
|
|
10
|
+
*/
|
|
11
|
+
const Timeline: React.FC<TimelineProps> = ({ children }) => {
|
|
12
|
+
return (
|
|
13
|
+
<ContentLayout>
|
|
14
|
+
<div className="cp-timeline">{children}</div>
|
|
15
|
+
</ContentLayout>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default Timeline
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import TimelineEvent from '../TimelineEvent'
|
|
4
|
+
|
|
5
|
+
describe('TimelineEvent', () => {
|
|
6
|
+
it('renders with date label and children', () => {
|
|
7
|
+
const { container } = render(
|
|
8
|
+
<TimelineEvent
|
|
9
|
+
content={{
|
|
10
|
+
type: 'timeline-event',
|
|
11
|
+
title: 'Significant Event',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<p>This is the event content</p>
|
|
15
|
+
</TimelineEvent>
|
|
16
|
+
)
|
|
17
|
+
expect(container).toMatchSnapshot()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('renders with minimal children content', () => {
|
|
21
|
+
const { container } = render(
|
|
22
|
+
<TimelineEvent
|
|
23
|
+
content={{
|
|
24
|
+
type: 'timeline-event',
|
|
25
|
+
title: 'Short Event',
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<p>Brief event description</p>
|
|
29
|
+
</TimelineEvent>
|
|
30
|
+
)
|
|
31
|
+
expect(container).toMatchSnapshot()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('renders with long date label', () => {
|
|
35
|
+
const { container } = render(
|
|
36
|
+
<TimelineEvent
|
|
37
|
+
content={{
|
|
38
|
+
type: 'timeline-event',
|
|
39
|
+
title: 'Wednesday, December 25, 2024 - Christmas Day',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<p>Christmas celebration details</p>
|
|
43
|
+
</TimelineEvent>
|
|
44
|
+
)
|
|
45
|
+
expect(container).toMatchSnapshot()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('renders with complex nested children', () => {
|
|
49
|
+
const { container } = render(
|
|
50
|
+
<TimelineEvent
|
|
51
|
+
content={{
|
|
52
|
+
type: 'timeline-event',
|
|
53
|
+
title: 'Q4 2024',
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<div>
|
|
57
|
+
<h3>Quarterly Results</h3>
|
|
58
|
+
<p>
|
|
59
|
+
The company announced <strong>strong</strong> Q4 results.
|
|
60
|
+
</p>
|
|
61
|
+
</div>
|
|
62
|
+
</TimelineEvent>
|
|
63
|
+
)
|
|
64
|
+
expect(container).toMatchSnapshot()
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`TimelineEvent renders with complex nested children 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="cp-timeline-event"
|
|
7
|
+
>
|
|
8
|
+
<h5
|
|
9
|
+
class="cp-timeline-event__heading o3-type-label"
|
|
10
|
+
>
|
|
11
|
+
<span
|
|
12
|
+
class="cp-timeline-event__heading-title"
|
|
13
|
+
>
|
|
14
|
+
Q4 2024
|
|
15
|
+
</span>
|
|
16
|
+
</h5>
|
|
17
|
+
<div>
|
|
18
|
+
<h3>
|
|
19
|
+
Quarterly Results
|
|
20
|
+
</h3>
|
|
21
|
+
<p>
|
|
22
|
+
The company announced
|
|
23
|
+
<strong>
|
|
24
|
+
strong
|
|
25
|
+
</strong>
|
|
26
|
+
Q4 results.
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`TimelineEvent renders with date label and children 1`] = `
|
|
34
|
+
<div>
|
|
35
|
+
<div
|
|
36
|
+
class="cp-timeline-event"
|
|
37
|
+
>
|
|
38
|
+
<h5
|
|
39
|
+
class="cp-timeline-event__heading o3-type-label"
|
|
40
|
+
>
|
|
41
|
+
<span
|
|
42
|
+
class="cp-timeline-event__heading-title"
|
|
43
|
+
>
|
|
44
|
+
Significant Event
|
|
45
|
+
</span>
|
|
46
|
+
</h5>
|
|
47
|
+
<p>
|
|
48
|
+
This is the event content
|
|
49
|
+
</p>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
exports[`TimelineEvent renders with long date label 1`] = `
|
|
55
|
+
<div>
|
|
56
|
+
<div
|
|
57
|
+
class="cp-timeline-event"
|
|
58
|
+
>
|
|
59
|
+
<h5
|
|
60
|
+
class="cp-timeline-event__heading o3-type-label"
|
|
61
|
+
>
|
|
62
|
+
<span
|
|
63
|
+
class="cp-timeline-event__heading-title"
|
|
64
|
+
>
|
|
65
|
+
Wednesday, December 25, 2024 - Christmas Day
|
|
66
|
+
</span>
|
|
67
|
+
</h5>
|
|
68
|
+
<p>
|
|
69
|
+
Christmas celebration details
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
exports[`TimelineEvent renders with minimal children content 1`] = `
|
|
76
|
+
<div>
|
|
77
|
+
<div
|
|
78
|
+
class="cp-timeline-event"
|
|
79
|
+
>
|
|
80
|
+
<h5
|
|
81
|
+
class="cp-timeline-event__heading o3-type-label"
|
|
82
|
+
>
|
|
83
|
+
<span
|
|
84
|
+
class="cp-timeline-event__heading-title"
|
|
85
|
+
>
|
|
86
|
+
Short Event
|
|
87
|
+
</span>
|
|
88
|
+
</h5>
|
|
89
|
+
<p>
|
|
90
|
+
Brief event description
|
|
91
|
+
</p>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Timeline component renders with full-width layout and children 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="n-content-layout__container--in-line"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="cp-timeline"
|
|
10
|
+
>
|
|
11
|
+
<div>
|
|
12
|
+
Event 1
|
|
13
|
+
</div>
|
|
14
|
+
<div>
|
|
15
|
+
Event 2
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import Timeline from '../'
|
|
4
|
+
|
|
5
|
+
describe('Timeline component', () => {
|
|
6
|
+
it('renders with full-width layout and children', () => {
|
|
7
|
+
const { container } = render(
|
|
8
|
+
<Timeline>
|
|
9
|
+
<div>Event 1</div>
|
|
10
|
+
<div>Event 2</div>
|
|
11
|
+
</Timeline>
|
|
12
|
+
)
|
|
13
|
+
expect(container).toMatchSnapshot()
|
|
14
|
+
})
|
|
15
|
+
})
|
package/src/index.ts
CHANGED
|
@@ -30,6 +30,8 @@ export { default as Table } from './components/content-tree/Table'
|
|
|
30
30
|
export { default as Tweet } from './components/content-tree/Tweet'
|
|
31
31
|
export { default as Video } from './components/content-tree/Video'
|
|
32
32
|
export { default as YoutubeVideo } from './components/content-tree/YoutubeVideo'
|
|
33
|
+
export { default as Timeline } from './components/content-tree/Timeline'
|
|
34
|
+
export { default as TimelineEvent } from './components/content-tree/Timeline/TimelineEvent'
|
|
33
35
|
export {
|
|
34
36
|
List,
|
|
35
37
|
ListItem,
|