@times-components/ts-components 1.145.1-82bc6796129e892c1eb22c6257c5e3809c159767.3 → 1.145.1-cfea81c4084e6f91221ea00fec9fc730d5b933cb.4

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.
Files changed (156) hide show
  1. package/dist/components/carousel-component/CarouselComponent.stories.js +146 -0
  2. package/dist/components/carousel-component/CarouselItem.d.ts +3 -0
  3. package/dist/components/carousel-component/CarouselItem.js +11 -0
  4. package/dist/components/carousel-component/DefaultNavigationArrow.d.ts +8 -0
  5. package/dist/components/carousel-component/DefaultNavigationArrow.js +6 -0
  6. package/dist/components/carousel-component/DefaultPageDot.d.ts +8 -0
  7. package/dist/components/carousel-component/DefaultPageDot.js +4 -0
  8. package/dist/components/carousel-component/__tests__/CarouselComponent.test.js +163 -0
  9. package/dist/components/carousel-component/__tests__/CarouselItem.test.js +80 -0
  10. package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.js +62 -0
  11. package/dist/components/{opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.d.ts → carousel-component/__tests__/DefaultPageDot.test.d.ts} +0 -1
  12. package/dist/components/carousel-component/__tests__/DefaultPageDot.test.js +68 -0
  13. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.d.ts +1 -0
  14. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.js +314 -0
  15. package/dist/components/carousel-component/hooks/useCarousel.d.ts +2 -0
  16. package/dist/components/carousel-component/hooks/useCarousel.js +140 -0
  17. package/dist/components/carousel-component/index.d.ts +4 -0
  18. package/dist/components/carousel-component/index.js +20 -0
  19. package/dist/components/carousel-component/styles.d.ts +30 -0
  20. package/dist/components/carousel-component/styles.js +120 -0
  21. package/dist/components/carousel-component/types.d.ts +46 -0
  22. package/dist/components/carousel-component/types.js +2 -0
  23. package/dist/components/opta/football/opta-match-stats/shared/styles.js +1 -8
  24. package/dist/components/opta/football/opta-match-stats/summary/OptaMatchStatsSummary.js +2 -2
  25. package/dist/components/opta/football/opta-match-stats/summary/OptaMatchStatsSummary.stories.js +1 -1
  26. package/dist/components/opta/football/opta-match-stats/summary/WidgetContainer.js +4 -13
  27. package/dist/components/trip-cards/SkeletonCard.d.ts +2 -0
  28. package/dist/components/trip-cards/SkeletonCard.js +21 -0
  29. package/dist/components/trip-cards/TripCard.d.ts +3 -0
  30. package/dist/components/trip-cards/TripCard.js +47 -0
  31. package/dist/components/trip-cards/TripCards.stories.d.ts +1 -0
  32. package/dist/components/trip-cards/TripCards.stories.js +40 -0
  33. package/dist/components/trip-cards/TripCardsLayout.d.ts +3 -0
  34. package/dist/components/trip-cards/TripCardsLayout.js +26 -0
  35. package/dist/components/trip-cards/__tests__/SkeletonCard.test.d.ts +1 -0
  36. package/dist/components/trip-cards/__tests__/SkeletonCard.test.js +139 -0
  37. package/dist/components/trip-cards/__tests__/TripCard.test.d.ts +1 -0
  38. package/dist/components/trip-cards/__tests__/TripCard.test.js +95 -0
  39. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.d.ts +1 -0
  40. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.js +277 -0
  41. package/dist/components/trip-cards/__tests__/assets.test.d.ts +1 -0
  42. package/dist/components/trip-cards/__tests__/assets.test.js +165 -0
  43. package/dist/components/trip-cards/__tests__/helpers.test.d.ts +1 -0
  44. package/dist/components/trip-cards/__tests__/helpers.test.js +135 -0
  45. package/dist/components/trip-cards/__tests__/index.test.d.ts +1 -0
  46. package/dist/components/trip-cards/__tests__/index.test.js +437 -0
  47. package/dist/components/trip-cards/__tests__/mockData.test.d.ts +1 -0
  48. package/dist/components/trip-cards/__tests__/mockData.test.js +57 -0
  49. package/dist/components/trip-cards/__tests__/skeletonStyles.test.d.ts +1 -0
  50. package/dist/components/trip-cards/__tests__/skeletonStyles.test.js +194 -0
  51. package/dist/components/trip-cards/assets/BoatIcon.d.ts +1 -0
  52. package/dist/components/trip-cards/assets/BoatIcon.js +4 -0
  53. package/dist/components/trip-cards/assets/CalendarIcon.d.ts +1 -0
  54. package/dist/components/trip-cards/assets/CalendarIcon.js +4 -0
  55. package/dist/components/trip-cards/assets/ChevronRightIcon.d.ts +1 -0
  56. package/dist/components/trip-cards/assets/ChevronRightIcon.js +4 -0
  57. package/dist/components/trip-cards/assets/LocationIcon.d.ts +1 -0
  58. package/dist/components/trip-cards/assets/LocationIcon.js +4 -0
  59. package/dist/components/trip-cards/assets/MoonIcon.d.ts +1 -0
  60. package/dist/components/trip-cards/assets/MoonIcon.js +4 -0
  61. package/dist/components/trip-cards/assets/index.d.ts +6 -0
  62. package/dist/components/trip-cards/assets/index.js +7 -0
  63. package/dist/components/trip-cards/helpers.d.ts +4 -0
  64. package/dist/components/trip-cards/helpers.js +74 -0
  65. package/dist/components/trip-cards/index.d.ts +4 -0
  66. package/dist/components/trip-cards/index.js +70 -0
  67. package/dist/components/trip-cards/mockData.d.ts +3 -0
  68. package/dist/components/trip-cards/mockData.js +323 -0
  69. package/dist/components/trip-cards/skeletonStyles.d.ts +9 -0
  70. package/dist/components/trip-cards/skeletonStyles.js +37 -0
  71. package/dist/components/trip-cards/styles.d.ts +39 -0
  72. package/dist/components/trip-cards/styles.js +387 -0
  73. package/dist/components/trip-cards/types.d.ts +87 -0
  74. package/dist/components/trip-cards/types.js +2 -0
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +2 -2
  77. package/package.json +3 -3
  78. package/rnw.js +1 -1
  79. package/src/components/carousel-component/CarouselComponent.stories.tsx +220 -0
  80. package/src/components/carousel-component/CarouselItem.tsx +20 -0
  81. package/src/components/carousel-component/DefaultNavigationArrow.tsx +37 -0
  82. package/src/components/carousel-component/DefaultPageDot.tsx +20 -0
  83. package/src/components/carousel-component/__tests__/CarouselComponent.test.tsx +259 -0
  84. package/src/components/carousel-component/__tests__/CarouselItem.test.tsx +140 -0
  85. package/src/components/carousel-component/__tests__/DefaultNavigationArrow.test.tsx +153 -0
  86. package/src/components/carousel-component/__tests__/DefaultPageDot.test.tsx +105 -0
  87. package/src/components/carousel-component/hooks/__tests__/useCarousel.test.ts +438 -0
  88. package/src/components/carousel-component/hooks/useCarousel.ts +187 -0
  89. package/src/components/carousel-component/index.tsx +88 -0
  90. package/src/components/carousel-component/styles.ts +140 -0
  91. package/src/components/carousel-component/types.ts +51 -0
  92. package/src/components/opta/football/opta-match-stats/commentary/__tests__/__snapshots__/OptaMatchStatsCommentary.test.tsx.snap +1 -1
  93. package/src/components/opta/football/opta-match-stats/shared/styles.ts +0 -8
  94. package/src/components/opta/football/opta-match-stats/stats-graphs/__tests__/__snapshots__/OptaMatchStatsGraphs.test.tsx.snap +1 -1
  95. package/src/components/opta/football/opta-match-stats/summary/OptaMatchStatsSummary.stories.tsx +1 -1
  96. package/src/components/opta/football/opta-match-stats/summary/OptaMatchStatsSummary.tsx +1 -1
  97. package/src/components/opta/football/opta-match-stats/summary/WidgetContainer.tsx +3 -12
  98. package/src/components/opta/football/opta-match-stats/summary/__tests__/__snapshots__/OptaMatchStatsSummary.test.tsx.snap +1 -1
  99. package/src/components/trip-cards/SkeletonCard.tsx +54 -0
  100. package/src/components/trip-cards/TripCard.tsx +135 -0
  101. package/src/components/trip-cards/TripCards.stories.tsx +67 -0
  102. package/src/components/trip-cards/TripCardsLayout.tsx +75 -0
  103. package/src/components/trip-cards/__tests__/SkeletonCard.test.tsx +169 -0
  104. package/src/components/trip-cards/__tests__/TripCard.test.tsx +120 -0
  105. package/src/components/trip-cards/__tests__/TripCardsLayout.test.tsx +532 -0
  106. package/src/components/trip-cards/__tests__/assets.test.tsx +206 -0
  107. package/src/components/trip-cards/__tests__/helpers.test.ts +165 -0
  108. package/src/components/trip-cards/__tests__/index.test.tsx +499 -0
  109. package/src/components/trip-cards/__tests__/mockData.test.ts +67 -0
  110. package/src/components/trip-cards/__tests__/skeletonStyles.test.tsx +256 -0
  111. package/src/components/trip-cards/assets/BoatIcon.tsx +17 -0
  112. package/src/components/trip-cards/assets/CalendarIcon.tsx +17 -0
  113. package/src/components/trip-cards/assets/ChevronRightIcon.tsx +20 -0
  114. package/src/components/trip-cards/assets/LocationIcon.tsx +17 -0
  115. package/src/components/trip-cards/assets/MoonIcon.tsx +17 -0
  116. package/src/components/trip-cards/assets/index.ts +7 -0
  117. package/src/components/trip-cards/helpers.ts +99 -0
  118. package/src/components/trip-cards/index.tsx +104 -0
  119. package/src/components/trip-cards/mockData.ts +351 -0
  120. package/src/components/trip-cards/skeletonStyles.ts +46 -0
  121. package/src/components/trip-cards/styles.ts +426 -0
  122. package/src/components/trip-cards/types.ts +91 -0
  123. package/src/index.ts +2 -3
  124. package/dist/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.d.ts +0 -10
  125. package/dist/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.js +0 -69
  126. package/dist/components/opta/football/opta-match-stats/matchday-live/MobileWidget.d.ts +0 -12
  127. package/dist/components/opta/football/opta-match-stats/matchday-live/MobileWidget.js +0 -90
  128. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.d.ts +0 -12
  129. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.js +0 -10
  130. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.js +0 -24
  131. package/dist/components/opta/football/opta-match-stats/matchday-live/__tests__/MobileWidget.test.js +0 -57
  132. package/dist/components/opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.js +0 -48
  133. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.d.ts +0 -1
  134. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.js +0 -19
  135. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.d.ts +0 -12
  136. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.js +0 -67
  137. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.d.ts +0 -6
  138. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.js +0 -730
  139. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/__tests__/NavigationWrapper.test.js +0 -33
  140. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/__tests__/WidgetContainer.test.js +0 -36
  141. package/src/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.tsx +0 -108
  142. package/src/components/opta/football/opta-match-stats/matchday-live/MobileWidget.tsx +0 -158
  143. package/src/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.tsx +0 -38
  144. package/src/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.tsx +0 -23
  145. package/src/components/opta/football/opta-match-stats/matchday-live/__tests__/MobileWidget.test.tsx +0 -69
  146. package/src/components/opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.tsx +0 -61
  147. package/src/components/opta/football/opta-match-stats/matchday-live/__tests__/__snapshots__/OptaMatchStatsMatchdayLive.test.tsx.snap +0 -61
  148. package/src/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.tsx +0 -19
  149. package/src/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.tsx +0 -81
  150. package/src/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.tsx +0 -761
  151. package/src/components/opta/football/opta-match-stats/matchday-live/styles/__tests__/NavigationWrapper.test.tsx +0 -67
  152. package/src/components/opta/football/opta-match-stats/matchday-live/styles/__tests__/WidgetContainer.test.tsx +0 -64
  153. /package/dist/components/{opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.d.ts → carousel-component/CarouselComponent.stories.d.ts} +0 -0
  154. /package/dist/components/{opta/football/opta-match-stats/matchday-live/__tests__/MobileWidget.test.d.ts → carousel-component/__tests__/CarouselComponent.test.d.ts} +0 -0
  155. /package/dist/components/{opta/football/opta-match-stats/matchday-live/styles/__tests__/NavigationWrapper.test.d.ts → carousel-component/__tests__/CarouselItem.test.d.ts} +0 -0
  156. /package/dist/components/{opta/football/opta-match-stats/matchday-live/styles/__tests__/WidgetContainer.test.d.ts → carousel-component/__tests__/DefaultNavigationArrow.test.d.ts} +0 -0
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
- import { NavigationWrapper } from '../NavigationWrapper';
5
- const HomeColour = { light: '#123456', dark: '#abcdef' };
6
- const AwayColour = { light: '#654321', dark: '#fedcba' };
7
- describe('Matchday Live NavigationWrapper', () => {
8
- it('renders with active home', () => {
9
- const { container } = render(React.createElement(NavigationWrapper, { isApp: false, activeTeam: "home", homeTeamColor: HomeColour, awayTeamColor: AwayColour },
10
- React.createElement("div", { className: "navigation-buttons" },
11
- React.createElement("button", { className: "active home" }, "Home"),
12
- React.createElement("button", { className: "away" }, "Away")),
13
- React.createElement("div", { className: "home-widget-container" }, "Home widget"),
14
- React.createElement("div", { className: "away-widget-container" }, "Away widget")));
15
- expect(container.querySelector('.navigation-buttons')).toBeInTheDocument();
16
- expect(container.querySelector('.navigation-buttons .active.home')).toBeInTheDocument();
17
- expect(container.querySelector('.home-widget-container')).toBeInTheDocument();
18
- expect(container.querySelector('.away-widget-container')).toBeInTheDocument();
19
- });
20
- it('renders with active away and isApp true', () => {
21
- const { container } = render(React.createElement(NavigationWrapper, { isApp: true, activeTeam: "away", homeTeamColor: HomeColour, awayTeamColor: AwayColour },
22
- React.createElement("div", { className: "navigation-buttons" },
23
- React.createElement("button", { className: "home" }, "Home"),
24
- React.createElement("button", { className: "active away" }, "Away")),
25
- React.createElement("div", { className: "home-widget-container" }, "Home widget"),
26
- React.createElement("div", { className: "away-widget-container" }, "Away widget")));
27
- expect(container.querySelector('.navigation-buttons')).toBeInTheDocument();
28
- expect(container.querySelector('.navigation-buttons .active.away')).toBeInTheDocument();
29
- expect(container.querySelector('.home-widget-container')).toBeInTheDocument();
30
- expect(container.querySelector('.away-widget-container')).toBeInTheDocument();
31
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UIsa0JBQWtCO1lBQ3hELDZCQUFLLFNBQVMsRUFBQyx1QkFBdUIsa0JBQWtCLENBQ3RDLENBQ3JCLENBQUM7UUFFRixNQUFNLENBQUMsU0FBUyxDQUFDLGFBQWEsQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDLENBQUMsaUJBQWlCLEVBQUUsQ0FBQztRQUMzRSxNQUFNLENBQ0osU0FBUyxDQUFDLGFBQWEsQ0FBQyxrQ0FBa0MsQ0FBQyxDQUM1RCxDQUFDLGlCQUFpQixFQUFFLENBQUM7UUFDdEIsTUFBTSxDQUNKLFNBQVMsQ0FBQyxhQUFhLENBQUMsd0JBQXdCLENBQUMsQ0FDbEQsQ0FBQyxpQkFBaUIsRUFBRSxDQUFDO1FBQ3RCLE1BQU0sQ0FDSixTQUFTLENBQUMsYUFBYSxDQUFDLHdCQUF3QixDQUFDLENBQ2xELENBQUMsaUJBQWlCLEVBQUUsQ0FBQztJQUN4QixDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMsQ0FBQyxDQUFDIn0=
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
- import { WidgetContainer } from '../WidgetContainer';
5
- describe('Matchday Live WidgetContainer', () => {
6
- const baseProps = {
7
- isApp: true,
8
- homeTeamColor: { light: '#000000', dark: '#a19c9cff' },
9
- awayTeamColor: { light: '#007A3F', dark: '#007A3F' }
10
- };
11
- it('generates styles', () => {
12
- const { container } = render(React.createElement(WidgetContainer, Object.assign({}, baseProps),
13
- React.createElement("div", { className: "Opta" },
14
- React.createElement("div", { className: "Opta_W" }, "content"))));
15
- expect(container.querySelector('.Opta > .Opta_W')).toBeTruthy();
16
- });
17
- it('generates dark-mode styles under .Opta-Overlay .Opta-Flex', () => {
18
- const { container } = render(React.createElement(WidgetContainer, Object.assign({}, baseProps),
19
- React.createElement("div", { className: "Opta-Overlay" },
20
- React.createElement("div", { className: "Opta-Flex" }, "flex"))));
21
- expect(container.querySelector('.Opta-Overlay .Opta-Flex')).toBeTruthy();
22
- });
23
- it('applies home-widget-container styles', () => {
24
- const { container } = render(React.createElement(WidgetContainer, Object.assign({}, baseProps, { className: "home-widget-container" }),
25
- React.createElement("div", { className: "Opta-MatchHeader" },
26
- React.createElement("div", { className: "Opta-Away" }, "Away Team"))));
27
- expect(container.querySelector('.home-widget-container .Opta-MatchHeader .Opta-Away')).toBeTruthy();
28
- });
29
- it('applies away-widget-container styles', () => {
30
- const { container } = render(React.createElement(WidgetContainer, Object.assign({}, baseProps, { className: "away-widget-container" }),
31
- React.createElement("div", { className: "Opta-MatchHeader" },
32
- React.createElement("div", { className: "Opta-Home" }, "Home Team"))));
33
- expect(container.querySelector('.away-widget-container .Opta-MatchHeader .Opta-Home')).toBeTruthy();
34
- });
35
- });
36
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiV2lkZ2V0Q29udGFpbmVyLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvY29tcG9uZW50cy9vcHRhL2Zvb3RiYWxsL29wdGEtbWF0Y2gtc3RhdHMvbWF0Y2hkYXktbGl2ZS9zdHlsZXMvX190ZXN0c19fL1dpZGdldENvbnRhaW5lci50ZXN0LnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssTUFBTSxPQUFPLENBQUM7QUFDMUIsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ2hELE9BQU8sMkJBQTJCLENBQUM7QUFDbkMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLG9CQUFvQixDQUFDO0FBRXJELFFBQVEsQ0FBQywrQkFBK0IsRUFBRSxHQUFHLEVBQUU7SUFDN0MsTUFBTSxTQUFTLEdBQUc7UUFDaEIsS0FBSyxFQUFFLElBQUk7UUFDWCxhQUF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UFBQyx1QkFBdUI7WUFDL0QsNkJBQUssU0FBUyxFQUFDLGtCQUFrQjtnQkFDL0IsNkJBQUssU0FBUyxFQUFDLFdBQVcsZ0JBQWdCLENBQ3RDLENBQ1UsQ0FDbkIsQ0FBQztRQUNGLE1BQU0sQ0FDSixTQUFTLENBQUMsYUFBYSxDQUNyQixxREFBcUQsQ0FDdEQsQ0FDRixDQUFDLFVBQVUsRUFBRSxDQUFDO0lBQ2pCLENBQUMsQ0FBQyxDQUFDO0lBRUgsRUFBRSxDQUFDLHNDQUFzQyxFQUFFLEdBQUcsRUFBRTtRQUM5QyxNQUFNLEVBQUUsU0FBUyxFQUFFLEdBQUcsTUFBTSxDQUMxQixvQkFBQyxlQUFlLG9CQUFLLFNBQVMsSUFBRSxTQUFTLEVBQUMsdUJBQXVCO1lBQy9ELDZCQUFLLFNBQVMsRUFBQyxrQkFBa0I7Z0JBQy9CLDZCQUFLLFNBQVMsRUFBQyxXQUFXLGdCQUFnQixDQUN0QyxDQUNVLENBQ25CLENBQUM7UUFDRixNQUFNLENBQ0osU0FBUyxDQUFDLGFBQWEsQ0FDckIscURBQXFELENBQ3RELENBQ0YsQ0FBQyxVQUFVLEVBQUUsQ0FBQztJQUNqQixDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMsQ0FBQyxDQUFDIn0=
@@ -1,108 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { Placeholder } from '@times-components/image';
3
- import {
4
- initSettings,
5
- initStyleSheet,
6
- initScript,
7
- initElement,
8
- initComponent
9
- } from '../../../utils/config';
10
- import { PlaceholderContainer } from '../../../shared/shared-styles';
11
- import { WidgetContainer } from './styles/WidgetContainer';
12
- import { WidgetWrapper } from '../shared/styles';
13
- import { TeamColor } from '../shared/types';
14
-
15
- export const DesktopWidget: React.FC<{
16
- season: string;
17
- competition: string;
18
- match: string;
19
- isApp?: boolean;
20
- homeTeamColor?: TeamColor;
21
- awayTeamColor?: TeamColor;
22
- }> = React.memo(
23
- ({
24
- season,
25
- competition,
26
- match,
27
- isApp = false,
28
- homeTeamColor = { light: '#000000', dark: '#a19c9cff' },
29
- awayTeamColor = { light: '#007A3F', dark: '#007A3F' }
30
- }) => {
31
- const ref = React.createRef<HTMLDivElement>();
32
- const [isReady, setIsReady] = useState<boolean>(false);
33
-
34
- useEffect(() => {
35
- const sport = 'football';
36
-
37
- initSettings();
38
- initStyleSheet(sport);
39
- initScript()
40
- .then(() => {
41
- if (ref.current) {
42
- ref.current.innerHTML = initElement('opta-widget', {
43
- sport,
44
- widget: 'matchday_live',
45
- season,
46
- competition,
47
- match,
48
- template: 'normal',
49
- live: true,
50
- orientation: 'horizontal',
51
- side: 'both',
52
- show_match_header: true,
53
- show_crests: true,
54
- show_pitch_crests: false,
55
- show_team_formation: true,
56
- show_score: false,
57
- show_halftime_score: false,
58
- show_competition_name: false,
59
- show_date: false,
60
- date_format: 'dddd D MMMM YYYY',
61
- narrow_date_format: 'DD/MM/YY',
62
- show_referee: true,
63
- show_venue: true,
64
- show_attendance: true,
65
- show_images: false,
66
- show_pitch_images: false,
67
- show_team_sheets: false,
68
- show_event_icons: true,
69
- show_player_names: true,
70
- show_player_stats: true,
71
- show_subs: 'all',
72
- competition_naming: 'brief',
73
- team_naming: 'full',
74
- player_naming: 'last_name',
75
- show_live: false,
76
- show_logo: false,
77
- show_title: false,
78
- breakpoints: '400, 700'
79
- }).outerHTML;
80
-
81
- initComponent();
82
- }
83
- })
84
- .then(() => {
85
- setIsReady(true);
86
- });
87
- }, []);
88
-
89
- return (
90
- <>
91
- <WidgetWrapper isApp={isApp} className="matchday-live-widget-desktop">
92
- <h3>Line-ups</h3>
93
- <WidgetContainer
94
- ref={ref}
95
- isApp={isApp}
96
- homeTeamColor={homeTeamColor}
97
- awayTeamColor={awayTeamColor}
98
- />
99
- </WidgetWrapper>
100
- {!isReady && (
101
- <PlaceholderContainer data-testid="placeholder">
102
- <Placeholder />
103
- </PlaceholderContainer>
104
- )}
105
- </>
106
- );
107
- }
108
- );
@@ -1,158 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { Placeholder } from '@times-components/image';
3
- import {
4
- initSettings,
5
- initStyleSheet,
6
- initScript,
7
- initElement,
8
- initComponent
9
- } from '../../../utils/config';
10
- import { PlaceholderContainer } from '../../../shared/shared-styles';
11
- import { TeamColor } from '../shared/types';
12
- import { NavigationWrapper } from './styles/NavigationWrapper';
13
- import { WidgetContainer } from './styles/WidgetContainer';
14
-
15
- const widgetOptions = {
16
- widget: 'matchday_live',
17
- template: 'normal',
18
- live: true,
19
- orientation: 'vertical',
20
- show_match_header: true,
21
- show_crests: false,
22
- show_pitch_crests: false,
23
- show_team_formation: true,
24
- show_score: false,
25
- show_halftime_score: false,
26
- show_competition_name: false,
27
- show_date: false,
28
- date_format: 'dddd D MMMM YYYY',
29
- narrow_date_format: 'DD/MM/YY',
30
- show_referee: true,
31
- show_venue: false,
32
- show_attendance: false,
33
- show_images: false,
34
- show_pitch_images: false,
35
- show_team_sheets: false,
36
- show_event_icons: true,
37
- show_player_names: true,
38
- show_player_stats: true,
39
- show_subs: 'all',
40
- competition_naming: 'brief',
41
- team_naming: 'full',
42
- player_naming: 'last_name',
43
- show_live: false,
44
- show_logo: false,
45
- show_title: false
46
- };
47
-
48
- export const MobileWidget: React.FC<{
49
- season: string;
50
- competition: string;
51
- match: string;
52
- isApp?: boolean;
53
- homeTeamColor?: TeamColor;
54
- awayTeamColor?: TeamColor;
55
- homeTeamName: string;
56
- awayTeamName: string;
57
- }> = React.memo(
58
- ({
59
- season,
60
- competition,
61
- match,
62
- isApp = false,
63
- homeTeamColor = { light: '#000000', dark: '#a19c9cff' },
64
- awayTeamColor = { light: '#007A3F', dark: '#007A3F' },
65
- homeTeamName,
66
- awayTeamName
67
- }) => {
68
- const homeRef = React.createRef<HTMLDivElement>();
69
- const awayRef = React.createRef<HTMLDivElement>();
70
- const [isReady, setIsReady] = useState(false);
71
- const [activeTeam, setActiveTeam] = useState<'home' | 'away'>('home');
72
-
73
- useEffect(() => {
74
- const sport = 'football';
75
-
76
- initSettings();
77
- initStyleSheet(sport);
78
- initScript()
79
- .then(() => {
80
- if (homeRef.current) {
81
- homeRef.current.innerHTML = initElement('opta-widget', {
82
- ...widgetOptions,
83
- sport,
84
- season,
85
- competition,
86
- match,
87
- side: 'home'
88
- }).outerHTML;
89
- initComponent();
90
- }
91
- })
92
- .then(() => {
93
- if (awayRef.current) {
94
- awayRef.current.innerHTML = initElement('opta-widget', {
95
- ...widgetOptions,
96
- sport,
97
- season,
98
- competition,
99
- match,
100
- side: 'away'
101
- }).outerHTML;
102
- initComponent();
103
- }
104
- })
105
- .finally(() => {
106
- setIsReady(true);
107
- });
108
- }, []);
109
-
110
- return (
111
- <>
112
- <div className="matchday-live-widget-mobile">
113
- <NavigationWrapper
114
- data-testid="mobile-navigation-wrapper"
115
- activeTeam={activeTeam}
116
- homeTeamColor={homeTeamColor}
117
- awayTeamColor={awayTeamColor}
118
- isApp={isApp}
119
- >
120
- <div className="navigation-buttons">
121
- <button
122
- className={activeTeam === 'home' ? 'active home' : 'home'}
123
- onClick={() => setActiveTeam('home')}
124
- >
125
- {homeTeamName}
126
- </button>
127
- <button
128
- className={activeTeam === 'away' ? 'active away' : 'away'}
129
- onClick={() => setActiveTeam('away')}
130
- >
131
- {awayTeamName}
132
- </button>
133
- </div>
134
- <WidgetContainer
135
- className="home-widget-container"
136
- ref={homeRef}
137
- isApp={isApp}
138
- homeTeamColor={homeTeamColor}
139
- awayTeamColor={awayTeamColor}
140
- />
141
- <WidgetContainer
142
- className="away-widget-container"
143
- ref={awayRef}
144
- isApp={isApp}
145
- homeTeamColor={homeTeamColor}
146
- awayTeamColor={awayTeamColor}
147
- />
148
- {!isReady && (
149
- <PlaceholderContainer data-testid="placeholder">
150
- <Placeholder />
151
- </PlaceholderContainer>
152
- )}
153
- </NavigationWrapper>
154
- </div>
155
- </>
156
- );
157
- }
158
- );
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { showcaseConverter } from '@times-components/storybook';
3
-
4
- import { ArticleHarness } from '../../../../../fixtures/article-harness/ArticleHarness';
5
- import { OptaMatchStatsMatchdayLive } from './OptaMatchStatsMatchdayLive';
6
-
7
- const showcase = {
8
- children: [
9
- {
10
- decorator: (storyFn: () => React.ReactNode) => (
11
- <ArticleHarness>{storyFn()}</ArticleHarness>
12
- ),
13
- type: 'decorator'
14
- },
15
- {
16
- component: () => {
17
- return (
18
- <>
19
- <OptaMatchStatsMatchdayLive
20
- season="2025"
21
- competition="8"
22
- match="2562026"
23
- homeTeamName="Arsenal"
24
- awayTeamName="Brentford"
25
- />
26
- </>
27
- );
28
- },
29
- name: 'Summary',
30
- type: 'story'
31
- }
32
- ],
33
- name:
34
- 'Typescript Component/Opta Match Stats/Football/Match Stats Matchday Live'
35
- };
36
-
37
- // @ts-ignore
38
- showcaseConverter(module, showcase);
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { TeamColor } from '../shared/types';
3
- import { DesktopWidget } from './DesktopWidget';
4
- import { MobileWidget } from './MobileWidget';
5
- import { MatchdayLiveController } from './styles/MatchdayLiveController';
6
-
7
- export const OptaMatchStatsMatchdayLive: React.FC<{
8
- season: string;
9
- competition: string;
10
- match: string;
11
- isApp?: boolean;
12
- homeTeamColor?: TeamColor;
13
- awayTeamColor?: TeamColor;
14
- homeTeamName: string;
15
- awayTeamName: string;
16
- }> = React.memo(props => {
17
- return (
18
- <MatchdayLiveController>
19
- <DesktopWidget {...props} />
20
- <MobileWidget {...props} />
21
- </MatchdayLiveController>
22
- );
23
- });
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import { render, screen, fireEvent, act } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
-
5
- jest.mock('@times-components/image', () => ({
6
- Placeholder: () => <>Placeholder</>
7
- }));
8
-
9
- const mockInitSettings = jest.fn();
10
- const mockInitStyleSheet = jest.fn();
11
- const mockInitComponent = jest.fn();
12
-
13
- const mockInitElement = () => {
14
- const element = document.createElement('div');
15
- element.appendChild(document.createTextNode('Widget'));
16
- return element;
17
- };
18
-
19
- jest.mock('../../../../utils/config', () => ({
20
- initSettings: mockInitSettings,
21
- initStyleSheet: mockInitStyleSheet,
22
- initScript: () => Promise.resolve({}),
23
- initElement: mockInitElement,
24
- initComponent: mockInitComponent
25
- }));
26
-
27
- import { MobileWidget } from '../MobileWidget';
28
-
29
- const requiredProps = {
30
- season: '2020',
31
- competition: '3',
32
- match: '2041900',
33
- homeTeamName: 'Liverpool',
34
- awayTeamName: 'Manchester City'
35
- };
36
-
37
- describe('MobileWidget navigation buttons state', () => {
38
- beforeEach(() => {
39
- jest.clearAllMocks();
40
- });
41
-
42
- it('renders with home active and toggles to away on click', async () => {
43
- render(<MobileWidget {...requiredProps} />);
44
-
45
- const homeBtn = screen.getByRole('button', { name: 'Liverpool' });
46
- const awayBtn = screen.getByRole('button', { name: 'Manchester City' });
47
- expect(homeBtn).toHaveClass('home');
48
- expect(homeBtn).toHaveClass('active');
49
- expect(awayBtn).toHaveClass('away');
50
- expect(awayBtn).not.toHaveClass('active');
51
-
52
- fireEvent.click(awayBtn);
53
- expect(awayBtn).toHaveClass('active');
54
- expect(homeBtn).not.toHaveClass('active');
55
-
56
- expect(homeBtn).toHaveClass('home');
57
-
58
- await act(async () => {
59
- await Promise.resolve();
60
- });
61
- // Placeholder may still be present during async; assert wrapper exists
62
- expect(screen.getByTestId('mobile-navigation-wrapper')).toBeInTheDocument();
63
-
64
- fireEvent.click(homeBtn);
65
- expect(homeBtn).toHaveClass('active');
66
- expect(awayBtn).not.toHaveClass('active');
67
- expect(awayBtn).toHaveClass('away');
68
- });
69
- });
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import { render, act } from '@testing-library/react';
3
-
4
- import 'regenerator-runtime';
5
- import '@testing-library/jest-dom';
6
-
7
- jest.mock('@times-components/image', () => ({
8
- Placeholder: () => <>Placeholder</>
9
- }));
10
-
11
- const mockInitSettings = jest.fn();
12
- const mockInitStyleSheet = jest.fn();
13
- const mockInitComponent = jest.fn();
14
- const mockHasMatchEvents = jest.fn();
15
-
16
- const mockInitElement = () => {
17
- const element = document.createElement('div');
18
- element.appendChild(document.createTextNode('Widget'));
19
- return element;
20
- };
21
-
22
- jest.mock('../../../../utils/config', () => ({
23
- initSettings: mockInitSettings,
24
- initStyleSheet: mockInitStyleSheet,
25
- initScript: () => new Promise(resolve => resolve({})),
26
- initElement: mockInitElement,
27
- initComponent: mockInitComponent
28
- }));
29
-
30
- import { OptaMatchStatsMatchdayLive } from '../OptaMatchStatsMatchdayLive';
31
-
32
- const requiredProps = {
33
- season: '2020',
34
- competition: '3',
35
- match: '2041900',
36
- homeTeamName: 'Liverpool',
37
- awayTeamName: 'Manchester City'
38
- };
39
-
40
- describe('OptaMatchStatsMatchdayLive', () => {
41
- beforeEach(() => {
42
- jest.clearAllMocks();
43
- });
44
-
45
- it('should render correctly', async () => {
46
- const { asFragment } = render(
47
- <OptaMatchStatsMatchdayLive {...requiredProps} />
48
- );
49
-
50
- act(() => {
51
- mockInitComponent();
52
- mockHasMatchEvents();
53
- });
54
-
55
- expect(mockInitSettings).toHaveBeenCalledTimes(2);
56
- expect(mockInitStyleSheet).toHaveBeenCalledTimes(2);
57
- expect(mockInitComponent).toHaveBeenCalledTimes(1);
58
-
59
- expect(asFragment()).toMatchSnapshot();
60
- });
61
- });
@@ -1,61 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`OptaMatchStatsMatchdayLive should render correctly 1`] = `
4
- <DocumentFragment>
5
- <div
6
- class="sc-bZQynM inSDsQ"
7
- >
8
- <div
9
- class="matchday-live-widget-desktop sc-bxivhb iQCzHr"
10
- >
11
- <h3>
12
- Line-ups
13
- </h3>
14
- <div
15
- class="sc-ifAKCX hfZGOd"
16
- />
17
- </div>
18
- <div
19
- class="sc-bwzfXH eSqyJ"
20
- data-testid="placeholder"
21
- >
22
- Placeholder
23
- </div>
24
- <div
25
- class="matchday-live-widget-mobile"
26
- >
27
- <div
28
- class="sc-EHOje fBqPPh"
29
- data-testid="mobile-navigation-wrapper"
30
- >
31
- <div
32
- class="navigation-buttons"
33
- >
34
- <button
35
- class="active home"
36
- >
37
- Liverpool
38
- </button>
39
- <button
40
- class="away"
41
- >
42
- Manchester City
43
- </button>
44
- </div>
45
- <div
46
- class="home-widget-container sc-ifAKCX hfZGOd"
47
- />
48
- <div
49
- class="away-widget-container sc-ifAKCX hfZGOd"
50
- />
51
- <div
52
- class="sc-bwzfXH eSqyJ"
53
- data-testid="placeholder"
54
- >
55
- Placeholder
56
- </div>
57
- </div>
58
- </div>
59
- </div>
60
- </DocumentFragment>
61
- `;
@@ -1,19 +0,0 @@
1
- import styled from 'styled-components';
2
- import { breakpoints } from '@times-components/ts-styleguide';
3
-
4
- export const MatchdayLiveController = styled.div`
5
- .matchday-live-widget-mobile {
6
- display: block;
7
- }
8
- .matchday-live-widget-desktop {
9
- display: none;
10
- }
11
- @media (min-width: ${breakpoints.medium}px) {
12
- .matchday-live-widget-mobile {
13
- display: none;
14
- }
15
- .matchday-live-widget-desktop {
16
- display: block;
17
- }
18
- }
19
- `;