@times-components/ts-components 1.146.2-a0ffbb6bc2acbec91d140a39f6be06256e702094.5 → 1.146.2-c12ed7999a41984c2ba8c437357e7a5df1914881.48

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 (137) hide show
  1. package/dist/components/carousel-component/CarouselComponent.stories.d.ts +1 -0
  2. package/dist/components/carousel-component/CarouselComponent.stories.js +146 -0
  3. package/dist/components/carousel-component/CarouselItem.d.ts +3 -0
  4. package/dist/components/carousel-component/CarouselItem.js +12 -0
  5. package/dist/components/carousel-component/DefaultNavigationArrow.d.ts +8 -0
  6. package/dist/components/carousel-component/DefaultNavigationArrow.js +6 -0
  7. package/dist/components/carousel-component/DefaultPageDot.d.ts +8 -0
  8. package/dist/components/carousel-component/DefaultPageDot.js +4 -0
  9. package/dist/components/carousel-component/__tests__/CarouselComponent.test.d.ts +1 -0
  10. package/dist/components/carousel-component/__tests__/CarouselComponent.test.js +163 -0
  11. package/dist/components/carousel-component/__tests__/CarouselItem.test.d.ts +1 -0
  12. package/dist/components/carousel-component/__tests__/CarouselItem.test.js +80 -0
  13. package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.d.ts +1 -0
  14. package/dist/components/carousel-component/__tests__/DefaultNavigationArrow.test.js +62 -0
  15. package/dist/components/carousel-component/__tests__/DefaultPageDot.test.d.ts +1 -0
  16. package/dist/components/carousel-component/__tests__/DefaultPageDot.test.js +68 -0
  17. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.d.ts +1 -0
  18. package/dist/components/carousel-component/hooks/__tests__/useCarousel.test.js +459 -0
  19. package/dist/components/carousel-component/hooks/useCarousel.d.ts +2 -0
  20. package/dist/components/carousel-component/hooks/useCarousel.js +167 -0
  21. package/dist/components/carousel-component/index.d.ts +4 -0
  22. package/dist/components/carousel-component/index.js +20 -0
  23. package/dist/components/carousel-component/styles.d.ts +28 -0
  24. package/dist/components/carousel-component/styles.js +172 -0
  25. package/dist/components/carousel-component/types.d.ts +53 -0
  26. package/dist/components/carousel-component/types.js +2 -0
  27. package/dist/components/social-embed/SocialMediaEmbed.js +15 -122
  28. package/dist/components/social-embed/SocialVendor.d.ts +16 -1
  29. package/dist/components/social-embed/SocialVendor.js +2 -41
  30. package/dist/components/social-embed/__tests__/SocialVendor.test.js +1 -8
  31. package/dist/components/social-embed/constants.d.ts +0 -1
  32. package/dist/components/social-embed/constants.js +2 -3
  33. package/dist/components/social-embed/helpers/socialMediaVendors.js +1 -6
  34. package/dist/components/social-embed/styles.d.ts +0 -1
  35. package/dist/components/social-embed/styles.js +1 -28
  36. package/dist/components/trip-cards/SkeletonCard.d.ts +7 -0
  37. package/dist/components/trip-cards/SkeletonCard.js +22 -0
  38. package/dist/components/trip-cards/TripCard.d.ts +3 -0
  39. package/dist/components/trip-cards/TripCard.js +61 -0
  40. package/dist/components/trip-cards/TripCards.stories.d.ts +1 -0
  41. package/dist/components/trip-cards/TripCards.stories.js +159 -0
  42. package/dist/components/trip-cards/TripCardsLayout.d.ts +3 -0
  43. package/dist/components/trip-cards/TripCardsLayout.js +63 -0
  44. package/dist/components/trip-cards/__tests__/SkeletonCard.test.d.ts +1 -0
  45. package/dist/components/trip-cards/__tests__/SkeletonCard.test.js +139 -0
  46. package/dist/components/trip-cards/__tests__/TripCard.test.d.ts +1 -0
  47. package/dist/components/trip-cards/__tests__/TripCard.test.js +165 -0
  48. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.d.ts +1 -0
  49. package/dist/components/trip-cards/__tests__/TripCardsLayout.test.js +353 -0
  50. package/dist/components/trip-cards/__tests__/assets.test.d.ts +1 -0
  51. package/dist/components/trip-cards/__tests__/assets.test.js +165 -0
  52. package/dist/components/trip-cards/__tests__/helpers.test.d.ts +1 -0
  53. package/dist/components/trip-cards/__tests__/helpers.test.js +221 -0
  54. package/dist/components/trip-cards/__tests__/index.test.d.ts +1 -0
  55. package/dist/components/trip-cards/__tests__/index.test.js +482 -0
  56. package/dist/components/trip-cards/__tests__/mockData.test.d.ts +1 -0
  57. package/dist/components/trip-cards/__tests__/mockData.test.js +57 -0
  58. package/dist/components/trip-cards/__tests__/skeletonStyles.test.d.ts +1 -0
  59. package/dist/components/trip-cards/__tests__/skeletonStyles.test.js +194 -0
  60. package/dist/components/trip-cards/assets/BoatIcon.d.ts +1 -0
  61. package/dist/components/trip-cards/assets/BoatIcon.js +4 -0
  62. package/dist/components/trip-cards/assets/CalendarIcon.d.ts +1 -0
  63. package/dist/components/trip-cards/assets/CalendarIcon.js +4 -0
  64. package/dist/components/trip-cards/assets/ChevronRightIcon.d.ts +1 -0
  65. package/dist/components/trip-cards/assets/ChevronRightIcon.js +4 -0
  66. package/dist/components/trip-cards/assets/LocationIcon.d.ts +1 -0
  67. package/dist/components/trip-cards/assets/LocationIcon.js +4 -0
  68. package/dist/components/trip-cards/assets/MoonIcon.d.ts +1 -0
  69. package/dist/components/trip-cards/assets/MoonIcon.js +4 -0
  70. package/dist/components/trip-cards/assets/index.d.ts +6 -0
  71. package/dist/components/trip-cards/assets/index.js +7 -0
  72. package/dist/components/trip-cards/helpers.d.ts +11 -0
  73. package/dist/components/trip-cards/helpers.js +144 -0
  74. package/dist/components/trip-cards/index.d.ts +4 -0
  75. package/dist/components/trip-cards/index.js +68 -0
  76. package/dist/components/trip-cards/mockData.d.ts +3 -0
  77. package/dist/components/trip-cards/mockData.js +317 -0
  78. package/dist/components/trip-cards/skeletonStyles.d.ts +9 -0
  79. package/dist/components/trip-cards/skeletonStyles.js +37 -0
  80. package/dist/components/trip-cards/styles.d.ts +43 -0
  81. package/dist/components/trip-cards/styles.js +404 -0
  82. package/dist/components/trip-cards/types.d.ts +121 -0
  83. package/dist/components/trip-cards/types.js +2 -0
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.js +2 -1
  86. package/dist/utils/cookie.d.ts +1 -0
  87. package/dist/utils/cookie.js +8 -1
  88. package/package.json +3 -3
  89. package/rnw.js +1 -1
  90. package/src/components/carousel-component/CarouselComponent.stories.tsx +220 -0
  91. package/src/components/carousel-component/CarouselItem.tsx +26 -0
  92. package/src/components/carousel-component/DefaultNavigationArrow.tsx +37 -0
  93. package/src/components/carousel-component/DefaultPageDot.tsx +20 -0
  94. package/src/components/carousel-component/__tests__/CarouselComponent.test.tsx +259 -0
  95. package/src/components/carousel-component/__tests__/CarouselItem.test.tsx +140 -0
  96. package/src/components/carousel-component/__tests__/DefaultNavigationArrow.test.tsx +153 -0
  97. package/src/components/carousel-component/__tests__/DefaultPageDot.test.tsx +105 -0
  98. package/src/components/carousel-component/hooks/__tests__/useCarousel.test.ts +625 -0
  99. package/src/components/carousel-component/hooks/useCarousel.ts +229 -0
  100. package/src/components/carousel-component/index.tsx +92 -0
  101. package/src/components/carousel-component/styles.ts +188 -0
  102. package/src/components/carousel-component/types.ts +62 -0
  103. package/src/components/social-embed/SocialMediaEmbed.tsx +1 -111
  104. package/src/components/social-embed/SocialVendor.tsx +1 -46
  105. package/src/components/social-embed/__tests__/SocialVendor.test.tsx +0 -11
  106. package/src/components/social-embed/constants.ts +1 -2
  107. package/src/components/social-embed/helpers/socialMediaVendors.ts +0 -5
  108. package/src/components/social-embed/styles.ts +0 -30
  109. package/src/components/trip-cards/SkeletonCard.tsx +64 -0
  110. package/src/components/trip-cards/TripCard.tsx +172 -0
  111. package/src/components/trip-cards/TripCards.stories.tsx +224 -0
  112. package/src/components/trip-cards/TripCardsLayout.tsx +162 -0
  113. package/src/components/trip-cards/__tests__/SkeletonCard.test.tsx +169 -0
  114. package/src/components/trip-cards/__tests__/TripCard.test.tsx +255 -0
  115. package/src/components/trip-cards/__tests__/TripCardsLayout.test.tsx +671 -0
  116. package/src/components/trip-cards/__tests__/assets.test.tsx +206 -0
  117. package/src/components/trip-cards/__tests__/helpers.test.ts +273 -0
  118. package/src/components/trip-cards/__tests__/index.test.tsx +554 -0
  119. package/src/components/trip-cards/__tests__/mockData.test.ts +67 -0
  120. package/src/components/trip-cards/__tests__/skeletonStyles.test.tsx +256 -0
  121. package/src/components/trip-cards/assets/BoatIcon.tsx +17 -0
  122. package/src/components/trip-cards/assets/CalendarIcon.tsx +17 -0
  123. package/src/components/trip-cards/assets/ChevronRightIcon.tsx +20 -0
  124. package/src/components/trip-cards/assets/LocationIcon.tsx +17 -0
  125. package/src/components/trip-cards/assets/MoonIcon.tsx +17 -0
  126. package/src/components/trip-cards/assets/index.ts +7 -0
  127. package/src/components/trip-cards/helpers.ts +181 -0
  128. package/src/components/trip-cards/index.tsx +120 -0
  129. package/src/components/trip-cards/mockData.ts +345 -0
  130. package/src/components/trip-cards/skeletonStyles.ts +46 -0
  131. package/src/components/trip-cards/styles.ts +450 -0
  132. package/src/components/trip-cards/types.ts +130 -0
  133. package/src/index.ts +2 -0
  134. package/src/utils/cookie.ts +8 -0
  135. package/dist/components/social-embed/components/FacebookComponent.d.ts +0 -6
  136. package/dist/components/social-embed/components/FacebookComponent.js +0 -74
  137. package/src/components/social-embed/components/FacebookComponent.tsx +0 -93
@@ -3,56 +3,12 @@ import { Twitter } from './components/TwitterComponent';
3
3
  import { Youtube } from './components/YoutubeComponent';
4
4
  import { TikTok } from './components/TiktokComponent';
5
5
  import { Instagram } from './components/InstagramComponent';
6
- import { Facebook } from './components/FacebookComponent';
7
- import { useSocialEmbedsContext } from '../../contexts/SocialEmbedsProvider';
8
- import { BlockedEmbedMessage } from './BlockedEmbedMessage';
9
- import { VendorName } from './types';
10
6
 
11
7
  const vendors = {
12
8
  twitter: Twitter,
13
9
  youtube: Youtube,
14
10
  tiktok: TikTok,
15
- instagram: Instagram,
16
- facebook: Facebook
17
- };
18
-
19
-
20
- export const Vendor = ({
21
- vendorName,
22
- url
23
- }: {
24
- vendorName: VendorName;
25
- url: string;
26
- }) => {
27
- const { isSocialEmbedAllowed, isAllowedOnce } = useSocialEmbedsContext();
28
-
29
- // Step 2: Only mount the actual social vendor component after consent
30
- const allowed =
31
- isSocialEmbedAllowed[vendorName] === true ||
32
- isAllowedOnce[vendorName] === true;
33
-
34
-
35
- if (!allowed && ['instagram', 'twitter', 'facebook'].includes(vendorName)) {
36
- return <BlockedEmbedMessage vendorName={vendorName as VendorName} />;
37
- }
38
-
39
- const Component = vendors[vendorName];
40
- return <Component url={url} />;
41
- };
42
-
43
- /* import React from 'react';
44
- import { Twitter } from './components/TwitterComponent';
45
- import { Youtube } from './components/YoutubeComponent';
46
- import { TikTok } from './components/TiktokComponent';
47
- import { Instagram } from './components/InstagramComponent';
48
- import { Facebook } from './components/FacebookComponent';
49
-
50
- const vendors = {
51
- twitter: Twitter,
52
- youtube: Youtube,
53
- tiktok: TikTok,
54
- instagram: Instagram,
55
- facebook: Facebook
11
+ instagram: Instagram
56
12
  };
57
13
 
58
14
  export type VendorName = keyof typeof vendors;
@@ -67,4 +23,3 @@ export const Vendor = ({
67
23
  const Component = vendors[vendorName];
68
24
  return <Component url={url} />;
69
25
  };
70
- */
@@ -29,12 +29,6 @@ jest.mock('../components/InstagramComponent', () => ({
29
29
  ))
30
30
  }));
31
31
 
32
- jest.mock('../components/FacebookComponent', () => ({
33
- Facebook: jest.fn(() => (
34
- <div data-testid="facebook-component">Facebook Component</div>
35
- ))
36
- }));
37
-
38
32
  describe('Vendor Component', () => {
39
33
  const renderVendor = (vendorName: VendorName, url: string) =>
40
34
  render(<Vendor vendorName={vendorName} url={url} />);
@@ -62,11 +56,6 @@ describe('Vendor Component', () => {
62
56
  expect(screen.getByTestId('instagram-component')).toBeInTheDocument();
63
57
  });
64
58
 
65
- it('renders the Facebook component when vendorName is "facebook"', () => {
66
- renderVendor('facebook' as VendorName, 'https://facebook.com/some/video');
67
- expect(screen.getByTestId('facebook-component')).toBeInTheDocument();
68
- });
69
-
70
59
  it('throws an error if an invalid vendorName is provided', () => {
71
60
  const renderInvalidVendor = () =>
72
61
  render(
@@ -11,6 +11,5 @@ export const eventStatus = {
11
11
 
12
12
  export const vendors = {
13
13
  instagram: 'instagram',
14
- twitter: 'twitter',
15
- facebook: 'facebook'
14
+ twitter: 'twitter'
16
15
  } as const;
@@ -20,10 +20,5 @@ export const socialMediaVendors: {
20
20
  id: '5e717c8e69966540e4554f05',
21
21
  status: 'pending',
22
22
  title: 'Instagram'
23
- },
24
- facebook: {
25
- id: '5e8dj207kee725du372h892',
26
- status: 'pending',
27
- title: 'Facebook'
28
23
  }
29
24
  };
@@ -96,33 +96,3 @@ export const InstagramContainer = styled.blockquote`
96
96
  width: calc(100% - 2px);
97
97
  position: relative;
98
98
  `;
99
-
100
-
101
- export const FacebookContainer = styled.div`
102
- width: 100%;
103
- max-width: 540px;
104
- margin: 24px auto;
105
-
106
- background: #ffffff;
107
- border: 1px solid #dadde1;
108
- border-radius: 8px;
109
-
110
- min-height: 200px;
111
-
112
- display: flex;
113
- justify-content: center;
114
- align-items: center;
115
-
116
- iframe {
117
- width: 100% !important;
118
- border: none;
119
- overflow: hidden;
120
- }
121
-
122
- span,
123
- .fb-post,
124
- .fb-video {
125
- width: 100% !important;
126
- }
127
- `;
128
-
@@ -0,0 +1,64 @@
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
+ };
@@ -0,0 +1,172 @@
1
+ import React, { FC, useState } from 'react';
2
+ import { Placeholder } from '@times-components/image';
3
+ import { TripCardProps } from './types';
4
+ import {
5
+ CardContainer,
6
+ ImageContainer,
7
+ CardImage,
8
+ OfferLabel,
9
+ GiftBanner,
10
+ CardContent,
11
+ TopContainer,
12
+ BottomContainer,
13
+ Headline,
14
+ DataPointsList,
15
+ DataPoint,
16
+ DataIcon,
17
+ PriceSection,
18
+ PriceContainer,
19
+ OfferContainer,
20
+ PriceLabel,
21
+ OriginalPrice,
22
+ CurrentPrice,
23
+ LogoContainer,
24
+ CTAButton,
25
+ PriceSuffix,
26
+ StyledLink
27
+ } from './styles';
28
+ import { MoonIcon, LocationIcon, BoatIcon, CalendarIcon } from './assets';
29
+ import { tealiumTrackingHandler } from '../../helpers/tracking/TrackingHandler';
30
+ import { getPreferredEdition } from '../../utils/cookie';
31
+
32
+ export const TripCard: FC<TripCardProps> = ({
33
+ card,
34
+ isStaticGrid,
35
+ imgHeight = {}
36
+ }) => {
37
+ const [imageLoaded, setImageLoaded] = useState(false);
38
+ const trackEvent = (eventName: string) => {
39
+ tealiumTrackingHandler(
40
+ eventName,
41
+ 'navigation',
42
+ 'click',
43
+ card.headline,
44
+ undefined,
45
+ {
46
+ app_content_location: getPreferredEdition()
47
+ }
48
+ );
49
+ };
50
+
51
+ const handleCardClick = (type: 'headline' | 'img') => () =>
52
+ type === 'headline'
53
+ ? trackEvent(`trip card: ${card.headline}`)
54
+ : trackEvent('trip card: img click');
55
+
56
+ const handleCTAClick = () =>
57
+ trackEvent(`trip card: ${card.cta_text || 'View Itinerary'}`);
58
+
59
+ const handleLogoClick = () => trackEvent(`trip card: ${card.logo_name}`);
60
+
61
+ return (
62
+ <CardContainer>
63
+ <StyledLink
64
+ href={card.cta_url}
65
+ target="_blank"
66
+ rel="noopener noreferrer"
67
+ onClick={handleCardClick('img')}
68
+ >
69
+ <ImageContainer isStaticGrid={isStaticGrid} {...imgHeight}>
70
+ {!imageLoaded && <Placeholder />}
71
+ <CardImage
72
+ src={card.image}
73
+ alt={card.headline}
74
+ onLoad={() => setImageLoaded(true)}
75
+ isLoaded={imageLoaded}
76
+ />
77
+ {card.offer_label && <OfferLabel>{card.offer_label}</OfferLabel>}
78
+ {card.gift_banner && <GiftBanner>{card.gift_banner}</GiftBanner>}
79
+ </ImageContainer>
80
+ </StyledLink>
81
+
82
+ <CardContent>
83
+ <TopContainer>
84
+ <StyledLink
85
+ href={card.cta_url}
86
+ target="_blank"
87
+ rel="noopener noreferrer"
88
+ onClick={handleCardClick('headline')}
89
+ >
90
+ <Headline>{card.headline}</Headline>
91
+ </StyledLink>
92
+
93
+ <DataPointsList>
94
+ {card.date && (
95
+ <DataPoint>
96
+ <DataIcon>
97
+ <CalendarIcon />
98
+ </DataIcon>
99
+ <span>{card.date}</span>
100
+ </DataPoint>
101
+ )}
102
+ {card.duration && (
103
+ <DataPoint>
104
+ <DataIcon>
105
+ <MoonIcon />
106
+ </DataIcon>
107
+ <span>{card.duration}</span>
108
+ </DataPoint>
109
+ )}
110
+ {card.route && (
111
+ <DataPoint>
112
+ <DataIcon>
113
+ <LocationIcon />
114
+ </DataIcon>
115
+ <span>{card.route}</span>
116
+ </DataPoint>
117
+ )}
118
+ {card.ship && (
119
+ <DataPoint>
120
+ <DataIcon>
121
+ <BoatIcon />
122
+ </DataIcon>
123
+ <span>{card.ship}</span>
124
+ </DataPoint>
125
+ )}
126
+ </DataPointsList>
127
+ </TopContainer>
128
+
129
+ <BottomContainer>
130
+ <PriceSection>
131
+ <PriceContainer>
132
+ {card.price !== 'Enquire now' && (
133
+ <OfferContainer>
134
+ {<PriceLabel>From</PriceLabel>}
135
+ {card.original_price && (
136
+ <OriginalPrice>{card.original_price}</OriginalPrice>
137
+ )}
138
+ </OfferContainer>
139
+ )}
140
+ <CurrentPrice $isEnquire={card.price === 'Enquire now'}>
141
+ {card.price}
142
+ {card.price !== 'Enquire now' && <PriceSuffix>pp</PriceSuffix>}
143
+ </CurrentPrice>
144
+ </PriceContainer>
145
+
146
+ {card.logo && (
147
+ <LogoContainer>
148
+ <a
149
+ href={card.logo_url}
150
+ target="_blank"
151
+ rel="noopener noreferrer"
152
+ onClick={handleLogoClick}
153
+ >
154
+ <img src={card.logo} alt="Partner logo" />
155
+ </a>
156
+ </LogoContainer>
157
+ )}
158
+ </PriceSection>
159
+
160
+ <CTAButton
161
+ href={card.cta_url}
162
+ target="_blank"
163
+ rel="noopener noreferrer"
164
+ onClick={handleCTAClick}
165
+ >
166
+ {card.cta_text || 'View Itinerary'}
167
+ </CTAButton>
168
+ </BottomContainer>
169
+ </CardContent>
170
+ </CardContainer>
171
+ );
172
+ };
@@ -0,0 +1,224 @@
1
+ import React from 'react';
2
+ import { storiesOf } from '@storybook/react';
3
+ import { TripCards } from './index';
4
+ import styled from 'styled-components';
5
+ import { defaultTripCardImgHeight } from './helpers';
6
+
7
+ const spacing = (multiplier: number) => `${multiplier * 8}px`;
8
+
9
+ const breakpoints = {
10
+ medium: 768,
11
+ wide: 1024
12
+ };
13
+
14
+ const InteractiveContainer = styled.div`
15
+ position: relative;
16
+ margin-bottom: ${spacing(4)};
17
+ padding: 0 ${spacing(2)};
18
+
19
+ @media (min-width: ${breakpoints.medium}px) {
20
+ width: 80.8%;
21
+ margin-left: auto;
22
+ margin-right: auto;
23
+ padding: 0;
24
+ }
25
+
26
+ @media (min-width: ${breakpoints.wide}px) {
27
+ width: 56.2%;
28
+ }
29
+ `;
30
+
31
+ storiesOf('Typescript Component/TripCards', module)
32
+ .add('Channel View Two Cards', () => (
33
+ <TripCards
34
+ element={{
35
+ class: 'trip-cards',
36
+ tripcards: btoa(JSON.stringify([2074350, 2140335])),
37
+ title: 'Similar cruises',
38
+ titleurl: 'https://www.thetimes.com/travel/holidays',
39
+ description: 'Brought to you by Times Holidays'
40
+ }}
41
+ useMockData={true}
42
+ maxWidthItemConfig={{
43
+ xs: '85%',
44
+ mobile: '87%',
45
+ tablet: '44%',
46
+ desktop: '314px',
47
+ xl: '368px'
48
+ }}
49
+ widthContainerConfig={{
50
+ tablet: '728px',
51
+ desktop: '984px',
52
+ xl: '1144px'
53
+ }}
54
+ />
55
+ ))
56
+ .add('Channel View Three Cards', () => (
57
+ <TripCards
58
+ element={{
59
+ class: 'trip-cards',
60
+ tripcards: btoa(JSON.stringify([2074350, 2140335, 2177685])),
61
+ title: 'Featured Voyages',
62
+ titleurl: 'https://www.thetimes.com/travel/holidays',
63
+ description: 'Handpicked by our travel experts'
64
+ }}
65
+ forceStaticGrid={true}
66
+ maxWidthItemConfig={{
67
+ xs: '85%',
68
+ mobile: '87%',
69
+ tablet: '44%',
70
+ desktop: '314px',
71
+ xl: '368px'
72
+ }}
73
+ widthContainerConfig={{
74
+ tablet: '728px',
75
+ desktop: '984px',
76
+ xl: '1144px'
77
+ }}
78
+ useMockData={true}
79
+ />
80
+ ))
81
+ .add('Article View Two Trip Cards', () => (
82
+ <InteractiveContainer>
83
+ <TripCards
84
+ element={{
85
+ class: 'trip-cards',
86
+ tripcards: btoa(JSON.stringify([2074350, 2140335])),
87
+ title: 'Similar cruises',
88
+ titleurl: 'https://www.thetimes.com/travel/holidays',
89
+ description: 'Brought to you by Times Holidays'
90
+ }}
91
+ useMockData={true}
92
+ maxWidthItemConfig={{
93
+ mobile: '320px',
94
+ tablet: '260px',
95
+ desktop: '260px',
96
+ xl: '300px'
97
+ }}
98
+ widthContainerConfig={{
99
+ mobile: '390px',
100
+ tablet: '620px',
101
+ desktop: '574px',
102
+ xl: '663px'
103
+ }}
104
+ imgHeight={defaultTripCardImgHeight}
105
+ />
106
+ </InteractiveContainer>
107
+ ))
108
+ .add('Article View Three Cards', () => (
109
+ <InteractiveContainer>
110
+ <TripCards
111
+ element={{
112
+ class: 'trip-cards',
113
+ tripcards: btoa(JSON.stringify([2074350, 2140335, 2177685])),
114
+ title: 'Similar cruises',
115
+ titleurl: 'https://www.thetimes.com/travel/holidays',
116
+ description: 'Brought to you by Times Holidays'
117
+ }}
118
+ useMockData={true}
119
+ maxWidthItemConfig={{
120
+ mobile: '320px',
121
+ tablet: '260px',
122
+ desktop: '260px',
123
+ xl: '300px'
124
+ }}
125
+ widthContainerConfig={{
126
+ mobile: '390px',
127
+ tablet: '620px',
128
+ desktop: '574px',
129
+ xl: '663px'
130
+ }}
131
+ imgHeight={{ ...defaultTripCardImgHeight, $heightXs: '100%' }}
132
+ />
133
+ </InteractiveContainer>
134
+ ))
135
+ .add('Article View Two Trip Cards', () => (
136
+ <InteractiveContainer>
137
+ <TripCards
138
+ element={{
139
+ class: 'trip-cards',
140
+ tripcards: btoa(JSON.stringify([2074350, 2140335])),
141
+ title: 'Similar cruises',
142
+ titleurl: 'https://www.thetimes.com/travel/holidays',
143
+ description: 'Brought to you by Times Holidays'
144
+ }}
145
+ useMockData={true}
146
+ maxWidthItemConfig={{
147
+ mobile: '320px',
148
+ tablet: '260px',
149
+ desktop: '260px',
150
+ xl: '300px'
151
+ }}
152
+ widthContainerConfig={{
153
+ mobile: '390px',
154
+ tablet: '620px',
155
+ desktop: '574px',
156
+ xl: '663px'
157
+ }}
158
+ imgHeight={defaultTripCardImgHeight}
159
+ />
160
+ </InteractiveContainer>
161
+ ))
162
+ .add('Article View Trip Cards', () => (
163
+ <InteractiveContainer>
164
+ <TripCards
165
+ element={{
166
+ class: 'trip-cards',
167
+ tripcards: btoa(JSON.stringify([2074350, 2140335, 2177685])),
168
+ title: 'Similar cruises',
169
+ titleurl: 'https://www.thetimes.com/travel/holidays',
170
+ description: 'Brought to you by Times Holidays'
171
+ }}
172
+ useMockData={true}
173
+ maxWidthItemConfig={{
174
+ mobile: '320px',
175
+ tablet: '260px',
176
+ desktop: '260px',
177
+ xl: '300px'
178
+ }}
179
+ widthContainerConfig={{
180
+ mobile: '390px',
181
+ tablet: '620px',
182
+ desktop: '574px',
183
+ xl: '663px'
184
+ }}
185
+ imgHeight={defaultTripCardImgHeight}
186
+ />
187
+ </InteractiveContainer>
188
+ ))
189
+ .add('Article View Six Cards', () => (
190
+ <InteractiveContainer>
191
+ <TripCards
192
+ element={{
193
+ class: 'trip-cards',
194
+ tripcards: btoa(
195
+ JSON.stringify([
196
+ 2074350,
197
+ 2140335,
198
+ 2177685,
199
+ 2074351,
200
+ 2140336,
201
+ 2177686
202
+ ])
203
+ ),
204
+ title: 'Similar cruises',
205
+ titleurl: 'https://www.thetimes.com/travel/holidays',
206
+ description: 'Brought to you by Times Holidays'
207
+ }}
208
+ useMockData={true}
209
+ maxWidthItemConfig={{
210
+ mobile: '320px',
211
+ tablet: '260px',
212
+ desktop: '260px',
213
+ xl: '300px'
214
+ }}
215
+ widthContainerConfig={{
216
+ mobile: '390px',
217
+ tablet: '620px',
218
+ desktop: '574px',
219
+ xl: '663px'
220
+ }}
221
+ imgHeight={defaultTripCardImgHeight}
222
+ />
223
+ </InteractiveContainer>
224
+ ));