@times-components/ts-components 1.145.1-777882a8b99dc7733f00b94202a91fa8b7dc2a7e.1 → 1.145.1-7822206a549cb799b9eb65f35228b22be1db32a1.5

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 (57) hide show
  1. package/dist/components/opta/football/opta-match-stats/shared/styles.js +1 -8
  2. package/dist/components/{opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.d.ts → travel-mini-cta/__tests__/index.test.d.ts} +0 -1
  3. package/dist/components/travel-mini-cta/__tests__/index.test.js +346 -0
  4. package/dist/components/travel-mini-cta/index.d.ts +3 -0
  5. package/dist/components/travel-mini-cta/index.js +86 -0
  6. package/dist/components/travel-mini-cta/styles.d.ts +42 -0
  7. package/dist/components/travel-mini-cta/styles.js +268 -0
  8. package/dist/components/travel-mini-cta/travel-mini-cta.stories.js +8 -0
  9. package/dist/components/travel-mini-cta/types.d.ts +10 -0
  10. package/dist/components/travel-mini-cta/types.js +2 -0
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/utils/applyDarkMode.d.ts +1 -0
  14. package/dist/utils/applyDarkMode.js +12 -0
  15. package/dist/utils/getMediaQuery.d.ts +11 -0
  16. package/dist/utils/getMediaQuery.js +19 -0
  17. package/dist/utils/index.d.ts +2 -0
  18. package/dist/utils/index.js +3 -0
  19. package/package.json +3 -3
  20. package/rnw.js +1 -1
  21. package/src/components/opta/football/opta-match-stats/commentary/__tests__/__snapshots__/OptaMatchStatsCommentary.test.tsx.snap +1 -1
  22. package/src/components/opta/football/opta-match-stats/shared/styles.ts +0 -8
  23. package/src/components/opta/football/opta-match-stats/stats-graphs/__tests__/__snapshots__/OptaMatchStatsGraphs.test.tsx.snap +1 -1
  24. package/src/components/travel-mini-cta/__tests__/__snapshots__/index.test.tsx.snap +209 -0
  25. package/src/components/travel-mini-cta/__tests__/index.test.tsx +435 -0
  26. package/src/components/travel-mini-cta/index.tsx +164 -0
  27. package/src/components/travel-mini-cta/styles.ts +331 -0
  28. package/src/components/travel-mini-cta/travel-mini-cta.stories.tsx +23 -0
  29. package/src/components/travel-mini-cta/types.ts +10 -0
  30. package/src/index.ts +1 -3
  31. package/src/utils/applyDarkMode.ts +12 -0
  32. package/src/utils/getMediaQuery.ts +25 -0
  33. package/src/utils/index.ts +2 -0
  34. package/dist/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.d.ts +0 -10
  35. package/dist/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.js +0 -69
  36. package/dist/components/opta/football/opta-match-stats/matchday-live/MobileWidget.d.ts +0 -12
  37. package/dist/components/opta/football/opta-match-stats/matchday-live/MobileWidget.js +0 -90
  38. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.d.ts +0 -12
  39. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.js +0 -10
  40. package/dist/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.js +0 -24
  41. package/dist/components/opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.js +0 -48
  42. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.d.ts +0 -1
  43. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.js +0 -19
  44. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.d.ts +0 -12
  45. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.js +0 -67
  46. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.d.ts +0 -6
  47. package/dist/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.js +0 -714
  48. package/src/components/opta/football/opta-match-stats/matchday-live/DesktopWidget.tsx +0 -108
  49. package/src/components/opta/football/opta-match-stats/matchday-live/MobileWidget.tsx +0 -158
  50. package/src/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.tsx +0 -38
  51. package/src/components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.tsx +0 -23
  52. package/src/components/opta/football/opta-match-stats/matchday-live/__tests__/OptaMatchStatsMatchdayLive.test.tsx +0 -61
  53. package/src/components/opta/football/opta-match-stats/matchday-live/__tests__/__snapshots__/OptaMatchStatsMatchdayLive.test.tsx.snap +0 -61
  54. package/src/components/opta/football/opta-match-stats/matchday-live/styles/MatchdayLiveController.tsx +0 -19
  55. package/src/components/opta/football/opta-match-stats/matchday-live/styles/NavigationWrapper.tsx +0 -81
  56. package/src/components/opta/football/opta-match-stats/matchday-live/styles/WidgetContainer.tsx +0 -745
  57. /package/dist/components/{opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive.stories.d.ts → travel-mini-cta/travel-mini-cta.stories.d.ts} +0 -0
@@ -0,0 +1,164 @@
1
+ import React, { FC, useState, useRef, useEffect, MouseEvent } from 'react';
2
+ import { TravelMiniCTAProps } from './types';
3
+ import {
4
+ Container,
5
+ ContentWrapper,
6
+ LeftSection,
7
+ LogoContainer,
8
+ LogoBox,
9
+ LogoText,
10
+ TextContainer,
11
+ Label,
12
+ MobileLabel,
13
+ Description,
14
+ RightSection,
15
+ ContactInfo,
16
+ PhoneLabel,
17
+ PhoneNumber,
18
+ WorkingHoursContainer,
19
+ WorkingHoursText,
20
+ ButtonsContainer,
21
+ PrimaryButton,
22
+ SecondaryButton
23
+ } from './styles';
24
+
25
+ export const TravelMiniCTA: FC<TravelMiniCTAProps> = ({
26
+ description,
27
+ phoneLabel,
28
+ phoneNumber,
29
+ workingHours,
30
+ primaryButtonText,
31
+ secondaryButtonText,
32
+ secondaryButtonUrl,
33
+ isApp
34
+ }) => {
35
+ const [chatReady, setChatReady] = useState(false);
36
+ const [chatFailed, setChatFailed] = useState(false);
37
+ const chatDivRef = useRef<HTMLDivElement>(null);
38
+
39
+ const formattedWorkingHours = workingHours
40
+ ? workingHours.split(',').map(hour => hour.trim())
41
+ : [];
42
+
43
+ const handlePrimaryButtonClick = (
44
+ e: MouseEvent<HTMLButtonElement | HTMLAnchorElement>
45
+ ) => {
46
+ e.preventDefault();
47
+
48
+ const chatDiv = chatDivRef.current;
49
+ if (chatDiv) {
50
+ const lpEventElement = chatDiv.querySelector(
51
+ '[data-lp-event]'
52
+ ) as HTMLElement;
53
+ if (lpEventElement) {
54
+ lpEventElement.click();
55
+ }
56
+ }
57
+ };
58
+
59
+ useEffect(
60
+ () => {
61
+ const chatDiv = chatDivRef.current;
62
+ if (!chatDiv || typeof window === 'undefined') {
63
+ return;
64
+ }
65
+
66
+ let timeoutId: NodeJS.Timeout | null = null;
67
+ let previouslyFound = false;
68
+
69
+ const observer = new MutationObserver(() => {
70
+ const lpEventElement = chatDiv.querySelector(
71
+ '[data-lp-event]'
72
+ ) as HTMLElement;
73
+
74
+ if (lpEventElement && !previouslyFound) {
75
+ previouslyFound = true;
76
+ setChatReady(true);
77
+ setChatFailed(false);
78
+
79
+ if (primaryButtonText) {
80
+ lpEventElement.textContent = primaryButtonText;
81
+ }
82
+
83
+ // Clear timeout since chat loaded successfully
84
+ if (timeoutId) {
85
+ clearTimeout(timeoutId);
86
+ timeoutId = null;
87
+ }
88
+ } else if (!lpEventElement && previouslyFound) {
89
+ previouslyFound = false;
90
+ setChatReady(false);
91
+ setChatFailed(false);
92
+ }
93
+ });
94
+
95
+ observer.observe(chatDiv, { childList: true, subtree: true });
96
+
97
+ timeoutId = setTimeout(() => {
98
+ if (!previouslyFound) {
99
+ observer.disconnect();
100
+ setChatFailed(true);
101
+ }
102
+ }, 15000);
103
+
104
+ return () => {
105
+ observer.disconnect();
106
+ if (timeoutId) {
107
+ clearTimeout(timeoutId);
108
+ }
109
+ };
110
+ },
111
+ [primaryButtonText]
112
+ );
113
+
114
+ return (
115
+ <Container data-testid="travel-mini-cta" isApp={isApp}>
116
+ <ContentWrapper>
117
+ <LeftSection>
118
+ <LogoContainer>
119
+ <LogoBox isApp={isApp}>
120
+ <LogoText isApp={isApp}>T</LogoText>
121
+ </LogoBox>
122
+ <MobileLabel isApp={isApp}>VISIT TIMES HOLIDAYS</MobileLabel>
123
+ </LogoContainer>
124
+ <TextContainer>
125
+ <Label isApp={isApp}>VISIT TIMES HOLIDAYS</Label>
126
+ <Description isApp={isApp}>{description}</Description>
127
+ </TextContainer>
128
+ </LeftSection>
129
+
130
+ <RightSection>
131
+ <ContactInfo>
132
+ <PhoneLabel href={`tel:${phoneNumber}`} isApp={isApp}>
133
+ {phoneLabel}{' '}
134
+ <PhoneNumber isApp={isApp}>{phoneNumber}</PhoneNumber>
135
+ </PhoneLabel>
136
+ <WorkingHoursContainer>
137
+ {formattedWorkingHours.map((hours, index) => (
138
+ <WorkingHoursText key={index} isApp={isApp}>
139
+ {hours}
140
+ </WorkingHoursText>
141
+ ))}
142
+ </WorkingHoursContainer>
143
+ </ContactInfo>
144
+ <ButtonsContainer>
145
+ <PrimaryButton
146
+ as="button"
147
+ type="button"
148
+ onClick={handlePrimaryButtonClick}
149
+ isApp={isApp}
150
+ disabled={!chatReady}
151
+ >
152
+ {chatFailed && 'Chat unavailable'}
153
+ {!chatReady && !chatFailed && 'Loading chat...'}
154
+ <div id="LP_DIV_TRAVEL_1239001" ref={chatDivRef} />
155
+ </PrimaryButton>
156
+ <SecondaryButton href={secondaryButtonUrl} isApp={isApp}>
157
+ {secondaryButtonText}
158
+ </SecondaryButton>
159
+ </ButtonsContainer>
160
+ </RightSection>
161
+ </ContentWrapper>
162
+ </Container>
163
+ );
164
+ };
@@ -0,0 +1,331 @@
1
+ import styled from 'styled-components';
2
+ import { getMediaQuery, applyDarkMode } from '../../utils';
3
+
4
+ const BaseLabel = styled.div<{ isApp?: boolean }>`
5
+ font-family: 'Roboto';
6
+ font-weight: 500;
7
+ line-height: 1.125;
8
+ font-size: 14px;
9
+ letter-spacing: 0em;
10
+ color: #236fa3;
11
+ text-transform: uppercase;
12
+
13
+ ${({ isApp }) =>
14
+ applyDarkMode(
15
+ `
16
+ color: #f5f5f5 !important;
17
+ `,
18
+ isApp
19
+ )};
20
+ `;
21
+
22
+ export const Container = styled.div<{ isApp?: boolean }>`
23
+ background-color: #ffffff;
24
+ padding: 24px;
25
+ border-top: 1px dashed;
26
+ border-bottom: 1px dashed;
27
+ border-color: #cccccc;
28
+
29
+ ${({ isApp }) =>
30
+ applyDarkMode(
31
+ `
32
+ background-color: #f5f5f5 !important;
33
+ border-color: #e4e4e4 !important;
34
+ `,
35
+ isApp
36
+ )};
37
+ `;
38
+
39
+ export const ContentWrapper = styled.div`
40
+ display: flex;
41
+ justify-content: space-between;
42
+ align-items: flex-start;
43
+ gap: 20px;
44
+
45
+ ${getMediaQuery('xs', 'md')} {
46
+ flex-direction: column;
47
+ gap: 24px;
48
+ }
49
+ `;
50
+
51
+ export const LeftSection = styled.div`
52
+ display: flex;
53
+ align-items: flex-start;
54
+ width: 50%;
55
+ gap: 24px;
56
+
57
+ ${getMediaQuery('xs', 'md')} {
58
+ width: 100%;
59
+ flex-direction: column;
60
+ gap: 16px;
61
+ }
62
+ `;
63
+
64
+ export const LogoContainer = styled.div`
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ flex-shrink: 0;
69
+
70
+ ${getMediaQuery('xs', 'md')} {
71
+ flex-direction: row-reverse;
72
+ justify-content: flex-start;
73
+ justify-content: space-between;
74
+ width: 100%;
75
+ }
76
+ `;
77
+
78
+ export const LogoBox = styled.div<{ isApp?: boolean }>`
79
+ width: 40px;
80
+ height: 40px;
81
+ position: relative;
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ background-color: #236fa3;
86
+
87
+ ${({ isApp }) =>
88
+ applyDarkMode(
89
+ `
90
+ background-color: #c2c2c2 !important;
91
+ `,
92
+ isApp
93
+ )};
94
+ `;
95
+
96
+ export const LogoText = styled.span<{ isApp?: boolean }>`
97
+ font-family: 'Times Modern', serif;
98
+ font-weight: 700;
99
+ font-size: 40px;
100
+ line-height: 1.125;
101
+ letter-spacing: 0.02em;
102
+ color: #ffffff;
103
+ padding-top: 4px;
104
+
105
+ ${({ isApp }) =>
106
+ applyDarkMode(
107
+ `
108
+ color: #1d1d1b !important;
109
+ `,
110
+ isApp
111
+ )};
112
+ `;
113
+
114
+ export const TextContainer = styled.div`
115
+ display: flex;
116
+ flex-direction: column;
117
+ gap: 16px;
118
+ max-width: 375px;
119
+
120
+ ${getMediaQuery('xs', 'md')} {
121
+ gap: 24px;
122
+ }
123
+ `;
124
+
125
+ export const Label = styled(BaseLabel)`
126
+ ${getMediaQuery('xs', 'md')} {
127
+ display: none;
128
+ }
129
+ `;
130
+
131
+ export const MobileLabel = styled(BaseLabel)`
132
+ display: none;
133
+
134
+ ${getMediaQuery('xs', 'md')} {
135
+ display: block;
136
+ }
137
+ `;
138
+
139
+ export const Description = styled.div<{ isApp?: boolean }>`
140
+ font-family: 'Times Modern';
141
+ font-weight: 700;
142
+ line-height: 1.125;
143
+ font-size: 24px;
144
+ letter-spacing: 0em;
145
+ color: #333333;
146
+
147
+ ${({ isApp }) =>
148
+ applyDarkMode(
149
+ `
150
+ color: #cccccc !important;
151
+ `,
152
+ isApp
153
+ )};
154
+
155
+ ${getMediaQuery('xs', 'md')} {
156
+ margin-right: 64px;
157
+ }
158
+ `;
159
+
160
+ export const RightSection = styled.div`
161
+ display: flex;
162
+ flex-direction: column;
163
+ gap: 24px;
164
+ width: 50%;
165
+
166
+ ${getMediaQuery('xs', 'md')} {
167
+ gap: 32px;
168
+ width: 100%;
169
+ }
170
+ `;
171
+
172
+ export const ContactInfo = styled.div`
173
+ display: flex;
174
+ flex-direction: column;
175
+ gap: 16px;
176
+ `;
177
+
178
+ export const PhoneLabel = styled.a<{ isApp?: boolean }>`
179
+ text-decoration: none;
180
+ display: inline;
181
+ font-family: 'Times Digital W04 Regular';
182
+ font-weight: 400;
183
+ line-height: 1.5;
184
+ font-size: 18px;
185
+ letter-spacing: 0em;
186
+ color: #333333;
187
+ cursor: pointer;
188
+
189
+ ${({ isApp }) =>
190
+ applyDarkMode(
191
+ `
192
+ color: #c2c2c2 !important;
193
+ `,
194
+ isApp
195
+ )};
196
+
197
+ &:hover {
198
+ text-decoration: underline;
199
+ }
200
+ `;
201
+
202
+ export const PhoneNumber = styled.span<{ isApp?: boolean }>`
203
+ font-family: 'Times Modern';
204
+ font-weight: 700;
205
+ line-height: 1.125;
206
+ font-size: 22px;
207
+ letter-spacing: 0em;
208
+ color: #333333;
209
+
210
+ ${({ isApp }) =>
211
+ applyDarkMode(
212
+ `
213
+ color: #c2c2c2 !important;
214
+ `,
215
+ isApp
216
+ )};
217
+ `;
218
+
219
+ export const WorkingHoursContainer = styled.div`
220
+ display: flex;
221
+ flex-wrap: wrap;
222
+ gap: 8px;
223
+
224
+ ${getMediaQuery('xs', 'md')} {
225
+ flex-direction: column;
226
+ }
227
+ `;
228
+
229
+ export const WorkingHoursText = styled.div<{ isApp?: boolean }>`
230
+ font-family: 'Times Digital W04 Regular';
231
+ font-weight: 400;
232
+ line-height: 1.5;
233
+ font-size: 18px;
234
+ letter-spacing: 0em;
235
+ color: #333333;
236
+
237
+ ${({ isApp }) =>
238
+ applyDarkMode(
239
+ `
240
+ color: #cccccc !important;
241
+ `,
242
+ isApp
243
+ )};
244
+ `;
245
+
246
+ export const ButtonsContainer = styled.div`
247
+ display: flex;
248
+ gap: 16px;
249
+
250
+ ${getMediaQuery('xs', 'md')} {
251
+ flex-direction: column;
252
+ }
253
+ `;
254
+
255
+ const BaseButton = styled.a`
256
+ text-decoration: none;
257
+ border-radius: 0px;
258
+ width: 100%;
259
+ min-height: 44px;
260
+ font-family: 'Roboto';
261
+ font-weight: 500;
262
+ line-height: 1.5;
263
+ font-size: 16px;
264
+ letter-spacing: 0em;
265
+ display: flex;
266
+ align-items: center;
267
+ justify-content: center;
268
+ padding: 12px;
269
+ cursor: pointer;
270
+ transition: all 0.2s ease;
271
+ `;
272
+
273
+ export const PrimaryButton = styled(BaseButton)<{
274
+ disabled?: boolean;
275
+ isApp?: boolean;
276
+ }>`
277
+ border: none;
278
+ background-color: #005c8a;
279
+ color: #ffffff;
280
+ cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
281
+ opacity: ${({ disabled }) => (disabled ? 0.6 : 1)};
282
+
283
+ div[data-lp-event] {
284
+ cursor: pointer;
285
+ font-family: 'Roboto';
286
+ font-weight: 500;
287
+ line-height: 1.5;
288
+ font-size: 16px;
289
+ letter-spacing: 0em;
290
+ }
291
+
292
+ &:hover {
293
+ background-color: #00527a;
294
+ }
295
+
296
+ ${({ isApp }) =>
297
+ applyDarkMode(
298
+ `
299
+ background-color: #74bade !important;
300
+ color: #1d1d1b !important;
301
+
302
+ &:hover {
303
+ background-color: #93cbe8 !important;
304
+ }
305
+ `,
306
+ isApp
307
+ )};
308
+ `;
309
+
310
+ export const SecondaryButton = styled(BaseButton)<{ isApp?: boolean }>`
311
+ border: 1px solid #005c8a;
312
+ background-color: transparent;
313
+ color: #005c8a;
314
+
315
+ &:hover {
316
+ background-color: #f5f5f5;
317
+ }
318
+
319
+ ${({ isApp }) =>
320
+ applyDarkMode(
321
+ `
322
+ border-color: #74bade !important;
323
+ color: #74bade !important;
324
+
325
+ &:hover {
326
+ background-color: #01000d !important;
327
+ }
328
+ `,
329
+ isApp
330
+ )};
331
+ `;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { TravelMiniCTA } from './index';
4
+ import { ArticleHarness } from '../../fixtures/article-harness/ArticleHarness';
5
+
6
+ storiesOf('Typescript Component/In Article/Travel Mini CTA', module).add(
7
+ 'Travel Mini CTA',
8
+ () => (
9
+ <ArticleHarness>
10
+ <div style={{ padding: '16px' }}>
11
+ <TravelMiniCTA
12
+ description="Begin your journey to Croatia with a holiday designed around you, guided by a dedicated travel expert."
13
+ phoneLabel="Call us on"
14
+ phoneNumber="08083049757"
15
+ workingHours="Mon - Fri: 9am - 6pm, Sat: 10am - 5pm"
16
+ primaryButtonText="Chat with us"
17
+ secondaryButtonText="Enquire now"
18
+ secondaryButtonUrl="/enquire"
19
+ />
20
+ </div>
21
+ </ArticleHarness>
22
+ )
23
+ );
@@ -0,0 +1,10 @@
1
+ export interface TravelMiniCTAProps {
2
+ description?: string;
3
+ phoneLabel?: string;
4
+ phoneNumber?: string;
5
+ workingHours?: string;
6
+ primaryButtonText?: string;
7
+ secondaryButtonText?: string;
8
+ secondaryButtonUrl?: string;
9
+ isApp?: boolean;
10
+ }
package/src/index.ts CHANGED
@@ -32,6 +32,7 @@ export {
32
32
  } from './components/update-button/update-button-with-delay';
33
33
  export { Banner } from './components/banner/banner';
34
34
  export { JobTitle } from './components/job-title/job-title';
35
+ export { TravelMiniCTA } from './components/travel-mini-cta';
35
36
 
36
37
  // Newsletter Components
37
38
  export {
@@ -152,6 +153,3 @@ export {
152
153
  export {
153
154
  OptaMatchStatsCommentary
154
155
  } from './components/opta/football/opta-match-stats/commentary/OptaMatchStatsCommentary';
155
- export {
156
- OptaMatchStatsMatchdayLive
157
- } from './components/opta/football/opta-match-stats/matchday-live/OptaMatchStatsMatchdayLive';
@@ -0,0 +1,12 @@
1
+ // Helper for dark mode styling
2
+ export const applyDarkMode = (styles: string, isApp?: boolean) => {
3
+ if (!isApp) {
4
+ return '';
5
+ }
6
+
7
+ return `
8
+ @media (prefers-color-scheme: dark) {
9
+ ${styles}
10
+ }
11
+ `;
12
+ };
@@ -0,0 +1,25 @@
1
+ export const breakpoints = {
2
+ xs: 0,
3
+ sm: 520,
4
+ md: 768,
5
+ lg: 1024,
6
+ xl: 1320,
7
+ all: 0
8
+ };
9
+
10
+ export type BreakPointKeys = keyof typeof breakpoints;
11
+ export type MQ = Partial<Record<BreakPointKeys, string>> | string;
12
+
13
+ export const getMediaQuery = (
14
+ minWidth?: keyof typeof breakpoints,
15
+ maxWidth?: keyof typeof breakpoints
16
+ ) => () => {
17
+ const queries = ['@media screen'];
18
+ if (minWidth && breakpoints[minWidth]) {
19
+ queries.push(` and (min-width: ${breakpoints[minWidth]}px)`);
20
+ }
21
+ if (maxWidth) {
22
+ queries.push(` and (max-width: ${breakpoints[maxWidth] - 1}px)`);
23
+ }
24
+ return queries.join('');
25
+ };
@@ -0,0 +1,2 @@
1
+ export { applyDarkMode } from './applyDarkMode';
2
+ export { getMediaQuery } from './getMediaQuery';
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { TeamColor } from '../shared/types';
3
- export declare const DesktopWidget: React.FC<{
4
- season: string;
5
- competition: string;
6
- match: string;
7
- isApp?: boolean;
8
- homeTeamColor?: TeamColor;
9
- awayTeamColor?: TeamColor;
10
- }>;
@@ -1,69 +0,0 @@
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 { PlaceholderContainer } from '../../../shared/shared-styles';
5
- import { WidgetContainer } from './styles/WidgetContainer';
6
- import { WidgetWrapper } from '../shared/styles';
7
- export const DesktopWidget = React.memo(({ season, competition, match, isApp = false, homeTeamColor = { light: '#000000', dark: '#a19c9cff' }, awayTeamColor = { light: '#007A3F', dark: '#007A3F' } }) => {
8
- const ref = React.createRef();
9
- const [isReady, setIsReady] = useState(false);
10
- useEffect(() => {
11
- const sport = 'football';
12
- initSettings();
13
- initStyleSheet(sport);
14
- initScript()
15
- .then(() => {
16
- if (ref.current) {
17
- ref.current.innerHTML = initElement('opta-widget', {
18
- sport,
19
- widget: 'matchday_live',
20
- season,
21
- competition,
22
- match,
23
- template: 'normal',
24
- live: true,
25
- orientation: 'horizontal',
26
- side: 'both',
27
- show_match_header: true,
28
- show_crests: true,
29
- show_pitch_crests: false,
30
- show_team_formation: true,
31
- show_score: false,
32
- show_halftime_score: false,
33
- show_competition_name: false,
34
- show_date: false,
35
- date_format: 'dddd D MMMM YYYY',
36
- narrow_date_format: 'DD/MM/YY',
37
- show_referee: true,
38
- show_venue: true,
39
- show_attendance: true,
40
- show_images: false,
41
- show_pitch_images: false,
42
- show_team_sheets: false,
43
- show_event_icons: true,
44
- show_player_names: true,
45
- show_player_stats: true,
46
- show_subs: 'all',
47
- competition_naming: 'brief',
48
- team_naming: 'full',
49
- player_naming: 'last_name',
50
- show_live: false,
51
- show_logo: false,
52
- show_title: false,
53
- breakpoints: '400, 700'
54
- }).outerHTML;
55
- initComponent();
56
- }
57
- })
58
- .then(() => {
59
- setIsReady(true);
60
- });
61
- }, []);
62
- return (React.createElement(React.Fragment, null,
63
- React.createElement(WidgetWrapper, { isApp: isApp, className: "matchday-live-widget-desktop" },
64
- React.createElement("h3", null, "Line-ups"),
65
- React.createElement(WidgetContainer, { ref: ref, isApp: isApp, homeTeamColor: homeTeamColor, awayTeamColor: awayTeamColor })),
66
- !isReady && (React.createElement(PlaceholderContainer, { "data-testid": "placeholder" },
67
- React.createElement(Placeholder, null)))));
68
- });
69
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGVza3RvcFdpZGdldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL29wdGEvZm9vdGJhbGwvb3B0YS1tYXRjaC1zdGF0cy9tYXRjaGRheS1saXZlL0Rlc2t0b3BXaWRnZXQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEVBQUUsUUFBUSxFQUFFLFNBQVMsRUFBRSxNQUFNLE9BQU8sQ0FBQztBQUNuRCxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDdEQsT0FBTyxFQUNMLFlBQVksRUFDWixjQUFjLEVBQ2QsVUFBVSxFQUNWLFdBQVcsRUFDWCxhQUFhLEVBQ2QsTUFBTSx1QkFBdUIsQ0FBQztBQUMvQixPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUNyRSxPQUFP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RQUNuQixDQUFDLENBQUMsQ0FBQztJQUNQLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQztJQUVQLE9BQU8sQ0FDTDtRQUNFLG9CQUFDLGFBQWEsSUFBQyxLQUFLLEVBQUUsS0FBSyxFQUFFLFNBQVMsRUFBQyw4QkFBOEI7WUFDbkUsMkNBQWlCO1lBQ2pCLG9CQUFDLGVBQWUsSUFDZCxHQUFHLEVBQUUsR0FBRyxFQUNSLEtBQUssRUFBRSxLQUFLLEVBQ1osYUFBYSxFQUFFLGFBQWEsRUFDNUIsYUFBYSxFQUFFLGFBQWEsR0FDNUIsQ0FDWTtRQUNmLENBQUMsT0FBTyxJQUFJLENBQ1gsb0JBQUMsb0JBQW9CLG1CQUFhLGFBQWE7WUFDN0Msb0JBQUMsV0FBVyxPQUFHLENBQ00sQ0FDeEIsQ0FDQSxDQUNKLENBQUM7QUFDSixDQUFDLENBQ0YsQ0FBQyJ9
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { TeamColor } from '../shared/types';
3
- export declare const MobileWidget: React.FC<{
4
- season: string;
5
- competition: string;
6
- match: string;
7
- isApp?: boolean;
8
- homeTeamColor?: TeamColor;
9
- awayTeamColor?: TeamColor;
10
- homeTeamName: string;
11
- awayTeamName: string;
12
- }>;