@times-components/ts-components 1.103.1-alpha.3 → 1.103.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 +8 -0
- package/dist/components/article-sidebar/ArticleSidebar.js +3 -6
- package/dist/components/article-sidebar/__tests__/index.test.js +2 -44
- package/package.json +16 -16
- package/rnw.js +1 -1
- package/src/components/article-sidebar/ArticleSidebar.tsx +2 -22
- package/src/components/article-sidebar/__tests__/__snapshots__/index.test.tsx.snap +3 -3
- package/src/components/article-sidebar/__tests__/index.test.tsx +1 -51
- package/dist/components/article-sidebar/tracking-helpers.d.ts +0 -13
- package/dist/components/article-sidebar/tracking-helpers.js +0 -16
- package/src/components/article-sidebar/tracking-helpers.ts +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.103.1](https://github.com/newsuk/times-components/compare/@times-components/ts-components@1.103.0...@times-components/ts-components@1.103.1) (2024-08-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @times-components/ts-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [1.103.0](https://github.com/newsuk/times-components/compare/@times-components/ts-components@1.102.0...@times-components/ts-components@1.103.0) (2024-08-23)
|
|
7
15
|
|
|
8
16
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ChevronButton, ChevronRightIcon, Container, Description, Divider, ItemTitle, Link, PuzzleContainer, PuzzleImage, Title, TitleIconContainer } from './styles';
|
|
3
|
-
import { useTrackingContext } from '../../helpers/tracking/TrackingContextProvider';
|
|
4
|
-
import { handleClick } from './tracking-helpers';
|
|
5
3
|
export const ArticleSidebar = ({ sectionTitle, data, pageLink }) => {
|
|
6
|
-
const { fireAnalyticsEvent } = useTrackingContext();
|
|
7
4
|
return (React.createElement(Container, null,
|
|
8
|
-
React.createElement(Link, { href: pageLink
|
|
5
|
+
React.createElement(Link, { href: pageLink },
|
|
9
6
|
React.createElement(TitleIconContainer, null,
|
|
10
7
|
React.createElement(Title, null, sectionTitle),
|
|
11
8
|
React.createElement(ChevronButton, null,
|
|
@@ -13,9 +10,9 @@ export const ArticleSidebar = ({ sectionTitle, data, pageLink }) => {
|
|
|
13
10
|
React.createElement(Description, null, "Challenge yourself with today\u2019s puzzles."),
|
|
14
11
|
React.createElement(Divider, null),
|
|
15
12
|
data.map(({ title, url, imgUrl }) => (React.createElement(React.Fragment, { key: title },
|
|
16
|
-
React.createElement(PuzzleContainer, { href: url
|
|
13
|
+
React.createElement(PuzzleContainer, { href: url },
|
|
17
14
|
React.createElement(PuzzleImage, { src: imgUrl, alt: "Puzzle thumbnail" }),
|
|
18
15
|
React.createElement(ItemTitle, null, title)),
|
|
19
16
|
React.createElement(Divider, null))))));
|
|
20
17
|
};
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQXJ0aWNsZVNpZGViYXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tcG9uZW50cy9hcnRpY2xlLXNpZGViYXIvQXJ0aWNsZVNpZGViYXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBYSxNQUFNLE9BQU8sQ0FBQztBQUVsQyxPQUFPLEVBQ0wsYUFBYSxFQUNiLGdCQUFnQixFQUNoQixTQUFTLEVBQ1QsV0FBVyxFQUNYLE9BQU8sRUFDUCxTQUFTLEVBQ1QsSUFBSSxFQUNKLGVBQWUsRUFDZixXQUFXLEVBQ1gsS0FBSyxFQUNMLGtCQUFrQixFQUNuQixNQUFNLFVBQVUsQ0FBQztBQVFsQixNQUFNLENBQUMsTUFBTSxjQUFjLEdBQTRCLENBQUMsRUFDdEQsWUFBWSxFQUNaLElBQUksRUFDSixRQUFRLEVBQ1QsRUFBRSxFQUFFO0lBQ0gsT0FBTyxDQUNMLG9CQUFDLFNBQVM7UUFDUixvQkFBQyxJQUFJLElBQUMsSUFBSSxFQUFFLFFBQVE7WUFDbEIsb0JBQUMsa0JBQWtCO2dCQUNqQixvQkFBQyxLQUFLLFFBQUUsWUFBWSxDQUFTO2dCQUM3QixvQkFBQyxhQUFhO29CQUNaLG9CQUFDLGdCQUFnQixPQUFHLENBQ04sQ0FDRyxDQUNoQjtRQUVQLG9CQUFDLFdBQVcsd0RBQXVEO1FBQ25FLG9CQUFDLE9BQU8sT0FBRztRQUVWLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQyxFQUFFLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxFQUFFLEVBQUUsRUFBRSxDQUFDLENBQ3BDLG9CQUFDLEtBQUssQ0FBQyxRQUFRLElBQUMsR0FBRyxFQUFFLEtBQUs7WUFDeEIsb0JBQUMsZUFBZSxJQUFDLElBQUksRUFBRSxHQUFHO2dCQUN4QixvQkFBQyxXQUFXLElBQUMsR0FBRyxFQUFFLE1BQU0sRUFBRSxHQUFHLEVBQUMsa0JBQWtCLEdBQUc7Z0JBQ25ELG9CQUFDLFNBQVMsUUFBRSxLQUFLLENBQWEsQ0FDZDtZQUNsQixvQkFBQyxPQUFPLE9BQUcsQ0FDSSxDQUNsQixDQUFDLENBQ1EsQ0FDYixDQUFDO0FBQ0osQ0FBQyxDQUFDIn0=
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ArticleSidebar } from '../ArticleSidebar';
|
|
3
|
-
import { render
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
4
|
import '@testing-library/jest-dom';
|
|
5
|
-
import { useTrackingContext } from '../../../helpers/tracking/TrackingContextProvider';
|
|
6
|
-
jest.mock('../../../helpers/tracking/TrackingContextProvider', () => ({
|
|
7
|
-
useTrackingContext: jest.fn()
|
|
8
|
-
}));
|
|
9
|
-
const mockFireAnalyticsEvent = jest.fn();
|
|
10
5
|
const defaultProps = {
|
|
11
6
|
sectionTitle: 'Puzzles for you',
|
|
12
7
|
data: [
|
|
@@ -25,46 +20,9 @@ const defaultProps = {
|
|
|
25
20
|
};
|
|
26
21
|
const renderComponent = (props) => render(React.createElement(ArticleSidebar, Object.assign({}, props)));
|
|
27
22
|
describe('ArticleSidebar', () => {
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
useTrackingContext.mockReturnValue({
|
|
30
|
-
fireAnalyticsEvent: mockFireAnalyticsEvent
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
afterEach(() => {
|
|
34
|
-
jest.clearAllMocks();
|
|
35
|
-
});
|
|
36
23
|
it('should render ArticleSidebar component', () => {
|
|
37
24
|
const { asFragment } = renderComponent(defaultProps);
|
|
38
25
|
expect(asFragment()).toMatchSnapshot();
|
|
39
26
|
});
|
|
40
|
-
it('should call fireAnalyticsEvent when header is clicked', () => {
|
|
41
|
-
const { container } = renderComponent(defaultProps);
|
|
42
|
-
fireEvent.click(container.querySelector('.trigger'));
|
|
43
|
-
expect(mockFireAnalyticsEvent).toHaveBeenCalledWith({
|
|
44
|
-
object: 'ArticleSidebar',
|
|
45
|
-
action: 'Clicked',
|
|
46
|
-
attrs: {
|
|
47
|
-
event_navigation_action: 'navigation',
|
|
48
|
-
event_navigation_name: 'puzzle sidebar: header selected',
|
|
49
|
-
event_navigation_browsing_method: 'click',
|
|
50
|
-
component_name: 'Article Sidebar'
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it('should call fireAnalyticsEvent when a puzzle card is clicked', () => {
|
|
55
|
-
const { container } = renderComponent(defaultProps);
|
|
56
|
-
fireEvent.click(container.querySelector('.trigger-card-link'));
|
|
57
|
-
expect(mockFireAnalyticsEvent).toHaveBeenCalledWith({
|
|
58
|
-
object: 'ArticleSidebar',
|
|
59
|
-
action: 'Clicked',
|
|
60
|
-
attrs: {
|
|
61
|
-
event_navigation_action: 'navigation',
|
|
62
|
-
event_navigation_name: 'puzzle sidebar: puzzle selected',
|
|
63
|
-
event_navigation_browsing_method: 'click',
|
|
64
|
-
component_name: 'Article Sidebar',
|
|
65
|
-
article_parent_name: 'crossword'
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
27
|
});
|
|
70
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXgudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL2FydGljbGUtc2lkZWJhci9fX3Rlc3RzX18vaW5kZXgudGVzdC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLE1BQU0sT0FBTyxDQUFDO0FBQzFCLE9BQU8sRUFBRSxjQUFjLEVBQXVCLE1BQU0sbUJBQW1CLENBQUM7QUFDeEUsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ2hELE9BQU8sMkJBQTJCLENBQUM7QUFFbkMsTUFBTSxZQUFZLEdBQXdCO0lBQ3hDLFlBQVksRUFBRSxpQkFBaUI7SUFDL0IsSUFBSSxFQUFFO1FBQ0o7WUFDRSxLQUFLLEVBQUUsV0FBVztZQUNsQixHQUFHLEVBQUUsOENBQThDO1lBQ25ELE1BQU0sRUFDSiwrSUFBK0k7U0FDbEo7UUFDRDtZQUNFLEtBQUssRUFBRSxTQUFTO1lBQ2hCLEdBQUcsRUFBRSwyQ0FBMkM7WUFDaEQsTUFBTSxFQUNKLCtJQUErSTtTQUNsSjtLQUNGO0lBQ0QsUUFBUSxFQUFFLG9DQUFvQztDQUMvQyxDQUFDO0FBRUYsTUFBTSxlQUFlLEdBQUcsQ0FBQyxLQUEwQixFQUFFLEVBQUUsQ0FDckQsTUFBTSxDQUFDLG9CQUFDLGNBQWMsb0JBQUssS0FBSyxFQUFJLENBQUMsQ0FBQztBQUV4QyxRQUFRLENBQUMsZ0JBQWdCLEVBQUUsR0FBRyxFQUFFO0lBQzlCLEVBQUUsQ0FBQyx3Q0FBd0MsRUFBRSxHQUFHLEVBQUU7UUFDaEQsTUFBTSxFQUFFLFVBQVUsRUFBRSxHQUFHLGVBQWUsQ0FBQyxZQUFZLENBQUMsQ0FBQztRQUNyRCxNQUFNLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQyxlQUFlLEVBQUUsQ0FBQztJQUN6QyxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMsQ0FBQyxDQUFDIn0=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/ts-components",
|
|
3
|
-
"version": "1.103.1
|
|
3
|
+
"version": "1.103.1",
|
|
4
4
|
"description": "Reuseable Typescript React Components ",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dev": "dist/index.js",
|
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
"node": ">=8.9"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@times-components/button": "
|
|
54
|
-
"@times-components/date-publication": "
|
|
55
|
-
"@times-components/icons": "
|
|
56
|
-
"@times-components/image": "
|
|
57
|
-
"@times-components/link": "
|
|
58
|
-
"@times-components/provider": "
|
|
59
|
-
"@times-components/provider-queries": "
|
|
60
|
-
"@times-components/related-articles": "
|
|
61
|
-
"@times-components/ts-slices": "
|
|
62
|
-
"@times-components/ts-styleguide": "
|
|
63
|
-
"@times-components/utils": "
|
|
53
|
+
"@times-components/button": "2.10.61",
|
|
54
|
+
"@times-components/date-publication": "0.30.34",
|
|
55
|
+
"@times-components/icons": "2.22.12",
|
|
56
|
+
"@times-components/image": "6.18.1",
|
|
57
|
+
"@times-components/link": "3.17.34",
|
|
58
|
+
"@times-components/provider": "1.41.1",
|
|
59
|
+
"@times-components/provider-queries": "2.23.0",
|
|
60
|
+
"@times-components/related-articles": "6.17.83",
|
|
61
|
+
"@times-components/ts-slices": "1.9.22",
|
|
62
|
+
"@times-components/ts-styleguide": "1.50.34",
|
|
63
|
+
"@times-components/utils": "6.26.0",
|
|
64
64
|
"algoliasearch": "4.9.0",
|
|
65
65
|
"date-fns": "2.28.0",
|
|
66
66
|
"date-fns-tz": "1.3.3",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"@storybook/react": "6.5.16",
|
|
83
83
|
"@testing-library/jest-dom": "^5.12.0",
|
|
84
84
|
"@testing-library/react": "^12.1.2",
|
|
85
|
-
"@times-components/provider-test-tools": "
|
|
86
|
-
"@times-components/storybook": "
|
|
87
|
-
"@times-components/test-utils": "
|
|
85
|
+
"@times-components/provider-test-tools": "1.30.1",
|
|
86
|
+
"@times-components/storybook": "4.12.34",
|
|
87
|
+
"@times-components/test-utils": "2.4.2",
|
|
88
88
|
"@types/lodash.get": "4.4.6",
|
|
89
89
|
"@types/lodash.keyby": "4.6.6",
|
|
90
90
|
"@types/lodash.merge": "4.6.2",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"@testing-library/jest-dom/extend-expect"
|
|
118
118
|
]
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "b5b5d6ba3dabe797b0d519cde8fe055937f3449b"
|
|
121
121
|
}
|