@cleartrip/ct-design-header 1.2.0-SNAPSHOT-header-v0.11.0 → 1.2.0-SNAPSHOT-header-fix-v4.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.
@@ -1,11 +1,13 @@
1
- import { __assign, __spreadArray } from 'tslib';
1
+ import { __assign, __makeTemplateObject, __spreadArray } from 'tslib';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo } from 'react';
4
4
  import { Container } from '@cleartrip/ct-design-container';
5
5
  import { Typography, TypographyVariant } from '@cleartrip/ct-design-typography';
6
- import { ButtonColor, Button } from '@cleartrip/ct-design-button';
6
+ import { ButtonColor, Button, ButtonVariant } from '@cleartrip/ct-design-button';
7
7
  import { Divider } from '@cleartrip/ct-design-divider';
8
8
  import { Offers, BusinessBag, ChevronDown, MyTrips, SupportIcon, ArrowRight, MyAccount, SavedCard, Travellers, HiFive, Wallet, SettingsCog, PrivacyRights, HeaderChevronRight, FkVip, FkPremium, InsiderIcon, InsiderElite, CtLoyalty, Supercoin, Signout, CTLogo, Fkcompany } from '@cleartrip/ct-design-icons';
9
+ import styled, { keyframes } from 'styled-components';
10
+ import { Shimmer } from '@cleartrip/ct-design-shimmer';
9
11
 
10
12
  var OFFERS_URL = 'all-offers/?categories=flights';
11
13
  var MY_TRIPS_URL = '/account/trips';
@@ -103,14 +105,14 @@ var LOG_IN_TEXT = 'Log in';
103
105
  var THEME_CONFIG = {
104
106
  NOVAC: {
105
107
  headerBackground: 'transparent',
106
- hoverColor: '#FFB8A5',
108
+ hoverColor: '#FDBA12',
107
109
  logoFill: '#FFF',
108
110
  fkcompanyColor: '#FFF',
109
111
  typographyColor: '#FFF',
110
112
  loginButtonColorVariant: ButtonColor.NEUTRAL
111
113
  },
112
114
  DEFAULT: {
113
- headerBackground: '#F7FAFF',
115
+ headerBackground: '#FFFFFF',
114
116
  hoverColor: '#FF4F17',
115
117
  logoFill: '#FF4F17',
116
118
  fkcompanyColor: '#1A1A1A',
@@ -144,44 +146,54 @@ var LobsHeader = function () {
144
146
  alignItems: 'center',
145
147
  justifyContent: 'center',
146
148
  padding: '16px',
147
- height: '64',
148
- background: '#F3F5FA',
149
+ background: '#F7FAFF',
149
150
  top: '64px',
150
151
  zIndex: 2,
151
152
  css: {
152
- gap: 40
153
+ gap: 24
153
154
  }
154
155
  }, {
155
156
  children: LOB_DATA.map(function (item, index) {
156
157
  var title = item.title,
157
158
  link = item.link,
158
159
  image = item.image;
159
- return jsxs(Container, __assign({
160
- display: 'flex',
161
- alignItems: 'center',
162
- cursor: 'pointer',
163
- css: {
164
- gap: 8,
165
- background: selectedLOB === title ? '#FFFFFF' : 'transparent',
166
- borderRadius: selectedLOB === title ? '40px' : '0',
167
- padding: selectedLOB === title ? '8px 16px 8px 8px' : '0'
168
- },
169
- onClick: function () {
170
- window.location.href = link;
160
+ var isSelected = selectedLOB === title;
161
+ return jsx("a", __assign({
162
+ href: isSelected ? undefined : link,
163
+ style: {
164
+ textDecoration: 'none',
165
+ pointerEvents: isSelected ? 'none' : 'auto'
171
166
  }
172
167
  }, {
173
- children: [jsx("img", {
174
- src: image,
175
- alt: title,
176
- width: 32,
177
- height: 32
178
- }), jsx(Typography, __assign({
179
- variant: selectedLOB === title ? TypographyVariant.HM3 : TypographyVariant.B1,
180
- isClickable: true
168
+ children: jsxs(Container, __assign({
169
+ display: 'flex',
170
+ alignItems: 'center',
171
+ width: '116px',
172
+ height: '48px',
173
+ justifyContent: 'center',
174
+ cursor: 'pointer',
175
+ css: {
176
+ gap: 8,
177
+ background: isSelected ? '#FFFFFF' : 'transparent',
178
+ border: isSelected ? '1px solid #E6E6E6' : '',
179
+ borderRadius: '40px',
180
+ padding: '8px 16px 8px 8px',
181
+ transition: 'background 0.2s ease'
182
+ }
181
183
  }, {
182
- children: title
183
- }))]
184
- }), index);
184
+ children: [jsx("img", {
185
+ src: image,
186
+ alt: title,
187
+ width: 32,
188
+ height: 32
189
+ }), jsx(Typography, __assign({
190
+ variant: isSelected ? TypographyVariant.HM3 : TypographyVariant.B1,
191
+ isClickable: true
192
+ }, {
193
+ children: title
194
+ }))]
195
+ }), index)
196
+ }));
185
197
  })
186
198
  }));
187
199
  };
@@ -446,6 +458,53 @@ var ravenSDKTrigger = function (isUserLoggedIn, eventName, ravenPayload, customR
446
458
  }
447
459
  };
448
460
 
461
+ var getAccountOptionHoverStyles = {
462
+ transition: 'background-color 0.2s ease-in-out',
463
+ '&:hover': {
464
+ backgroundColor: '#ECF3FF'
465
+ }
466
+ };
467
+ var getLogoutButtonHoverStyles = {
468
+ transition: 'background-color 0.2s ease-in-out',
469
+ '&:hover': {
470
+ backgroundColor: '#FBEFEF'
471
+ }
472
+ };
473
+ var moveRight = keyframes(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n from {\n transform: translateX(-20px);\n }\n to {\n transform: translateX(0px);\n }\n"], ["\n from {\n transform: translateX(-20px);\n }\n to {\n transform: translateX(0px);\n }\n"])));
474
+ var moveRightAgain = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n transform: translateX(-20.01px);\n }\n to {\n transform: translateX(0px);\n }\n"], ["\n from {\n transform: translateX(-20.01px);\n }\n to {\n transform: translateX(0px);\n }\n"])));
475
+ var arrowContainerStyles = {
476
+ display: 'flex',
477
+ backgroundColor: 'black',
478
+ transition: 'background-color 200ms ease',
479
+ 'flex-direction': 'row',
480
+ justifyContent: 'center',
481
+ width: '20px',
482
+ height: '20px',
483
+ overflow: 'hidden',
484
+ borderRadius: '50%'
485
+ };
486
+ var templateObject_1$1, templateObject_2;
487
+
488
+ var AnimatedArrow = function () {
489
+ return jsx(Container, __assign({
490
+ className: 'bd-arrow-container-js',
491
+ css: arrowContainerStyles
492
+ }, {
493
+ children: __spreadArray([], Array(3), true).map(function (_, index) {
494
+ return jsx(Container, __assign({
495
+ className: 'bd-arrow-wrapper-js',
496
+ display: 'flex',
497
+ alignItems: 'center'
498
+ }, {
499
+ children: jsx(ArrowRight, {})
500
+ }), index);
501
+ })
502
+ }));
503
+ };
504
+ var BDHoverContainer = /*#__PURE__*/styled.div.withConfig({
505
+ displayName: "BusinessDropdown__BDHoverContainer",
506
+ componentId: "sc-1tsshe4-0"
507
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"], ["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"])), moveRight, moveRightAgain);
449
508
  var BusinessDropdownContent = function (_a) {
450
509
  var isOpen = _a.isOpen;
451
510
  var _b = useHeaderContext(),
@@ -529,34 +588,41 @@ var BusinessDropdownContent = function (_a) {
529
588
  details = _a.details,
530
589
  link = _a.link,
531
590
  ravenActionName = _a.ravenActionName;
532
- return jsxs(Container, __assign({
533
- cursor: 'pointer',
534
- width: '200px',
535
- className: 'bd-hover-container',
591
+ return jsxs(BDHoverContainer, __assign({
592
+ className: 'bd-hover-container-js',
536
593
  onClick: function () {
537
594
  return handleBusinessDropdownClick(link, title, ravenActionName);
538
595
  }
539
596
  }, {
540
597
  children: [jsxs(Container, __assign({
541
598
  display: 'flex',
542
- flexDirection: 'row',
543
- alignItems: 'center',
544
- columnGap: '8px'
599
+ flexDirection: 'column',
600
+ rowGap: '4px'
545
601
  }, {
546
- children: [jsx(Typography, __assign({
547
- variant: 'HM2',
548
- className: 'color-orange-on-hover'
602
+ children: [jsxs(Container, __assign({
603
+ display: 'flex',
604
+ flexDirection: 'row',
605
+ alignItems: 'center',
606
+ columnGap: '8px'
549
607
  }, {
550
- children: title
551
- })), jsx(AnimatedArrow, {})]
552
- })), jsx(Typography, __assign({
553
- variant: 'B3',
554
- css: {
555
- marginTop: '4px',
556
- opacity: 0.75
557
- }
558
- }, {
559
- children: subtitle
608
+ children: [jsx(Typography, __assign({
609
+ variant: 'HM2',
610
+ className: 'color-orange-on-hover-js',
611
+ css: {
612
+ transition: 'color 200ms ease'
613
+ }
614
+ }, {
615
+ children: title
616
+ })), jsx(AnimatedArrow, {})]
617
+ })), jsx(Typography, __assign({
618
+ variant: 'B3',
619
+ css: {
620
+ marginTop: '4px',
621
+ opacity: 0.75
622
+ }
623
+ }, {
624
+ children: subtitle
625
+ }))]
560
626
  })), jsx(Typography, __assign({
561
627
  variant: 'P3',
562
628
  color: 'subheading',
@@ -571,19 +637,7 @@ var BusinessDropdownContent = function (_a) {
571
637
  }))]
572
638
  }));
573
639
  };
574
- var AnimatedArrow = function () {
575
- return jsx(Container, __assign({
576
- className: 'bd-arrow-container'
577
- }, {
578
- children: __spreadArray([], Array(3), true).map(function (_, index) {
579
- return jsx(Container, __assign({
580
- className: 'bd-arrow-wrapper'
581
- }, {
582
- children: jsx(ArrowRight, {})
583
- }), index);
584
- })
585
- }));
586
- };
640
+ var templateObject_1;
587
641
 
588
642
  var ACCOUNT_OPTIONS_POPUP_CONFIG = [{
589
643
  text: 'My Profile',
@@ -905,22 +959,20 @@ var RewardsSection = function () {
905
959
  gap: '4px'
906
960
  }
907
961
  }, {
908
- children: [loyaltyLoading ? jsx(Container, {
962
+ children: [loyaltyLoading ? jsx(Shimmer, {
909
963
  width: '50px',
910
964
  height: '32px',
911
- borderRadius: '8px',
912
- backgroundColor: '#efefef'
965
+ borderRadius: '8px'
913
966
  }) : selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip && jsx(LoyaltyChip, {
914
967
  icon: LOYALTY_DATA[selectedLoyaltyType].icon,
915
968
  borderGradient: LOYALTY_DATA[selectedLoyaltyType].borderGradient,
916
969
  backgroundGradient: LOYALTY_DATA[selectedLoyaltyType].backgroundGradient,
917
970
  chevronFillColor: ((_a = LOYALTY_DATA[selectedLoyaltyType]) === null || _a === void 0 ? void 0 : _a.chevronFillColor) || '#FFF',
918
971
  handleChipClick: loyaltyChipClick
919
- }), superCoinsLoading ? jsx(Container, {
972
+ }), superCoinsLoading ? jsx(Shimmer, {
920
973
  width: '50px',
921
974
  height: '32px',
922
- borderRadius: '8px',
923
- backgroundColor: '#efefef'
975
+ borderRadius: '8px'
924
976
  }) : !hideSupercoinsChip && jsx(ExpandableItem, {
925
977
  icon: jsx(Supercoin, {
926
978
  width: 20,
@@ -929,11 +981,10 @@ var RewardsSection = function () {
929
981
  value: superCoinBalance,
930
982
  handleChipClick: supercoinsChipClick,
931
983
  type: 'supercoin'
932
- }), walletLoading ? jsx(Container, {
984
+ }), walletLoading ? jsx(Shimmer, {
933
985
  width: '50px',
934
986
  height: '32px',
935
- borderRadius: '8px',
936
- backgroundColor: '#efefef'
987
+ borderRadius: '8px'
937
988
  }) : !hideWalletChip && jsx(ExpandableItem, {
938
989
  icon: jsx(Wallet, {
939
990
  width: 20,
@@ -1004,11 +1055,9 @@ var AccountDropdownContent = function (_a) {
1004
1055
  variant: variant,
1005
1056
  color: color
1006
1057
  }, {
1007
- children: loading ? jsx(Container, {
1058
+ children: loading ? jsx(Shimmer, {
1008
1059
  height: variant === 'HM3' ? '18px' : '12px',
1009
- width: variant === 'HM3' ? '140px' : '200px',
1010
- backgroundColor: '#efefef',
1011
- borderRadius: '8px'
1060
+ width: variant === 'HM3' ? '140px' : '200px'
1012
1061
  }) : content
1013
1062
  }));
1014
1063
  };
@@ -1063,13 +1112,13 @@ var AccountDropdownContent = function (_a) {
1063
1112
  icon = _a.icon,
1064
1113
  redirectionLink = _a.redirectionLink;
1065
1114
  return jsx(Container, __assign({
1066
- className: 'hoverable-container',
1067
1115
  padding: '8px',
1068
1116
  borderRadius: '8px',
1069
1117
  cursor: 'pointer',
1070
1118
  onClick: function () {
1071
1119
  return handleAccountOptionsClick(text, redirectionLink);
1072
- }
1120
+ },
1121
+ css: getAccountOptionHoverStyles
1073
1122
  }, {
1074
1123
  children: jsxs(Container, __assign({
1075
1124
  display: 'flex',
@@ -1095,12 +1144,13 @@ var AccountDropdownContent = function (_a) {
1095
1144
  borderBottom: '1px dashed #E6E6E6'
1096
1145
  }
1097
1146
  }), jsxs(Container, __assign({
1098
- className: 'logout-button',
1099
1147
  display: 'flex',
1100
1148
  padding: '8px',
1101
1149
  borderRadius: '8px',
1102
1150
  cursor: 'pointer',
1103
- onClick: handleLogoutClick
1151
+ columnGap: '8px',
1152
+ onClick: handleLogoutClick,
1153
+ css: getLogoutButtonHoverStyles
1104
1154
  }, {
1105
1155
  children: [jsx(Signout, {
1106
1156
  height: 24,
@@ -1144,7 +1194,7 @@ var UserAccount = function () {
1144
1194
  setScrolled = _d[1];
1145
1195
  useEffect(function () {
1146
1196
  var handleScroll = function () {
1147
- setScrolled(window.scrollY >= 100);
1197
+ setScrolled(window.scrollY >= 50);
1148
1198
  };
1149
1199
  window.addEventListener('scroll', handleScroll);
1150
1200
  return function () {
@@ -1246,20 +1296,20 @@ var HeaderContent = function () {
1246
1296
  setScrolled = _f[1];
1247
1297
  useEffect(function () {
1248
1298
  var handleScroll = function () {
1249
- setScrolled(window.scrollY >= 100);
1299
+ setScrolled(window.scrollY >= 50);
1250
1300
  };
1251
1301
  window.addEventListener('scroll', handleScroll);
1252
1302
  return function () {
1253
1303
  return window.removeEventListener('scroll', handleScroll);
1254
1304
  };
1255
1305
  }, []);
1256
- var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1257
- var headerBackground = theme.headerBackground,
1258
- logoFill = theme.logoFill,
1259
- loginButtonColorVariant = theme.loginButtonColorVariant,
1260
- hoverColor = theme.hoverColor,
1261
- fkcompanyColor = theme.fkcompanyColor,
1262
- typographyColor = theme.typographyColor;
1306
+ var headerTheme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1307
+ var headerBackground = headerTheme.headerBackground,
1308
+ logoFill = headerTheme.logoFill,
1309
+ loginButtonColorVariant = headerTheme.loginButtonColorVariant,
1310
+ hoverColor = headerTheme.hoverColor,
1311
+ fkcompanyColor = headerTheme.fkcompanyColor,
1312
+ typographyColor = headerTheme.typographyColor;
1263
1313
  var _g = useHoverDropdown({
1264
1314
  openDelay: 0
1265
1315
  }),
@@ -1434,23 +1484,16 @@ var HeaderContent = function () {
1434
1484
  }, {
1435
1485
  children: jsx(UserAccount, {})
1436
1486
  })) : jsx(Button, __assign({
1437
- variant: 'outline',
1438
- color: loginButtonColorVariant,
1439
- className: "".concat(headerBackground === 'transparent' ? 'novac-login-button' : 'login-button'),
1440
1487
  onClick: onLoginButtonClick,
1441
1488
  css: {
1442
1489
  width: 153,
1443
1490
  height: 40
1444
1491
  },
1445
- loading: false
1492
+ loading: false,
1493
+ color: loginButtonColorVariant,
1494
+ variant: ButtonVariant.OUTLINE
1446
1495
  }, {
1447
- children: jsx(Typography, __assign({
1448
- componentNode: 'span',
1449
- variant: 'L2',
1450
- color: loginButtonColorVariant === ButtonColor.NEUTRAL ? 'neutral' : 'primary'
1451
- }, {
1452
- children: LOG_IN_TEXT
1453
- }))
1496
+ children: LOG_IN_TEXT
1454
1497
  }))
1455
1498
  })]
1456
1499
  }))]