@times-components/ts-components 1.84.3 → 1.85.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 +11 -0
- package/dist/components/opta/football/fixtures-ticker/OptaFootballFixturesTicker.d.ts +8 -0
- package/dist/components/opta/football/fixtures-ticker/OptaFootballFixturesTicker.js +43 -0
- package/dist/components/opta/football/fixtures-ticker/OptaFootballFixturesTicker.stories.d.ts +1 -0
- package/dist/components/opta/football/fixtures-ticker/OptaFootballFixturesTicker.stories.js +21 -0
- package/dist/components/opta/football/fixtures-ticker/__tests__/OptaFootballFixturesTicker.test.d.ts +2 -0
- package/dist/components/opta/football/fixtures-ticker/__tests__/OptaFootballFixturesTicker.test.js +41 -0
- package/dist/components/opta/football/fixtures-ticker/styles.d.ts +2 -0
- package/dist/components/opta/football/fixtures-ticker/styles.js +315 -0
- package/package.json +12 -12
- package/src/components/opta/football/fixtures-ticker/OptaFootballFixturesTicker.stories.tsx +32 -0
- package/src/components/opta/football/fixtures-ticker/OptaFootballFixturesTicker.tsx +71 -0
- package/src/components/opta/football/fixtures-ticker/__tests__/OptaFootballFixturesTicker.test.tsx +53 -0
- package/src/components/opta/football/fixtures-ticker/__tests__/__snapshots__/OptaFootballFixturesTicker.test.tsx.snap +34 -0
- package/src/components/opta/football/fixtures-ticker/styles.ts +317 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.85.0](https://github.com/newsuk/times-components/compare/@times-components/ts-components@1.84.3...@times-components/ts-components@1.85.0) (2024-05-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **TMRS-170:** add opta football fixtures ticker component ([#3849](https://github.com/newsuk/times-components/issues/3849)) ([e8524a9](https://github.com/newsuk/times-components/commit/e8524a97bd58a8ab134f61f1394d061da5fe55d5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.84.3](https://github.com/newsuk/times-components/compare/@times-components/ts-components@1.84.2...@times-components/ts-components@1.84.3) (2024-05-08)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @times-components/ts-components
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Placeholder } from '@times-components/image';
|
|
3
|
+
import { initSettings, initStyleSheet, initScript, initElement, initComponent } from '../../utils/config';
|
|
4
|
+
import { Container, PlaceholderContainer } from '../shared-styles';
|
|
5
|
+
import { WidgetContainer } from './styles';
|
|
6
|
+
export const OptaFootballFixturesTicker = React.memo(({ season, competition, date_from, date_to, full_width }) => {
|
|
7
|
+
const ref = React.createRef();
|
|
8
|
+
const [isReady, setIsReady] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const sport = 'football';
|
|
11
|
+
initSettings();
|
|
12
|
+
initStyleSheet(sport);
|
|
13
|
+
initScript().then(() => {
|
|
14
|
+
if (ref.current) {
|
|
15
|
+
ref.current.innerHTML = initElement('opta-widget', {
|
|
16
|
+
sport,
|
|
17
|
+
widget: 'fixtures',
|
|
18
|
+
season,
|
|
19
|
+
competition,
|
|
20
|
+
date_from,
|
|
21
|
+
date_to,
|
|
22
|
+
live: true,
|
|
23
|
+
start_on_current: true,
|
|
24
|
+
template: 'strip',
|
|
25
|
+
team_naming: 'brief',
|
|
26
|
+
match_status: 'all',
|
|
27
|
+
order_by: 'date_ascending',
|
|
28
|
+
show_grouping: true,
|
|
29
|
+
show_crests: true,
|
|
30
|
+
show_date: true,
|
|
31
|
+
date_format: 'ddd Do MMM'
|
|
32
|
+
}).outerHTML;
|
|
33
|
+
initComponent();
|
|
34
|
+
setIsReady(true);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}, []);
|
|
38
|
+
return (React.createElement(Container, { border: isReady, fullWidth: full_width },
|
|
39
|
+
React.createElement(WidgetContainer, { ref: ref }),
|
|
40
|
+
!isReady && (React.createElement(PlaceholderContainer, null,
|
|
41
|
+
React.createElement(Placeholder, null)))));
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT3B0YUZvb3RiYWxsRml4dHVyZXNUaWNrZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvY29tcG9uZW50cy9vcHRhL2Zvb3RiYWxsL2ZpeHR1cmVzLXRpY2tlci9PcHRhRm9vdGJhbGxGaXh0dXJlc1RpY2tlci50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsRUFBRSxRQUFRLEVBQUUsU0FBUyxFQUFFLE1BQU0sT0FBTyxDQUFDO0FBRW5ELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUV0RCxPQUFPLEVBQ0wsWUFBWSxFQUNaLGNBQWMsRUFDZCxVQUFVLEVBQ1YsV0FBVyxFQUNYLGFBQWEsRUFDZCxNQUFNLG9CQUFvQixDQUFDO0FBRTVCLE9BQU8sRUFBRSxTQUFTLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUNuRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sVUFBVSxDQUFDO0FBRTNDLE1BQU0sQ0FBQyxNQUFNLDBCQUEwQixHQU1sQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxNQUFNLEVBQUUsV0FBVyxFQUFFLFNBQVMsRUFBRSxPQUFPLEVBQUUsVUFBVSxFQUFFLEVBQUUsRUFBRTtJQUMxRSxNQUFNLEdBQUcsR0FBRyxLQUFLLENBQUMsU0FBUyxFQUFrQix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FBRSxTQUFTLEVBQUUsVUFBVTtRQUMvQyxvQkFBQyxlQUFlLElBQUMsR0FBRyxFQUFFLEdBQUcsR0FBSTtRQUU1QixDQUFDLE9BQU8sSUFBSSxDQUNYLG9CQUFDLG9CQUFvQjtZQUNuQixvQkFBQyxXQUFXLE9BQUcsQ0FDTSxDQUN4QixDQUNTLENBQ2IsQ0FBQztBQUNKLENBQUMsQ0FBQyxDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { showcaseConverter } from '@times-components/storybook';
|
|
3
|
+
import { ArticleHarness } from '../../../../fixtures/article-harness/ArticleHarness';
|
|
4
|
+
import { OptaFootballFixturesTicker } from './OptaFootballFixturesTicker';
|
|
5
|
+
const showcase = {
|
|
6
|
+
children: [
|
|
7
|
+
{
|
|
8
|
+
decorator: (storyFn) => (React.createElement(ArticleHarness, null, storyFn())),
|
|
9
|
+
type: 'decorator'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
component: () => (React.createElement(OptaFootballFixturesTicker, { season: "2023", competition: "8", date_from: "", date_to: "" })),
|
|
13
|
+
name: 'Fixtures Ticker',
|
|
14
|
+
type: 'story'
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
name: 'Typescript Component/In Article/Football/Fixtures'
|
|
18
|
+
};
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
showcaseConverter(module, showcase);
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT3B0YUZvb3RiYWxsRml4dHVyZXNUaWNrZXIuc3Rvcmllcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL29wdGEvZm9vdGJhbGwvZml4dHVyZXMtdGlja2VyL09wdGFGb290YmFsbEZpeHR1cmVzVGlja2VyLnN0b3JpZXMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxNQUFNLE9BQU8sQ0FBQztBQUMxQixPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVoRSxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0scURBQXFELENBQUM7QUFDckYsT0FBTyxFQUFFLDBCQUEwQixFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFFMUUsTUFBTSxRQUFRLEdBQUc7SUFDZixRQUFRLEVBQUU7UUFDUjtZQUNFLFNBQVMsRUFBRSxDQUFDLE9BQThCLEVBQUUsRUFBRSxDQUFDLENBQzdDLG9CQUFDLGNBQWMsUUFBRSxPQUFPLEVBQUUsQ0FBa0IsQ0FDN0M7WUFDRCxJQUFJLEVBQUUsV0FBVztTQUNsQjtRQUNEO1lBQ0UsU0FBUyxFQUFFLEdBQUcsRUFBRSxDQUFDLENBQ2Ysb0JBQUMsMEJBQTBCLElBQ3pCLE1BQU0sRUFBQyxNQUFNLEVBQ2IsV0FBVyxFQUFDLEdBQUcsRUFDZixTQUFTLEVBQUMsRUFBRSxFQUNaLE9BQU8sRUFBQyxFQUFFLEdBQ1YsQ0FDSDtZQUNELElBQUksRUFBRSxpQkFBaUI7WUFDdkIsSUFBSSxFQUFFLE9BQU87U0FDZDtLQUNGO0lBQ0QsSUFBSSxFQUFFLG1EQUFtRDtDQUMxRCxDQUFDO0FBRUYsYUFBYTtBQUNiLGlCQUFpQixDQUFDLE1BQU0sRUFBRSxRQUFRLENBQUMsQ0FBQyJ9
|
package/dist/components/opta/football/fixtures-ticker/__tests__/OptaFootballFixturesTicker.test.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, waitForElementToBeRemoved } from '@testing-library/react';
|
|
3
|
+
import 'regenerator-runtime';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
jest.mock('@times-components/image', () => ({
|
|
6
|
+
Placeholder: () => React.createElement(React.Fragment, null, "Placeholder")
|
|
7
|
+
}));
|
|
8
|
+
const mockInitSettings = jest.fn();
|
|
9
|
+
const mockInitStyleSheet = jest.fn();
|
|
10
|
+
const mockInitComponent = jest.fn();
|
|
11
|
+
const mockInitElement = () => {
|
|
12
|
+
const element = document.createElement('div');
|
|
13
|
+
element.appendChild(document.createTextNode('Widget'));
|
|
14
|
+
return element;
|
|
15
|
+
};
|
|
16
|
+
jest.mock('../../../utils/config', () => ({
|
|
17
|
+
initSettings: mockInitSettings,
|
|
18
|
+
initStyleSheet: mockInitStyleSheet,
|
|
19
|
+
initScript: () => new Promise(resolve => resolve({})),
|
|
20
|
+
initElement: mockInitElement,
|
|
21
|
+
initComponent: mockInitComponent
|
|
22
|
+
}));
|
|
23
|
+
import { OptaFootballFixturesTicker } from '../OptaFootballFixturesTicker';
|
|
24
|
+
const requiredProps = {
|
|
25
|
+
season: '2020',
|
|
26
|
+
competition: '3',
|
|
27
|
+
date_from: '2021-06-20',
|
|
28
|
+
date_to: '2021-07-11'
|
|
29
|
+
};
|
|
30
|
+
describe('OptaFootballFixturesTicker', () => {
|
|
31
|
+
it('should render correctly', async () => {
|
|
32
|
+
const { asFragment, getByText } = render(React.createElement(OptaFootballFixturesTicker, Object.assign({}, requiredProps)));
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
await waitForElementToBeRemoved(getByText('Placeholder'));
|
|
35
|
+
expect(mockInitSettings).toHaveBeenCalledTimes(1);
|
|
36
|
+
expect(mockInitStyleSheet).toHaveBeenCalledTimes(1);
|
|
37
|
+
expect(mockInitComponent).toHaveBeenCalledTimes(1);
|
|
38
|
+
expect(asFragment()).toMatchSnapshot();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiT3B0YUZvb3RiYWxsRml4dHVyZXNUaWNrZXIudGV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UMsQ0FBQztRQUNwRCxNQUFNLENBQUMsaUJBQWlCLENBQUMsQ0FBQyxxQkFBcUIsQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUVuRCxNQUFNLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FBQyxlQUFlLEVBQUUsQ0FBQztJQUN6QyxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMsQ0FBQyxDQUFDIn0=
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { breakpoints, colours, fonts } from '@times-components/ts-styleguide';
|
|
3
|
+
import { WidgetContainerBase } from '../shared-styles';
|
|
4
|
+
export const WidgetContainerOverride = styled(WidgetContainerBase) `
|
|
5
|
+
.Opta {
|
|
6
|
+
h2 {
|
|
7
|
+
margin: 20px 0 0 0 !important;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.Opta-js-main {
|
|
11
|
+
table {
|
|
12
|
+
tbody {
|
|
13
|
+
td.Opta-title {
|
|
14
|
+
background-color: transparent !important;
|
|
15
|
+
border-bottom: 1px solid #e4e4e4;
|
|
16
|
+
|
|
17
|
+
h3 {
|
|
18
|
+
margin: 20px 0 0 0 !important;
|
|
19
|
+
font-family: ${fonts.headline} !important;
|
|
20
|
+
font-size: 16px !important;
|
|
21
|
+
line-height: 30px !important;
|
|
22
|
+
text-align: center;
|
|
23
|
+
|
|
24
|
+
span {
|
|
25
|
+
font-size: inherit;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
29
|
+
font-size: 18px !important;
|
|
30
|
+
line-height: 40px !important;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
export const WidgetContainer = styled(WidgetContainerBase) `
|
|
40
|
+
.Opta-Scroller {
|
|
41
|
+
background-color: white !important;
|
|
42
|
+
|
|
43
|
+
border: 1px solid #999999 !important;
|
|
44
|
+
border-radius: 2px;
|
|
45
|
+
padding: 39px 0 !important;
|
|
46
|
+
|
|
47
|
+
&::after {
|
|
48
|
+
background: rgba(0, 0, 0, 0)
|
|
49
|
+
url(https://secure.widget.cloud.opta.net/v3/assets/images/sprites/controls.svg)
|
|
50
|
+
no-repeat !important;
|
|
51
|
+
background-size: 210px 186px !important;
|
|
52
|
+
background-position-x: -180px !important;
|
|
53
|
+
background-position-y: -19px !important;
|
|
54
|
+
height: 16px !important;
|
|
55
|
+
width: 16px !important;
|
|
56
|
+
top: calc(50% - 8px) !important;
|
|
57
|
+
left: calc(50% - 8px) !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.Opta-Next::after {
|
|
61
|
+
transform: rotate(-90deg) translateX(2px);
|
|
62
|
+
}
|
|
63
|
+
&.Opta-Previous::after {
|
|
64
|
+
transform: rotate(90deg) translateX(2px);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.Opta-fixture {
|
|
69
|
+
background-color: #f5f5f5;
|
|
70
|
+
border-radius: 4px;
|
|
71
|
+
height: 80px;
|
|
72
|
+
width: 160px !important;
|
|
73
|
+
margin-inline: 4px;
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
|
|
77
|
+
.Opta-Team,
|
|
78
|
+
.Opta-timings {
|
|
79
|
+
background-color: transparent !important;
|
|
80
|
+
border-right: 0 !important;
|
|
81
|
+
}
|
|
82
|
+
.Opta-Team {
|
|
83
|
+
height: 24px !important;
|
|
84
|
+
}
|
|
85
|
+
.Opta-timings {
|
|
86
|
+
height: 24px !important;
|
|
87
|
+
order: -1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.Opta-TeamName,
|
|
91
|
+
.Opta-Team-Score {
|
|
92
|
+
color: black !important;
|
|
93
|
+
font-weight: bold !important;
|
|
94
|
+
}
|
|
95
|
+
&.Opta-prematch .Opta-Team-Score::after {
|
|
96
|
+
content: '-';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.Opta {
|
|
101
|
+
.Opta-js-main {
|
|
102
|
+
padding: 0;
|
|
103
|
+
background-color: transparent;
|
|
104
|
+
|
|
105
|
+
table {
|
|
106
|
+
tbody {
|
|
107
|
+
td.Opta-title {
|
|
108
|
+
height: 40px;
|
|
109
|
+
background-color: ${colours.functional.backgroundSecondary};
|
|
110
|
+
|
|
111
|
+
h3 {
|
|
112
|
+
height: auto;
|
|
113
|
+
margin: 0 0 0 10px;
|
|
114
|
+
color: ${colours.functional.brandColour};
|
|
115
|
+
font-family: ${fonts.supporting};
|
|
116
|
+
font-size: 14px;
|
|
117
|
+
line-height: 14px;
|
|
118
|
+
font-weight: normal;
|
|
119
|
+
background-color: transparent;
|
|
120
|
+
border-bottom: 0;
|
|
121
|
+
|
|
122
|
+
span {
|
|
123
|
+
float: none;
|
|
124
|
+
padding: 0;
|
|
125
|
+
font-size: 13px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
129
|
+
margin: 0 0 0 20px;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
tr.Opta-Scoreline {
|
|
135
|
+
height: 40px;
|
|
136
|
+
background-color: transparent !important;
|
|
137
|
+
border-bottom: 1px solid #e4e4e4;
|
|
138
|
+
|
|
139
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
140
|
+
height: 50px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
td {
|
|
144
|
+
max-width: none !important;
|
|
145
|
+
padding: 3px 0 0 0;
|
|
146
|
+
color: ${colours.functional.brandColour} !important;
|
|
147
|
+
font-family: ${fonts.headline};
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
line-height: 14px;
|
|
150
|
+
background-color: transparent;
|
|
151
|
+
|
|
152
|
+
&.Opta-Time {
|
|
153
|
+
width: 50px !important;
|
|
154
|
+
padding: 6px 0 0 10px;
|
|
155
|
+
color: ${colours.section.sport} !important;
|
|
156
|
+
font-family: ${fonts.supporting};
|
|
157
|
+
|
|
158
|
+
abbr {
|
|
159
|
+
font-size: inherit;
|
|
160
|
+
line-height: inherit;
|
|
161
|
+
text-decoration: none;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
165
|
+
width: 60px !important;
|
|
166
|
+
padding: 6px 0 0 20px;
|
|
167
|
+
font-size: 13px;
|
|
168
|
+
line-height: 14px;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&.Opta-Team {
|
|
173
|
+
width: 30% !important;
|
|
174
|
+
padding-left: 10px;
|
|
175
|
+
|
|
176
|
+
&.Opta-Home {
|
|
177
|
+
padding-right: 10px;
|
|
178
|
+
padding-left: 0;
|
|
179
|
+
text-align: right;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
183
|
+
padding-left: 15px;
|
|
184
|
+
|
|
185
|
+
&.Opta-Home {
|
|
186
|
+
padding-right: 15px;
|
|
187
|
+
padding-left: 0;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&.Opta-Score {
|
|
193
|
+
width: 25px !important;
|
|
194
|
+
font-size: 16px;
|
|
195
|
+
line-height: 16px;
|
|
196
|
+
text-align: left !important;
|
|
197
|
+
|
|
198
|
+
&.Opta-Home {
|
|
199
|
+
text-align: right !important;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
span {
|
|
203
|
+
font-size: inherit;
|
|
204
|
+
line-height: inherit;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
208
|
+
width: 30px !important;
|
|
209
|
+
font-size: 24px;
|
|
210
|
+
line-height: 24px;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&.Opta-Crest {
|
|
215
|
+
width: 20px !important;
|
|
216
|
+
margin-top: -3px;
|
|
217
|
+
|
|
218
|
+
img {
|
|
219
|
+
width: 20px;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&.Opta-Divider {
|
|
224
|
+
width: 20px !important;
|
|
225
|
+
text-align: center;
|
|
226
|
+
|
|
227
|
+
abbr {
|
|
228
|
+
font-size: inherit;
|
|
229
|
+
line-height: inherit;
|
|
230
|
+
text-decoration: none;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&.Opta-Outer:not(.Opta-Time) {
|
|
235
|
+
width: 50px !important;
|
|
236
|
+
padding: 0 10px 0 0;
|
|
237
|
+
|
|
238
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
239
|
+
width: 60px !important;
|
|
240
|
+
padding: 0 20px 0 0;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
245
|
+
font-size: 16px;
|
|
246
|
+
line-height: 16px;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
tr.Opta-agg {
|
|
252
|
+
background-color: transparent !important;
|
|
253
|
+
|
|
254
|
+
td {
|
|
255
|
+
padding: 10px;
|
|
256
|
+
color: ${colours.functional.primary};
|
|
257
|
+
font-family: ${fonts.supporting};
|
|
258
|
+
font-size: 13px;
|
|
259
|
+
line-height: 16px;
|
|
260
|
+
background-color: transparent;
|
|
261
|
+
|
|
262
|
+
span {
|
|
263
|
+
font-size: inherit;
|
|
264
|
+
line-height: inherit;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
span.Opta-agg-text {
|
|
268
|
+
text-transform: uppercase;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
tr {
|
|
274
|
+
td.Opta-Nest {
|
|
275
|
+
padding: 0;
|
|
276
|
+
|
|
277
|
+
.Opta_W {
|
|
278
|
+
> .Opta-Cf {
|
|
279
|
+
background-color: transparent;
|
|
280
|
+
border-bottom: 1px solid #e4e4e4;
|
|
281
|
+
|
|
282
|
+
.Opta-Events {
|
|
283
|
+
padding: 10px 0 2px 0;
|
|
284
|
+
|
|
285
|
+
li {
|
|
286
|
+
padding: 0 0 8px 0;
|
|
287
|
+
|
|
288
|
+
.Opta-Event-Text {
|
|
289
|
+
color: ${colours.functional.primary};
|
|
290
|
+
font-family: ${fonts.supporting};
|
|
291
|
+
font-size: 13px;
|
|
292
|
+
line-height: 16px;
|
|
293
|
+
|
|
294
|
+
.Opta-Event-Player,
|
|
295
|
+
.Opta-Event-Time {
|
|
296
|
+
font-size: inherit;
|
|
297
|
+
line-height: inherit;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.Opta-Event-Time {
|
|
301
|
+
color: ${colours.section.sport};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
`;
|
|
315
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3R5bGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL2NvbXBvbmVudHMvb3B0YS9mb290YmFsbC9maXh0dXJlcy10aWNrZXIvc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sTUFBTSxNQUFNLG1CQUFtQixDQUFDO0FBQ3ZDLE9BQU8sRUFBRSxXQUFXLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRTlFLE9BQU8sRUFBRSxt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LFdBQVcsQ0FBQyxNQUFNOzs7Ozs7bUNBTXBCLFdBQVcsQ0FBQyxNQUFNOzs7Ozs7Ozs7Ozs7dUJBWTlCLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTzs2QkFDcEIsS0FBSyxDQUFDLFVBQVU7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O2lDQWdDWixPQUFPLENBQUMsVUFBVSxDQUFDLE9BQU87dUNBQ3BCLEtBQUssQ0FBQyxVQUFVOzs7Ozs7Ozs7OzttQ0FXcEIsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLOzs7Ozs7Ozs7Ozs7O0NBYXZELENBQUMifQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/ts-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.0",
|
|
4
4
|
"description": "Reuseable Typescript React Components ",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"dev": "dist/index.js",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"node": ">=8.9"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@times-components/button": "2.10.
|
|
54
|
-
"@times-components/date-publication": "0.30.
|
|
55
|
-
"@times-components/icons": "2.21.
|
|
56
|
-
"@times-components/image": "6.17.
|
|
57
|
-
"@times-components/link": "3.17.
|
|
58
|
-
"@times-components/provider": "1.40.
|
|
53
|
+
"@times-components/button": "2.10.43",
|
|
54
|
+
"@times-components/date-publication": "0.30.16",
|
|
55
|
+
"@times-components/icons": "2.21.22",
|
|
56
|
+
"@times-components/image": "6.17.3",
|
|
57
|
+
"@times-components/link": "3.17.16",
|
|
58
|
+
"@times-components/provider": "1.40.17",
|
|
59
59
|
"@times-components/provider-queries": "2.21.1",
|
|
60
|
-
"@times-components/related-articles": "6.17.
|
|
61
|
-
"@times-components/ts-slices": "1.9.
|
|
62
|
-
"@times-components/ts-styleguide": "1.50.
|
|
60
|
+
"@times-components/related-articles": "6.17.56",
|
|
61
|
+
"@times-components/ts-slices": "1.9.4",
|
|
62
|
+
"@times-components/ts-styleguide": "1.50.16",
|
|
63
63
|
"@times-components/utils": "6.20.3",
|
|
64
64
|
"algoliasearch": "4.9.0",
|
|
65
65
|
"date-fns": "2.28.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@testing-library/jest-dom": "^5.12.0",
|
|
84
84
|
"@testing-library/react": "^12.1.2",
|
|
85
85
|
"@times-components/provider-test-tools": "1.29.3",
|
|
86
|
-
"@times-components/storybook": "4.12.
|
|
86
|
+
"@times-components/storybook": "4.12.16",
|
|
87
87
|
"@times-components/test-utils": "2.4.2",
|
|
88
88
|
"@types/lodash.get": "4.4.6",
|
|
89
89
|
"@types/lodash.keyby": "4.6.6",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"@testing-library/jest-dom/extend-expect"
|
|
116
116
|
]
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "ab2d19db05462b3948665085a45421a1efd8d8d1"
|
|
119
119
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { showcaseConverter } from '@times-components/storybook';
|
|
3
|
+
|
|
4
|
+
import { ArticleHarness } from '../../../../fixtures/article-harness/ArticleHarness';
|
|
5
|
+
import { OptaFootballFixturesTicker } from './OptaFootballFixturesTicker';
|
|
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
|
+
<OptaFootballFixturesTicker
|
|
18
|
+
season="2023"
|
|
19
|
+
competition="8"
|
|
20
|
+
date_from=""
|
|
21
|
+
date_to=""
|
|
22
|
+
/>
|
|
23
|
+
),
|
|
24
|
+
name: 'Fixtures Ticker',
|
|
25
|
+
type: 'story'
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
name: 'Typescript Component/In Article/Football/Fixtures'
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
showcaseConverter(module, showcase);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Placeholder } from '@times-components/image';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
initSettings,
|
|
7
|
+
initStyleSheet,
|
|
8
|
+
initScript,
|
|
9
|
+
initElement,
|
|
10
|
+
initComponent
|
|
11
|
+
} from '../../utils/config';
|
|
12
|
+
|
|
13
|
+
import { Container, PlaceholderContainer } from '../shared-styles';
|
|
14
|
+
import { WidgetContainer } from './styles';
|
|
15
|
+
|
|
16
|
+
export const OptaFootballFixturesTicker: React.FC<{
|
|
17
|
+
season: string;
|
|
18
|
+
competition: string;
|
|
19
|
+
date_from?: string;
|
|
20
|
+
date_to?: string;
|
|
21
|
+
full_width?: boolean;
|
|
22
|
+
}> = React.memo(({ season, competition, date_from, date_to, full_width }) => {
|
|
23
|
+
const ref = React.createRef<HTMLDivElement>();
|
|
24
|
+
|
|
25
|
+
const [isReady, setIsReady] = useState<boolean>(false);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const sport = 'football';
|
|
29
|
+
|
|
30
|
+
initSettings();
|
|
31
|
+
initStyleSheet(sport);
|
|
32
|
+
|
|
33
|
+
initScript().then(() => {
|
|
34
|
+
if (ref.current) {
|
|
35
|
+
ref.current.innerHTML = initElement('opta-widget', {
|
|
36
|
+
sport,
|
|
37
|
+
widget: 'fixtures',
|
|
38
|
+
season,
|
|
39
|
+
competition,
|
|
40
|
+
date_from,
|
|
41
|
+
date_to,
|
|
42
|
+
live: true,
|
|
43
|
+
start_on_current: true,
|
|
44
|
+
template: 'strip',
|
|
45
|
+
team_naming: 'brief',
|
|
46
|
+
match_status: 'all',
|
|
47
|
+
order_by: 'date_ascending',
|
|
48
|
+
show_grouping: true,
|
|
49
|
+
show_crests: true,
|
|
50
|
+
show_date: true,
|
|
51
|
+
date_format: 'ddd Do MMM'
|
|
52
|
+
}).outerHTML;
|
|
53
|
+
|
|
54
|
+
initComponent();
|
|
55
|
+
setIsReady(true);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Container border={isReady} fullWidth={full_width}>
|
|
62
|
+
<WidgetContainer ref={ref} />
|
|
63
|
+
|
|
64
|
+
{!isReady && (
|
|
65
|
+
<PlaceholderContainer>
|
|
66
|
+
<Placeholder />
|
|
67
|
+
</PlaceholderContainer>
|
|
68
|
+
)}
|
|
69
|
+
</Container>
|
|
70
|
+
);
|
|
71
|
+
});
|
package/src/components/opta/football/fixtures-ticker/__tests__/OptaFootballFixturesTicker.test.tsx
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, waitForElementToBeRemoved } 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
|
+
|
|
15
|
+
const mockInitElement = () => {
|
|
16
|
+
const element = document.createElement('div');
|
|
17
|
+
element.appendChild(document.createTextNode('Widget'));
|
|
18
|
+
return element;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
jest.mock('../../../utils/config', () => ({
|
|
22
|
+
initSettings: mockInitSettings,
|
|
23
|
+
initStyleSheet: mockInitStyleSheet,
|
|
24
|
+
initScript: () => new Promise(resolve => resolve({})),
|
|
25
|
+
initElement: mockInitElement,
|
|
26
|
+
initComponent: mockInitComponent
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
import { OptaFootballFixturesTicker } from '../OptaFootballFixturesTicker';
|
|
30
|
+
|
|
31
|
+
const requiredProps = {
|
|
32
|
+
season: '2020',
|
|
33
|
+
competition: '3',
|
|
34
|
+
date_from: '2021-06-20',
|
|
35
|
+
date_to: '2021-07-11'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
describe('OptaFootballFixturesTicker', () => {
|
|
39
|
+
it('should render correctly', async () => {
|
|
40
|
+
const { asFragment, getByText } = render(
|
|
41
|
+
<OptaFootballFixturesTicker {...requiredProps} />
|
|
42
|
+
);
|
|
43
|
+
expect(asFragment()).toMatchSnapshot();
|
|
44
|
+
|
|
45
|
+
await waitForElementToBeRemoved(getByText('Placeholder'));
|
|
46
|
+
|
|
47
|
+
expect(mockInitSettings).toHaveBeenCalledTimes(1);
|
|
48
|
+
expect(mockInitStyleSheet).toHaveBeenCalledTimes(1);
|
|
49
|
+
expect(mockInitComponent).toHaveBeenCalledTimes(1);
|
|
50
|
+
|
|
51
|
+
expect(asFragment()).toMatchSnapshot();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`OptaFootballFixturesTicker should render correctly 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="sc-bdVaJa giUBsz"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="sc-htpNat sc-ifAKCX lclCDG"
|
|
10
|
+
/>
|
|
11
|
+
<div
|
|
12
|
+
class="sc-bwzfXH kVYHKf"
|
|
13
|
+
>
|
|
14
|
+
Placeholder
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</DocumentFragment>
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
exports[`OptaFootballFixturesTicker should render correctly 2`] = `
|
|
21
|
+
<DocumentFragment>
|
|
22
|
+
<div
|
|
23
|
+
class="sc-bdVaJa hGXeaj"
|
|
24
|
+
>
|
|
25
|
+
<div
|
|
26
|
+
class="sc-htpNat sc-ifAKCX lclCDG"
|
|
27
|
+
>
|
|
28
|
+
<div>
|
|
29
|
+
Widget
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</DocumentFragment>
|
|
34
|
+
`;
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { breakpoints, colours, fonts } from '@times-components/ts-styleguide';
|
|
3
|
+
|
|
4
|
+
import { WidgetContainerBase } from '../shared-styles';
|
|
5
|
+
|
|
6
|
+
export const WidgetContainerOverride = styled(WidgetContainerBase)`
|
|
7
|
+
.Opta {
|
|
8
|
+
h2 {
|
|
9
|
+
margin: 20px 0 0 0 !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.Opta-js-main {
|
|
13
|
+
table {
|
|
14
|
+
tbody {
|
|
15
|
+
td.Opta-title {
|
|
16
|
+
background-color: transparent !important;
|
|
17
|
+
border-bottom: 1px solid #e4e4e4;
|
|
18
|
+
|
|
19
|
+
h3 {
|
|
20
|
+
margin: 20px 0 0 0 !important;
|
|
21
|
+
font-family: ${fonts.headline} !important;
|
|
22
|
+
font-size: 16px !important;
|
|
23
|
+
line-height: 30px !important;
|
|
24
|
+
text-align: center;
|
|
25
|
+
|
|
26
|
+
span {
|
|
27
|
+
font-size: inherit;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
31
|
+
font-size: 18px !important;
|
|
32
|
+
line-height: 40px !important;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export const WidgetContainer = styled(WidgetContainerBase)`
|
|
43
|
+
.Opta-Scroller {
|
|
44
|
+
background-color: white !important;
|
|
45
|
+
|
|
46
|
+
border: 1px solid #999999 !important;
|
|
47
|
+
border-radius: 2px;
|
|
48
|
+
padding: 39px 0 !important;
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
background: rgba(0, 0, 0, 0)
|
|
52
|
+
url(https://secure.widget.cloud.opta.net/v3/assets/images/sprites/controls.svg)
|
|
53
|
+
no-repeat !important;
|
|
54
|
+
background-size: 210px 186px !important;
|
|
55
|
+
background-position-x: -180px !important;
|
|
56
|
+
background-position-y: -19px !important;
|
|
57
|
+
height: 16px !important;
|
|
58
|
+
width: 16px !important;
|
|
59
|
+
top: calc(50% - 8px) !important;
|
|
60
|
+
left: calc(50% - 8px) !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.Opta-Next::after {
|
|
64
|
+
transform: rotate(-90deg) translateX(2px);
|
|
65
|
+
}
|
|
66
|
+
&.Opta-Previous::after {
|
|
67
|
+
transform: rotate(90deg) translateX(2px);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.Opta-fixture {
|
|
72
|
+
background-color: #f5f5f5;
|
|
73
|
+
border-radius: 4px;
|
|
74
|
+
height: 80px;
|
|
75
|
+
width: 160px !important;
|
|
76
|
+
margin-inline: 4px;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
|
|
80
|
+
.Opta-Team,
|
|
81
|
+
.Opta-timings {
|
|
82
|
+
background-color: transparent !important;
|
|
83
|
+
border-right: 0 !important;
|
|
84
|
+
}
|
|
85
|
+
.Opta-Team {
|
|
86
|
+
height: 24px !important;
|
|
87
|
+
}
|
|
88
|
+
.Opta-timings {
|
|
89
|
+
height: 24px !important;
|
|
90
|
+
order: -1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.Opta-TeamName,
|
|
94
|
+
.Opta-Team-Score {
|
|
95
|
+
color: black !important;
|
|
96
|
+
font-weight: bold !important;
|
|
97
|
+
}
|
|
98
|
+
&.Opta-prematch .Opta-Team-Score::after {
|
|
99
|
+
content: '-';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.Opta {
|
|
104
|
+
.Opta-js-main {
|
|
105
|
+
padding: 0;
|
|
106
|
+
background-color: transparent;
|
|
107
|
+
|
|
108
|
+
table {
|
|
109
|
+
tbody {
|
|
110
|
+
td.Opta-title {
|
|
111
|
+
height: 40px;
|
|
112
|
+
background-color: ${colours.functional.backgroundSecondary};
|
|
113
|
+
|
|
114
|
+
h3 {
|
|
115
|
+
height: auto;
|
|
116
|
+
margin: 0 0 0 10px;
|
|
117
|
+
color: ${colours.functional.brandColour};
|
|
118
|
+
font-family: ${fonts.supporting};
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
line-height: 14px;
|
|
121
|
+
font-weight: normal;
|
|
122
|
+
background-color: transparent;
|
|
123
|
+
border-bottom: 0;
|
|
124
|
+
|
|
125
|
+
span {
|
|
126
|
+
float: none;
|
|
127
|
+
padding: 0;
|
|
128
|
+
font-size: 13px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
132
|
+
margin: 0 0 0 20px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
tr.Opta-Scoreline {
|
|
138
|
+
height: 40px;
|
|
139
|
+
background-color: transparent !important;
|
|
140
|
+
border-bottom: 1px solid #e4e4e4;
|
|
141
|
+
|
|
142
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
143
|
+
height: 50px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
td {
|
|
147
|
+
max-width: none !important;
|
|
148
|
+
padding: 3px 0 0 0;
|
|
149
|
+
color: ${colours.functional.brandColour} !important;
|
|
150
|
+
font-family: ${fonts.headline};
|
|
151
|
+
font-size: 14px;
|
|
152
|
+
line-height: 14px;
|
|
153
|
+
background-color: transparent;
|
|
154
|
+
|
|
155
|
+
&.Opta-Time {
|
|
156
|
+
width: 50px !important;
|
|
157
|
+
padding: 6px 0 0 10px;
|
|
158
|
+
color: ${colours.section.sport} !important;
|
|
159
|
+
font-family: ${fonts.supporting};
|
|
160
|
+
|
|
161
|
+
abbr {
|
|
162
|
+
font-size: inherit;
|
|
163
|
+
line-height: inherit;
|
|
164
|
+
text-decoration: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
168
|
+
width: 60px !important;
|
|
169
|
+
padding: 6px 0 0 20px;
|
|
170
|
+
font-size: 13px;
|
|
171
|
+
line-height: 14px;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&.Opta-Team {
|
|
176
|
+
width: 30% !important;
|
|
177
|
+
padding-left: 10px;
|
|
178
|
+
|
|
179
|
+
&.Opta-Home {
|
|
180
|
+
padding-right: 10px;
|
|
181
|
+
padding-left: 0;
|
|
182
|
+
text-align: right;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
186
|
+
padding-left: 15px;
|
|
187
|
+
|
|
188
|
+
&.Opta-Home {
|
|
189
|
+
padding-right: 15px;
|
|
190
|
+
padding-left: 0;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&.Opta-Score {
|
|
196
|
+
width: 25px !important;
|
|
197
|
+
font-size: 16px;
|
|
198
|
+
line-height: 16px;
|
|
199
|
+
text-align: left !important;
|
|
200
|
+
|
|
201
|
+
&.Opta-Home {
|
|
202
|
+
text-align: right !important;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
span {
|
|
206
|
+
font-size: inherit;
|
|
207
|
+
line-height: inherit;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
211
|
+
width: 30px !important;
|
|
212
|
+
font-size: 24px;
|
|
213
|
+
line-height: 24px;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&.Opta-Crest {
|
|
218
|
+
width: 20px !important;
|
|
219
|
+
margin-top: -3px;
|
|
220
|
+
|
|
221
|
+
img {
|
|
222
|
+
width: 20px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&.Opta-Divider {
|
|
227
|
+
width: 20px !important;
|
|
228
|
+
text-align: center;
|
|
229
|
+
|
|
230
|
+
abbr {
|
|
231
|
+
font-size: inherit;
|
|
232
|
+
line-height: inherit;
|
|
233
|
+
text-decoration: none;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&.Opta-Outer:not(.Opta-Time) {
|
|
238
|
+
width: 50px !important;
|
|
239
|
+
padding: 0 10px 0 0;
|
|
240
|
+
|
|
241
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
242
|
+
width: 60px !important;
|
|
243
|
+
padding: 0 20px 0 0;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@media (min-width: ${breakpoints.medium}px) {
|
|
248
|
+
font-size: 16px;
|
|
249
|
+
line-height: 16px;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
tr.Opta-agg {
|
|
255
|
+
background-color: transparent !important;
|
|
256
|
+
|
|
257
|
+
td {
|
|
258
|
+
padding: 10px;
|
|
259
|
+
color: ${colours.functional.primary};
|
|
260
|
+
font-family: ${fonts.supporting};
|
|
261
|
+
font-size: 13px;
|
|
262
|
+
line-height: 16px;
|
|
263
|
+
background-color: transparent;
|
|
264
|
+
|
|
265
|
+
span {
|
|
266
|
+
font-size: inherit;
|
|
267
|
+
line-height: inherit;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
span.Opta-agg-text {
|
|
271
|
+
text-transform: uppercase;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
tr {
|
|
277
|
+
td.Opta-Nest {
|
|
278
|
+
padding: 0;
|
|
279
|
+
|
|
280
|
+
.Opta_W {
|
|
281
|
+
> .Opta-Cf {
|
|
282
|
+
background-color: transparent;
|
|
283
|
+
border-bottom: 1px solid #e4e4e4;
|
|
284
|
+
|
|
285
|
+
.Opta-Events {
|
|
286
|
+
padding: 10px 0 2px 0;
|
|
287
|
+
|
|
288
|
+
li {
|
|
289
|
+
padding: 0 0 8px 0;
|
|
290
|
+
|
|
291
|
+
.Opta-Event-Text {
|
|
292
|
+
color: ${colours.functional.primary};
|
|
293
|
+
font-family: ${fonts.supporting};
|
|
294
|
+
font-size: 13px;
|
|
295
|
+
line-height: 16px;
|
|
296
|
+
|
|
297
|
+
.Opta-Event-Player,
|
|
298
|
+
.Opta-Event-Time {
|
|
299
|
+
font-size: inherit;
|
|
300
|
+
line-height: inherit;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.Opta-Event-Time {
|
|
304
|
+
color: ${colours.section.sport};
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
`;
|