@cleartrip/ct-design-header 1.2.0-SNAPSHOT-header-v0.11.0 → 1.2.0-SNAPSHOT-header-fix-v3.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
  };
@@ -529,34 +541,41 @@ var BusinessDropdownContent = function (_a) {
529
541
  details = _a.details,
530
542
  link = _a.link,
531
543
  ravenActionName = _a.ravenActionName;
532
- return jsxs(Container, __assign({
533
- cursor: 'pointer',
534
- width: '200px',
535
- className: 'bd-hover-container',
544
+ return jsxs(BDHoverContainer, __assign({
545
+ className: 'bd-hover-container-js',
536
546
  onClick: function () {
537
547
  return handleBusinessDropdownClick(link, title, ravenActionName);
538
548
  }
539
549
  }, {
540
550
  children: [jsxs(Container, __assign({
541
551
  display: 'flex',
542
- flexDirection: 'row',
543
- alignItems: 'center',
544
- columnGap: '8px'
552
+ flexDirection: 'column',
553
+ rowGap: '4px'
545
554
  }, {
546
- children: [jsx(Typography, __assign({
547
- variant: 'HM2',
548
- className: 'color-orange-on-hover'
555
+ children: [jsxs(Container, __assign({
556
+ display: 'flex',
557
+ flexDirection: 'row',
558
+ alignItems: 'center',
559
+ columnGap: '8px'
549
560
  }, {
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
561
+ children: [jsx(Typography, __assign({
562
+ variant: 'HM2',
563
+ className: 'color-orange-on-hover-js',
564
+ css: {
565
+ transition: 'color 200ms ease'
566
+ }
567
+ }, {
568
+ children: title
569
+ })), jsx(AnimatedArrow, {})]
570
+ })), jsx(Typography, __assign({
571
+ variant: 'B3',
572
+ css: {
573
+ marginTop: '4px',
574
+ opacity: 0.75
575
+ }
576
+ }, {
577
+ children: subtitle
578
+ }))]
560
579
  })), jsx(Typography, __assign({
561
580
  variant: 'P3',
562
581
  color: 'subheading',
@@ -573,17 +592,38 @@ var BusinessDropdownContent = function (_a) {
573
592
  };
574
593
  var AnimatedArrow = function () {
575
594
  return jsx(Container, __assign({
576
- className: 'bd-arrow-container'
595
+ className: 'bd-arrow-container-js',
596
+ css: arrowContainerStyles
577
597
  }, {
578
598
  children: __spreadArray([], Array(3), true).map(function (_, index) {
579
599
  return jsx(Container, __assign({
580
- className: 'bd-arrow-wrapper'
600
+ className: 'bd-arrow-wrapper-js',
601
+ display: 'flex',
602
+ alignItems: 'center'
581
603
  }, {
582
604
  children: jsx(ArrowRight, {})
583
605
  }), index);
584
606
  })
585
607
  }));
586
608
  };
609
+ var moveRight = keyframes(templateObject_1 || (templateObject_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"])));
610
+ 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"])));
611
+ var arrowContainerStyles = {
612
+ display: 'flex',
613
+ backgroundColor: 'black',
614
+ transition: 'background-color 200ms ease',
615
+ 'flex-direction': 'row',
616
+ justifyContent: 'center',
617
+ width: '20px',
618
+ height: '20px',
619
+ overflow: 'hidden',
620
+ borderRadius: '50%'
621
+ };
622
+ var BDHoverContainer = /*#__PURE__*/styled.div.withConfig({
623
+ displayName: "BusinessDropdown__BDHoverContainer",
624
+ componentId: "sc-1tsshe4-0"
625
+ })(templateObject_3 || (templateObject_3 = __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);
626
+ var templateObject_1, templateObject_2, templateObject_3;
587
627
 
588
628
  var ACCOUNT_OPTIONS_POPUP_CONFIG = [{
589
629
  text: 'My Profile',
@@ -905,22 +945,20 @@ var RewardsSection = function () {
905
945
  gap: '4px'
906
946
  }
907
947
  }, {
908
- children: [loyaltyLoading ? jsx(Container, {
948
+ children: [loyaltyLoading ? jsx(Shimmer, {
909
949
  width: '50px',
910
950
  height: '32px',
911
- borderRadius: '8px',
912
- backgroundColor: '#efefef'
951
+ borderRadius: '8px'
913
952
  }) : selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip && jsx(LoyaltyChip, {
914
953
  icon: LOYALTY_DATA[selectedLoyaltyType].icon,
915
954
  borderGradient: LOYALTY_DATA[selectedLoyaltyType].borderGradient,
916
955
  backgroundGradient: LOYALTY_DATA[selectedLoyaltyType].backgroundGradient,
917
956
  chevronFillColor: ((_a = LOYALTY_DATA[selectedLoyaltyType]) === null || _a === void 0 ? void 0 : _a.chevronFillColor) || '#FFF',
918
957
  handleChipClick: loyaltyChipClick
919
- }), superCoinsLoading ? jsx(Container, {
958
+ }), superCoinsLoading ? jsx(Shimmer, {
920
959
  width: '50px',
921
960
  height: '32px',
922
- borderRadius: '8px',
923
- backgroundColor: '#efefef'
961
+ borderRadius: '8px'
924
962
  }) : !hideSupercoinsChip && jsx(ExpandableItem, {
925
963
  icon: jsx(Supercoin, {
926
964
  width: 20,
@@ -929,11 +967,10 @@ var RewardsSection = function () {
929
967
  value: superCoinBalance,
930
968
  handleChipClick: supercoinsChipClick,
931
969
  type: 'supercoin'
932
- }), walletLoading ? jsx(Container, {
970
+ }), walletLoading ? jsx(Shimmer, {
933
971
  width: '50px',
934
972
  height: '32px',
935
- borderRadius: '8px',
936
- backgroundColor: '#efefef'
973
+ borderRadius: '8px'
937
974
  }) : !hideWalletChip && jsx(ExpandableItem, {
938
975
  icon: jsx(Wallet, {
939
976
  width: 20,
@@ -1004,11 +1041,9 @@ var AccountDropdownContent = function (_a) {
1004
1041
  variant: variant,
1005
1042
  color: color
1006
1043
  }, {
1007
- children: loading ? jsx(Container, {
1044
+ children: loading ? jsx(Shimmer, {
1008
1045
  height: variant === 'HM3' ? '18px' : '12px',
1009
- width: variant === 'HM3' ? '140px' : '200px',
1010
- backgroundColor: '#efefef',
1011
- borderRadius: '8px'
1046
+ width: variant === 'HM3' ? '140px' : '200px'
1012
1047
  }) : content
1013
1048
  }));
1014
1049
  };
@@ -1063,13 +1098,13 @@ var AccountDropdownContent = function (_a) {
1063
1098
  icon = _a.icon,
1064
1099
  redirectionLink = _a.redirectionLink;
1065
1100
  return jsx(Container, __assign({
1066
- className: 'hoverable-container',
1067
1101
  padding: '8px',
1068
1102
  borderRadius: '8px',
1069
1103
  cursor: 'pointer',
1070
1104
  onClick: function () {
1071
1105
  return handleAccountOptionsClick(text, redirectionLink);
1072
- }
1106
+ },
1107
+ css: __assign({}, getAccountOptionHoverStyles())
1073
1108
  }, {
1074
1109
  children: jsxs(Container, __assign({
1075
1110
  display: 'flex',
@@ -1095,12 +1130,13 @@ var AccountDropdownContent = function (_a) {
1095
1130
  borderBottom: '1px dashed #E6E6E6'
1096
1131
  }
1097
1132
  }), jsxs(Container, __assign({
1098
- className: 'logout-button',
1099
1133
  display: 'flex',
1100
1134
  padding: '8px',
1101
1135
  borderRadius: '8px',
1102
1136
  cursor: 'pointer',
1103
- onClick: handleLogoutClick
1137
+ columnGap: '8px',
1138
+ onClick: handleLogoutClick,
1139
+ css: __assign({}, getLogoutButtonHoverStyles())
1104
1140
  }, {
1105
1141
  children: [jsx(Signout, {
1106
1142
  height: 24,
@@ -1120,6 +1156,22 @@ var AccountDropdownContent = function (_a) {
1120
1156
  }))]
1121
1157
  }));
1122
1158
  };
1159
+ var getAccountOptionHoverStyles = function () {
1160
+ return {
1161
+ transition: 'background-color 0.2s ease-in-out',
1162
+ '&:hover': {
1163
+ backgroundColor: '#ECF3FF'
1164
+ }
1165
+ };
1166
+ };
1167
+ var getLogoutButtonHoverStyles = function () {
1168
+ return {
1169
+ transition: 'background-color 0.2s ease-in-out',
1170
+ '&:hover': {
1171
+ backgroundColor: '#FBEFEF'
1172
+ }
1173
+ };
1174
+ };
1123
1175
 
1124
1176
  var UserAccount = function () {
1125
1177
  var _a = useHeaderContext(),
@@ -1144,7 +1196,7 @@ var UserAccount = function () {
1144
1196
  setScrolled = _d[1];
1145
1197
  useEffect(function () {
1146
1198
  var handleScroll = function () {
1147
- setScrolled(window.scrollY >= 100);
1199
+ setScrolled(window.scrollY >= 50);
1148
1200
  };
1149
1201
  window.addEventListener('scroll', handleScroll);
1150
1202
  return function () {
@@ -1246,20 +1298,20 @@ var HeaderContent = function () {
1246
1298
  setScrolled = _f[1];
1247
1299
  useEffect(function () {
1248
1300
  var handleScroll = function () {
1249
- setScrolled(window.scrollY >= 100);
1301
+ setScrolled(window.scrollY >= 50);
1250
1302
  };
1251
1303
  window.addEventListener('scroll', handleScroll);
1252
1304
  return function () {
1253
1305
  return window.removeEventListener('scroll', handleScroll);
1254
1306
  };
1255
1307
  }, []);
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;
1308
+ var headerTheme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1309
+ var headerBackground = headerTheme.headerBackground,
1310
+ logoFill = headerTheme.logoFill,
1311
+ loginButtonColorVariant = headerTheme.loginButtonColorVariant,
1312
+ hoverColor = headerTheme.hoverColor,
1313
+ fkcompanyColor = headerTheme.fkcompanyColor,
1314
+ typographyColor = headerTheme.typographyColor;
1263
1315
  var _g = useHoverDropdown({
1264
1316
  openDelay: 0
1265
1317
  }),
@@ -1434,23 +1486,16 @@ var HeaderContent = function () {
1434
1486
  }, {
1435
1487
  children: jsx(UserAccount, {})
1436
1488
  })) : jsx(Button, __assign({
1437
- variant: 'outline',
1438
- color: loginButtonColorVariant,
1439
- className: "".concat(headerBackground === 'transparent' ? 'novac-login-button' : 'login-button'),
1440
1489
  onClick: onLoginButtonClick,
1441
1490
  css: {
1442
1491
  width: 153,
1443
1492
  height: 40
1444
1493
  },
1445
- loading: false
1494
+ loading: false,
1495
+ color: loginButtonColorVariant,
1496
+ variant: ButtonVariant.OUTLINE
1446
1497
  }, {
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
- }))
1498
+ children: LOG_IN_TEXT
1454
1499
  }))
1455
1500
  })]
1456
1501
  }))]