@times-components/ts-components 1.146.2-be27d508c972211ad80599875cd69c63bf67d4b1.45 → 1.146.2-c9973aa4b92ab539c7e626ec928a64701390290d.3

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 (132) hide show
  1. package/dist/components/social-embed/SocialVendor.d.ts +3 -0
  2. package/dist/components/social-embed/SocialVendor.js +4 -2
  3. package/dist/components/social-embed/__tests__/SocialVendor.test.js +8 -1
  4. package/dist/components/social-embed/components/FacebookComponent.d.ts +3 -0
  5. package/dist/components/social-embed/components/FacebookComponent.js +28 -0
  6. package/dist/components/social-embed/constants.d.ts +1 -0
  7. package/dist/components/social-embed/constants.js +3 -2
  8. package/dist/components/social-embed/helpers/socialMediaVendors.js +6 -1
  9. package/dist/components/social-embed/styles.d.ts +1 -0
  10. package/dist/components/social-embed/styles.js +28 -1
  11. package/dist/index.d.ts +0 -1
  12. package/dist/index.js +1 -2
  13. package/package.json +12 -12
  14. package/rnw.js +1 -1
  15. package/src/components/social-embed/SocialVendor.tsx +3 -1
  16. package/src/components/social-embed/__tests__/SocialVendor.test.tsx +11 -0
  17. package/src/components/social-embed/components/FacebookComponent.tsx +38 -0
  18. package/src/components/social-embed/constants.ts +2 -1
  19. package/src/components/social-embed/helpers/socialMediaVendors.ts +5 -0
  20. package/src/components/social-embed/styles.ts +30 -0
  21. package/src/index.ts +0 -2
  22. package/dist/components/carousel-component/CarouselComponent.stories.d.ts +0 -1
  23. package/dist/components/carousel-component/CarouselComponent.stories.js +0 -146
  24. package/dist/components/carousel-component/CarouselItem.d.ts +0 -3
  25. package/dist/components/carousel-component/CarouselItem.js +0 -12
  26. package/dist/components/carousel-component/DefaultNavigationArrow.d.ts +0 -8
  27. package/dist/components/carousel-component/DefaultNavigationArrow.js +0 -6
  28. package/dist/components/carousel-component/DefaultPageDot.d.ts +0 -8
  29. package/dist/components/carousel-component/DefaultPageDot.js +0 -4
  30. package/dist/components/carousel-component/__tests__/CarouselComponent.test.d.ts +0 -1
  31. package/dist/components/carousel-component/__tests__/CarouselComponent.test.js +0 -163
  32. package/dist/components/carousel-component/__tests__/CarouselItem.test.d.ts +0 -1
  33. package/dist/components/carousel-component/__tests__/CarouselItem.test.js +0 -80
  34. package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.d.ts +0 -1
  35. package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.js +0 -62
  36. package/dist/components/carousel-component/__tests__/DefaultPageDot.test.d.ts +0 -1
  37. package/dist/components/carousel-component/__tests__/DefaultPageDot.test.js +0 -68
  38. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.d.ts +0 -1
  39. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.js +0 -459
  40. package/dist/components/carousel-component/hooks/useCarousel.d.ts +0 -2
  41. package/dist/components/carousel-component/hooks/useCarousel.js +0 -167
  42. package/dist/components/carousel-component/index.d.ts +0 -4
  43. package/dist/components/carousel-component/index.js +0 -20
  44. package/dist/components/carousel-component/styles.d.ts +0 -28
  45. package/dist/components/carousel-component/styles.js +0 -172
  46. package/dist/components/carousel-component/types.d.ts +0 -53
  47. package/dist/components/carousel-component/types.js +0 -2
  48. package/dist/components/trip-cards/SkeletonCard.d.ts +0 -7
  49. package/dist/components/trip-cards/SkeletonCard.js +0 -22
  50. package/dist/components/trip-cards/TripCard.d.ts +0 -3
  51. package/dist/components/trip-cards/TripCard.js +0 -49
  52. package/dist/components/trip-cards/TripCards.stories.d.ts +0 -1
  53. package/dist/components/trip-cards/TripCards.stories.js +0 -159
  54. package/dist/components/trip-cards/TripCardsLayout.d.ts +0 -3
  55. package/dist/components/trip-cards/TripCardsLayout.js +0 -56
  56. package/dist/components/trip-cards/__tests__/SkeletonCard.test.d.ts +0 -1
  57. package/dist/components/trip-cards/__tests__/SkeletonCard.test.js +0 -139
  58. package/dist/components/trip-cards/__tests__/TripCard.test.d.ts +0 -1
  59. package/dist/components/trip-cards/__tests__/TripCard.test.js +0 -95
  60. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.d.ts +0 -1
  61. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.js +0 -314
  62. package/dist/components/trip-cards/__tests__/assets.test.d.ts +0 -1
  63. package/dist/components/trip-cards/__tests__/assets.test.js +0 -165
  64. package/dist/components/trip-cards/__tests__/helpers.test.d.ts +0 -1
  65. package/dist/components/trip-cards/__tests__/helpers.test.js +0 -220
  66. package/dist/components/trip-cards/__tests__/index.test.d.ts +0 -1
  67. package/dist/components/trip-cards/__tests__/index.test.js +0 -478
  68. package/dist/components/trip-cards/__tests__/mockData.test.d.ts +0 -1
  69. package/dist/components/trip-cards/__tests__/mockData.test.js +0 -57
  70. package/dist/components/trip-cards/__tests__/skeletonStyles.test.d.ts +0 -1
  71. package/dist/components/trip-cards/__tests__/skeletonStyles.test.js +0 -194
  72. package/dist/components/trip-cards/assets/BoatIcon.d.ts +0 -1
  73. package/dist/components/trip-cards/assets/BoatIcon.js +0 -4
  74. package/dist/components/trip-cards/assets/CalendarIcon.d.ts +0 -1
  75. package/dist/components/trip-cards/assets/CalendarIcon.js +0 -4
  76. package/dist/components/trip-cards/assets/ChevronRightIcon.d.ts +0 -1
  77. package/dist/components/trip-cards/assets/ChevronRightIcon.js +0 -4
  78. package/dist/components/trip-cards/assets/LocationIcon.d.ts +0 -1
  79. package/dist/components/trip-cards/assets/LocationIcon.js +0 -4
  80. package/dist/components/trip-cards/assets/MoonIcon.d.ts +0 -1
  81. package/dist/components/trip-cards/assets/MoonIcon.js +0 -4
  82. package/dist/components/trip-cards/assets/index.d.ts +0 -6
  83. package/dist/components/trip-cards/assets/index.js +0 -7
  84. package/dist/components/trip-cards/helpers.d.ts +0 -11
  85. package/dist/components/trip-cards/helpers.js +0 -138
  86. package/dist/components/trip-cards/index.d.ts +0 -4
  87. package/dist/components/trip-cards/index.js +0 -68
  88. package/dist/components/trip-cards/mockData.d.ts +0 -3
  89. package/dist/components/trip-cards/mockData.js +0 -317
  90. package/dist/components/trip-cards/skeletonStyles.d.ts +0 -9
  91. package/dist/components/trip-cards/skeletonStyles.js +0 -37
  92. package/dist/components/trip-cards/styles.d.ts +0 -43
  93. package/dist/components/trip-cards/styles.js +0 -404
  94. package/dist/components/trip-cards/types.d.ts +0 -119
  95. package/dist/components/trip-cards/types.js +0 -2
  96. package/src/components/carousel-component/CarouselComponent.stories.tsx +0 -220
  97. package/src/components/carousel-component/CarouselItem.tsx +0 -26
  98. package/src/components/carousel-component/DefaultNavigationArrow.tsx +0 -37
  99. package/src/components/carousel-component/DefaultPageDot.tsx +0 -20
  100. package/src/components/carousel-component/__tests__/CarouselComponent.test.tsx +0 -259
  101. package/src/components/carousel-component/__tests__/CarouselItem.test.tsx +0 -140
  102. package/src/components/carousel-component/__tests__/DefaultNavigationArrow.test.tsx +0 -153
  103. package/src/components/carousel-component/__tests__/DefaultPageDot.test.tsx +0 -105
  104. package/src/components/carousel-component/hooks/__tests__/useCarousel.test.ts +0 -625
  105. package/src/components/carousel-component/hooks/useCarousel.ts +0 -229
  106. package/src/components/carousel-component/index.tsx +0 -92
  107. package/src/components/carousel-component/styles.ts +0 -188
  108. package/src/components/carousel-component/types.ts +0 -62
  109. package/src/components/trip-cards/SkeletonCard.tsx +0 -64
  110. package/src/components/trip-cards/TripCard.tsx +0 -140
  111. package/src/components/trip-cards/TripCards.stories.tsx +0 -224
  112. package/src/components/trip-cards/TripCardsLayout.tsx +0 -145
  113. package/src/components/trip-cards/__tests__/SkeletonCard.test.tsx +0 -169
  114. package/src/components/trip-cards/__tests__/TripCard.test.tsx +0 -120
  115. package/src/components/trip-cards/__tests__/TripCardsLayout.test.tsx +0 -583
  116. package/src/components/trip-cards/__tests__/assets.test.tsx +0 -206
  117. package/src/components/trip-cards/__tests__/helpers.test.ts +0 -272
  118. package/src/components/trip-cards/__tests__/index.test.tsx +0 -550
  119. package/src/components/trip-cards/__tests__/mockData.test.ts +0 -67
  120. package/src/components/trip-cards/__tests__/skeletonStyles.test.tsx +0 -256
  121. package/src/components/trip-cards/assets/BoatIcon.tsx +0 -17
  122. package/src/components/trip-cards/assets/CalendarIcon.tsx +0 -17
  123. package/src/components/trip-cards/assets/ChevronRightIcon.tsx +0 -20
  124. package/src/components/trip-cards/assets/LocationIcon.tsx +0 -17
  125. package/src/components/trip-cards/assets/MoonIcon.tsx +0 -17
  126. package/src/components/trip-cards/assets/index.ts +0 -7
  127. package/src/components/trip-cards/helpers.ts +0 -176
  128. package/src/components/trip-cards/index.tsx +0 -119
  129. package/src/components/trip-cards/mockData.ts +0 -345
  130. package/src/components/trip-cards/skeletonStyles.ts +0 -46
  131. package/src/components/trip-cards/styles.ts +0 -450
  132. package/src/components/trip-cards/types.ts +0 -128
@@ -1,229 +0,0 @@
1
- import { useState, useEffect, useRef, useCallback } from 'react';
2
- import { UseCarouselOptions, UseCarouselReturn } from '../types';
3
-
4
- const DRAG_THRESHOLD = 30;
5
-
6
- export const useCarousel = (
7
- totalItems: number,
8
- options: UseCarouselOptions = {}
9
- ): UseCarouselReturn => {
10
- const { itemsPerPage = 2, onPageChange } = options;
11
-
12
- const [currentPage, setCurrentPage] = useState(0);
13
- const carouselRef = useRef<HTMLDivElement>(null);
14
- const isScrollingRef = useRef(false);
15
- const isDraggingRef = useRef(false);
16
- const startXRef = useRef(0);
17
- const touchStartXRef = useRef<number | null>(null);
18
- const isSwipingRef = useRef(false);
19
-
20
- const totalPages = Math.ceil(totalItems / itemsPerPage);
21
-
22
- const scrollToPage = useCallback(
23
- (page: number) => {
24
- if (carouselRef.current) {
25
- const cardElements = carouselRef.current.children;
26
-
27
- if (cardElements.length > 0) {
28
- isScrollingRef.current = true;
29
-
30
- const container = carouselRef.current;
31
- const targetCardIndex = page * itemsPerPage;
32
- const targetCard = cardElements[targetCardIndex] as HTMLElement;
33
-
34
- if (targetCard) {
35
- const targetScroll = targetCard.offsetLeft;
36
-
37
- container.scrollTo({
38
- left: targetScroll,
39
- behavior: 'smooth'
40
- });
41
- setCurrentPage(page);
42
-
43
- if (onPageChange) {
44
- onPageChange(page);
45
- }
46
-
47
- setTimeout(() => {
48
- isScrollingRef.current = false;
49
- }, 400);
50
- }
51
- }
52
- }
53
- },
54
- [itemsPerPage, onPageChange]
55
- );
56
-
57
- const handlePrevious = useCallback(
58
- () => {
59
- const newPage = Math.max(0, currentPage - 1);
60
- scrollToPage(newPage);
61
- },
62
- [currentPage, scrollToPage]
63
- );
64
-
65
- const handleNext = useCallback(
66
- () => {
67
- const newPage = Math.min(totalPages - 1, currentPage + 1);
68
- scrollToPage(newPage);
69
- },
70
- [currentPage, totalPages, scrollToPage]
71
- );
72
-
73
- const handleDragNavigation = useCallback(
74
- (diff: number) => {
75
- if (Math.abs(diff) > DRAG_THRESHOLD) {
76
- if (diff > 0) {
77
- handleNext();
78
- } else {
79
- handlePrevious();
80
- }
81
- }
82
- },
83
- [handleNext, handlePrevious]
84
- );
85
-
86
- const handleMouseDown = useCallback((e: React.MouseEvent) => {
87
- if (!carouselRef.current) {
88
- return;
89
- }
90
- e.preventDefault();
91
- isDraggingRef.current = true;
92
- startXRef.current = e.pageX;
93
- carouselRef.current.style.cursor = 'grabbing';
94
- }, []);
95
-
96
- const handleMouseUp = useCallback(
97
- (e: React.MouseEvent) => {
98
- if (!isDraggingRef.current) {
99
- return;
100
- }
101
- isDraggingRef.current = false;
102
-
103
- if (carouselRef.current) {
104
- carouselRef.current.style.cursor = 'grab';
105
-
106
- const endX = e.pageX;
107
- const diff = startXRef.current - endX;
108
-
109
- handleDragNavigation(diff);
110
- }
111
- },
112
- [handleDragNavigation]
113
- );
114
-
115
- const handleMouseLeave = useCallback(
116
- (e: React.MouseEvent) => {
117
- if (!isDraggingRef.current) {
118
- return;
119
- }
120
- isDraggingRef.current = false;
121
-
122
- if (carouselRef.current) {
123
- carouselRef.current.style.cursor = 'grab';
124
-
125
- const endX = e.pageX;
126
- const diff = startXRef.current - endX;
127
-
128
- handleDragNavigation(diff);
129
- }
130
- },
131
- [handleDragNavigation]
132
- );
133
-
134
- const handleTouchStart = (e: React.TouchEvent) => {
135
- if (!carouselRef.current) {
136
- return;
137
- }
138
- touchStartXRef.current = e.touches[0].clientX;
139
- isSwipingRef.current = false;
140
- };
141
-
142
- const handleTouchMove = (e: React.TouchEvent) => {
143
- if (touchStartXRef.current === null || isSwipingRef.current) {
144
- return;
145
- }
146
-
147
- const currentX = e.touches[0].clientX;
148
- const diff = touchStartXRef.current - currentX;
149
-
150
- if (Math.abs(diff) > DRAG_THRESHOLD) {
151
- isSwipingRef.current = true;
152
- handleDragNavigation(diff);
153
- }
154
- };
155
-
156
- const handleTouchEnd = () => {
157
- touchStartXRef.current = null;
158
- isSwipingRef.current = false;
159
- };
160
-
161
- const handleScroll = useCallback(
162
- () => {
163
- if (isScrollingRef.current) {
164
- return;
165
- }
166
-
167
- if (carouselRef.current) {
168
- const container = carouselRef.current;
169
- const children = container.children;
170
- if (children.length === 0) {
171
- return;
172
- }
173
-
174
- const scrollLeft = container.scrollLeft;
175
-
176
- let closestPage = 0;
177
- let closestDistance = Infinity;
178
-
179
- for (let page = 0; page < totalPages; page++) {
180
- const cardIndex = page * itemsPerPage;
181
- if (cardIndex < children.length) {
182
- const card = children[cardIndex] as HTMLElement;
183
- const distance = Math.abs(card.offsetLeft - scrollLeft);
184
- if (distance < closestDistance) {
185
- closestDistance = distance;
186
- closestPage = page;
187
- }
188
- }
189
- }
190
-
191
- if (closestPage !== currentPage) {
192
- setCurrentPage(closestPage);
193
- if (onPageChange) {
194
- onPageChange(closestPage);
195
- }
196
- }
197
- }
198
- },
199
- [totalPages, itemsPerPage, onPageChange]
200
- );
201
-
202
- useEffect(
203
- () => {
204
- const carousel = carouselRef.current;
205
- if (carousel) {
206
- carousel.addEventListener('scroll', handleScroll);
207
- return () => carousel.removeEventListener('scroll', handleScroll);
208
- }
209
- return undefined;
210
- },
211
- [handleScroll]
212
- );
213
-
214
- return {
215
- currentPage,
216
- totalPages,
217
- carouselRef,
218
- isScrolling: isScrollingRef.current,
219
- handlePrevious,
220
- handleNext,
221
- scrollToPage,
222
- handleMouseDown,
223
- handleMouseUp,
224
- handleMouseLeave,
225
- handleTouchStart,
226
- handleTouchMove,
227
- handleTouchEnd
228
- };
229
- };
@@ -1,92 +0,0 @@
1
- import React from 'react';
2
- import { useCarousel } from './hooks/useCarousel';
3
- import {
4
- CarouselContainer,
5
- CarouselWrapper,
6
- CarouselContent,
7
- CardsRow,
8
- PageControl
9
- } from './styles';
10
- import { DefaultNavigationArrow } from './DefaultNavigationArrow';
11
- import { DefaultPageDot } from './DefaultPageDot';
12
- import { CarouselComponentProps } from './types';
13
-
14
- export const CarouselComponent: React.FC<CarouselComponentProps> = ({
15
- items,
16
- options,
17
- showArrows = true,
18
- showDots = true,
19
- arrowComponent: CustomArrow,
20
- dotComponent: CustomDot,
21
- className
22
- }) => {
23
- const {
24
- currentPage,
25
- totalPages,
26
- carouselRef,
27
- handlePrevious,
28
- handleNext,
29
- scrollToPage,
30
- handleMouseDown,
31
- handleMouseUp,
32
- handleMouseLeave,
33
- handleTouchStart,
34
- handleTouchMove,
35
- handleTouchEnd
36
- } = useCarousel(items.length, options);
37
-
38
- const ArrowComponent = CustomArrow || DefaultNavigationArrow;
39
- const DotComponent = CustomDot || DefaultPageDot;
40
-
41
- return (
42
- <CarouselContainer className={className}>
43
- <CarouselWrapper>
44
- {showArrows && (
45
- <ArrowComponent
46
- direction="left"
47
- onClick={handlePrevious}
48
- disabled={currentPage === 0}
49
- />
50
- )}
51
-
52
- <CarouselContent>
53
- <CardsRow
54
- ref={carouselRef}
55
- onMouseDown={handleMouseDown}
56
- onMouseUp={handleMouseUp}
57
- onMouseLeave={handleMouseLeave}
58
- onTouchStart={handleTouchStart}
59
- onTouchMove={handleTouchMove}
60
- onTouchEnd={handleTouchEnd}
61
- >
62
- {items}
63
- </CardsRow>
64
- </CarouselContent>
65
-
66
- {showArrows && (
67
- <ArrowComponent
68
- direction="right"
69
- onClick={handleNext}
70
- disabled={currentPage >= totalPages - 1}
71
- />
72
- )}
73
- </CarouselWrapper>
74
-
75
- {showDots &&
76
- totalPages > 1 && (
77
- <PageControl>
78
- {Array.from({ length: totalPages }).map((_, pageIndex) => (
79
- <DotComponent
80
- key={pageIndex}
81
- active={pageIndex === currentPage}
82
- onClick={() => scrollToPage(pageIndex)}
83
- index={pageIndex}
84
- />
85
- ))}
86
- </PageControl>
87
- )}
88
- </CarouselContainer>
89
- );
90
- };
91
-
92
- export { CarouselItem } from './CarouselItem';
@@ -1,188 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
- import { ResponsiveConfig } from './types';
3
- export const breakpoints = {
4
- xs: '0px',
5
- sm: '520px',
6
- md: '768px',
7
- lg: '1024px',
8
- xl: '1320px'
9
- };
10
-
11
- export const colors = {
12
- primary: '#005C8A',
13
- white: '#FFFFFF'
14
- };
15
-
16
- export const ItemContainer = styled.div<{
17
- widthItemConfig?: ResponsiveConfig;
18
- maxWidthItemConfig?: ResponsiveConfig;
19
- }>`
20
- scroll-snap-align: start;
21
- display: flex;
22
- flex-direction: column;
23
- align-self: stretch;
24
-
25
- ${props => {
26
- if (!props.widthItemConfig) {
27
- return '';
28
- }
29
- const { xs, mobile, tablet, desktop, xl } = props.widthItemConfig;
30
- return css`
31
- ${xs && `flex: 0 0 ${xs};`}
32
- ${mobile &&
33
- `
34
- @media (min-width: ${breakpoints.sm}) {
35
- flex: 0 0 ${mobile};
36
- }
37
- `}
38
- ${tablet &&
39
- `
40
- @media (min-width: ${breakpoints.md}) {
41
- flex: 0 0 ${tablet};
42
- }
43
- `}
44
- ${desktop &&
45
- `
46
- @media (min-width: ${breakpoints.lg}) {
47
- flex: 0 0 ${desktop};
48
- }
49
- `}
50
- ${xl &&
51
- `
52
- @media (min-width: ${breakpoints.xl}) {
53
- flex: 0 0 ${xl};
54
- }
55
- `}
56
- `;
57
- }} ${props => {
58
- if (!props.maxWidthItemConfig) {
59
- return '';
60
- }
61
- const { xs, mobile, tablet, desktop, xl } = props.maxWidthItemConfig;
62
- return css`
63
- ${xs && `max-width: ${xs};`}
64
- ${mobile &&
65
- `
66
- @media (min-width: ${breakpoints.sm}) {
67
- max-width: ${mobile};
68
- }
69
- `}
70
- ${tablet &&
71
- `
72
- @media (min-width: ${breakpoints.md}) {
73
- max-width: ${tablet};
74
- }
75
- `}
76
- ${desktop &&
77
- `
78
- @media (min-width: ${breakpoints.lg}) {
79
- max-width: ${desktop};
80
- }
81
- `}
82
- ${xl &&
83
- `
84
- @media (min-width: ${breakpoints.xl}) {
85
- max-width: ${xl};
86
- }
87
- `}
88
- `;
89
- }};
90
- `;
91
-
92
- export const CarouselContainer = styled.div`
93
- width: 100%;
94
- `;
95
-
96
- export const CarouselWrapper = styled.div`
97
- position: relative;
98
- width: 100%;
99
- `;
100
-
101
- export const CarouselContent = styled.div`
102
- overflow: hidden;
103
- `;
104
-
105
- export const CardsRow = styled.div`
106
- display: flex;
107
- gap: 20px;
108
- overflow-x: hidden;
109
- scroll-snap-type: x mandatory;
110
- scrollbar-width: none;
111
- -ms-overflow-style: none;
112
- padding: 0;
113
- scroll-behavior: smooth;
114
- cursor: grab;
115
- user-select: none;
116
- align-items: stretch;
117
-
118
- &::-webkit-scrollbar {
119
- display: none;
120
- }
121
-
122
- &:active {
123
- cursor: grabbing;
124
- }
125
- `;
126
-
127
- export const PageControl = styled.div`
128
- display: flex;
129
- justify-content: center;
130
- align-items: center;
131
- gap: 10px;
132
- padding: 12px;
133
- background: ${colors.white};
134
- `;
135
-
136
- export const NavigationArrowButton = styled.button<{
137
- direction: 'left' | 'right';
138
- disabled?: boolean;
139
- }>`
140
- display: none;
141
- position: absolute;
142
- top: 50%;
143
- transform: translateY(-50%);
144
- ${({ direction }) =>
145
- direction === 'left' ? 'left: -68px;' : 'right: -68px;'} z-index: 10;
146
- width: 48px;
147
- height: 48px;
148
- border: none;
149
- border-radius: 50%;
150
- background: ${({ disabled }) => (disabled ? '#CCCCCC' : colors.primary)};
151
- cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
152
- align-items: center;
153
- justify-content: center;
154
- transition: background 0.2s ease;
155
- pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')};
156
-
157
- svg {
158
- width: 24px;
159
- height: 24px;
160
- }
161
-
162
- svg path {
163
- stroke: ${colors.white};
164
- }
165
-
166
- &:hover:not(:disabled) {
167
- background: #004a6e;
168
- }
169
-
170
- @media (min-width: ${breakpoints.lg}) {
171
- display: flex;
172
- }
173
- `;
174
-
175
- export const PageDotButton = styled.button<{ active: boolean }>`
176
- width: 8px;
177
- height: 8px;
178
- border-radius: 1000px;
179
- border: none;
180
- padding: 0;
181
- background: ${({ active }) => (active ? '#01000D' : '#AAAAAA')};
182
- cursor: pointer;
183
- transition: background 0.2s ease;
184
-
185
- &:hover {
186
- background: #01000d;
187
- }
188
- `;
@@ -1,62 +0,0 @@
1
- import { ReactNode } from 'react';
2
-
3
- export interface ResponsiveConfig {
4
- xs?: string;
5
- mobile?: string;
6
- tablet?: string;
7
- desktop?: string;
8
- xl?: string;
9
- }
10
-
11
- export type ResponsiveConfigNoXs = Omit<ResponsiveConfig, 'xs'>;
12
-
13
- export interface ArrowComponentProps {
14
- direction: 'left' | 'right';
15
- onClick: () => void;
16
- disabled: boolean;
17
- }
18
-
19
- export interface DotComponentProps {
20
- active: boolean;
21
- onClick: () => void;
22
- index: number;
23
- }
24
-
25
- export interface CarouselComponentProps {
26
- items: ReactNode[];
27
- options?: UseCarouselOptions;
28
- showArrows?: boolean;
29
- showDots?: boolean;
30
- arrowComponent?: React.ComponentType<ArrowComponentProps>;
31
- dotComponent?: React.ComponentType<DotComponentProps>;
32
- className?: string;
33
- }
34
-
35
- export interface CarouselItemProps {
36
- children: ReactNode;
37
- widthItemConfig?: ResponsiveConfig;
38
- maxWidthItemConfig?: ResponsiveConfig;
39
- className?: string;
40
- }
41
-
42
- // Carousel Hook Types
43
- export interface UseCarouselOptions {
44
- itemsPerPage?: number;
45
- onPageChange?: (page: number) => void;
46
- }
47
-
48
- export interface UseCarouselReturn {
49
- currentPage: number;
50
- totalPages: number;
51
- carouselRef: React.RefObject<HTMLDivElement>;
52
- isScrolling: boolean;
53
- handlePrevious: () => void;
54
- handleNext: () => void;
55
- scrollToPage: (page: number) => void;
56
- handleMouseDown: (e: React.MouseEvent) => void;
57
- handleMouseUp: (e: React.MouseEvent) => void;
58
- handleMouseLeave: (e: React.MouseEvent<Element, MouseEvent>) => void;
59
- handleTouchStart: (e: React.TouchEvent) => void;
60
- handleTouchMove: (e: React.TouchEvent) => void;
61
- handleTouchEnd: () => void;
62
- }
@@ -1,64 +0,0 @@
1
- import React, { FC } from 'react';
2
- import { Placeholder } from '@times-components/image';
3
- import {
4
- CardContainer,
5
- ImageContainer,
6
- CardContent,
7
- TopContainer,
8
- BottomContainer,
9
- DataPointsList,
10
- DataPoint,
11
- PriceSection,
12
- PriceContainer
13
- } from './styles';
14
- import {
15
- SkeletonLine,
16
- SkeletonHeadline,
17
- SkeletonPrice,
18
- SkeletonButton
19
- } from './skeletonStyles';
20
- import { ImageHeightConfig } from './types';
21
- import { defaultTripCardImgHeight } from './helpers';
22
-
23
- export const SkeletonCard: FC<{
24
- isStaticGrid?: boolean;
25
- imgHeight?: ImageHeightConfig;
26
- forceStaticGrid?: boolean;
27
- }> = ({ isStaticGrid, imgHeight = {}, forceStaticGrid }) => {
28
- return (
29
- <CardContainer data-testid="skeleton-card-container">
30
- <ImageContainer
31
- data-testid="skeleton-image-container"
32
- isStaticGrid={isStaticGrid && !forceStaticGrid}
33
- {...{ ...defaultTripCardImgHeight, ...imgHeight }}
34
- >
35
- <Placeholder />
36
- </ImageContainer>
37
- <CardContent data-testid="skeleton-card-content">
38
- <TopContainer data-testid="skeleton-top-container">
39
- <SkeletonHeadline data-testid="skeleton-headline" />
40
- <DataPointsList data-testid="skeleton-data-points-list">
41
- {[1, 2, 3, 4].map(i => (
42
- <DataPoint key={i} data-testid={`skeleton-data-point-${i}`}>
43
- <SkeletonLine width="80px" data-testid={`skeleton-line-${i}`} />
44
- </DataPoint>
45
- ))}
46
- </DataPointsList>
47
- </TopContainer>
48
- <BottomContainer data-testid="skeleton-bottom-container">
49
- <PriceSection data-testid="skeleton-price-section">
50
- <PriceContainer data-testid="skeleton-price-container">
51
- <SkeletonLine
52
- width="40px"
53
- marginBottom="4px"
54
- data-testid="skeleton-price-label"
55
- />
56
- <SkeletonPrice data-testid="skeleton-price" />
57
- </PriceContainer>
58
- </PriceSection>
59
- <SkeletonButton as="div" data-testid="skeleton-button" />
60
- </BottomContainer>
61
- </CardContent>
62
- </CardContainer>
63
- );
64
- };