@abcagency/hc-ui-components 1.3.14 → 1.3.16

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 (166) hide show
  1. package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -1
  2. package/dist/apis/hcApi.js +1 -1
  3. package/dist/apis/hcApi.js.map +1 -1
  4. package/dist/clientToken.js.map +1 -1
  5. package/dist/components/HireControlMap.js +15 -5
  6. package/dist/components/HireControlMap.js.map +1 -1
  7. package/dist/components/modules/accordions/MapAccordionItem.js +11 -1
  8. package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -1
  9. package/dist/components/modules/accordions/default.js.map +1 -1
  10. package/dist/components/modules/accordions/filterItem.js +2 -1
  11. package/dist/components/modules/accordions/filterItem.js.map +1 -1
  12. package/dist/components/modules/accordions/filters.js +0 -3
  13. package/dist/components/modules/accordions/filters.js.map +1 -1
  14. package/dist/components/modules/buttons/button-group-apply.js +36 -15
  15. package/dist/components/modules/buttons/button-group-apply.js.map +1 -1
  16. package/dist/components/modules/buttons/commute-pill.js.map +1 -1
  17. package/dist/components/modules/buttons/default.js.map +1 -1
  18. package/dist/components/modules/buttons/items-pill.js.map +1 -1
  19. package/dist/components/modules/buttons/pill-wrapper.js.map +1 -1
  20. package/dist/components/modules/buttons/show-all-button.js.map +1 -1
  21. package/dist/components/modules/cards/default.js.map +1 -1
  22. package/dist/components/modules/cards/filter.js.map +1 -1
  23. package/dist/components/modules/dialogs/apply-dialog.js.map +1 -1
  24. package/dist/components/modules/filter/commute.js +22 -6
  25. package/dist/components/modules/filter/commute.js.map +1 -1
  26. package/dist/components/modules/filter/index.js +7 -0
  27. package/dist/components/modules/filter/index.js.map +1 -1
  28. package/dist/components/modules/filter/item.js +16 -1
  29. package/dist/components/modules/filter/item.js.map +1 -1
  30. package/dist/components/modules/filter/location.js +1 -1
  31. package/dist/components/modules/filter/location.js.map +1 -1
  32. package/dist/components/modules/filter/points-of-interest.js.map +1 -1
  33. package/dist/components/modules/filter/radio-item.js +7 -0
  34. package/dist/components/modules/filter/radio-item.js.map +1 -1
  35. package/dist/components/modules/filter/search.js.map +1 -1
  36. package/dist/components/modules/filter/sort.js.map +1 -1
  37. package/dist/components/modules/grid.js.map +1 -1
  38. package/dist/components/modules/icon.js.map +1 -1
  39. package/dist/components/modules/jobListing/listing-details.js +6 -0
  40. package/dist/components/modules/jobListing/listing-details.js.map +1 -1
  41. package/dist/components/modules/maps/info-window-card.js.map +1 -1
  42. package/dist/components/modules/maps/info-window-content.js +20 -0
  43. package/dist/components/modules/maps/info-window-content.js.map +1 -1
  44. package/dist/components/modules/maps/list/field-mapper.js.map +1 -1
  45. package/dist/components/modules/maps/list/header-item.js.map +1 -1
  46. package/dist/components/modules/maps/list/header.js.map +1 -1
  47. package/dist/components/modules/maps/list/index.js +21 -12
  48. package/dist/components/modules/maps/list/index.js.map +1 -1
  49. package/dist/components/modules/maps/list/item-expand-card/index.js.map +1 -1
  50. package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +1 -1
  51. package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +1 -1
  52. package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +1 -1
  53. package/dist/components/modules/maps/list/list-item/index.js +12 -2
  54. package/dist/components/modules/maps/list/list-item/index.js.map +1 -1
  55. package/dist/components/modules/maps/map-list.js.map +1 -1
  56. package/dist/components/modules/maps/map-marker.js +10 -0
  57. package/dist/components/modules/maps/map-marker.js.map +1 -1
  58. package/dist/components/modules/maps/map.js.map +1 -1
  59. package/dist/components/modules/maps/place-marker.js.map +1 -1
  60. package/dist/components/modules/maps/tabs.js.map +1 -1
  61. package/dist/constants/eventTypes.js +16 -0
  62. package/dist/constants/eventTypes.js.map +1 -0
  63. package/dist/constants/placeTypes.js.map +1 -1
  64. package/dist/contexts/mapContext.js +9 -27
  65. package/dist/contexts/mapContext.js.map +1 -1
  66. package/dist/contexts/mapListContext.js +57 -38
  67. package/dist/contexts/mapListContext.js.map +1 -1
  68. package/dist/contexts/placesContext.js.map +1 -1
  69. package/dist/contexts/trackEventContext.js +20 -0
  70. package/dist/contexts/trackEventContext.js.map +1 -0
  71. package/dist/hooks/useList.js +1 -13
  72. package/dist/hooks/useList.js.map +1 -1
  73. package/dist/services/apis/hcApi.js +1 -1
  74. package/dist/services/apis/hcApi.js.map +1 -1
  75. package/dist/services/clientToken.js.map +1 -1
  76. package/dist/services/configService.js.map +1 -1
  77. package/dist/services/googlePlacesNearbyService.js.map +1 -1
  78. package/dist/services/listingAggregatorService.js +43 -16
  79. package/dist/services/listingAggregatorService.js.map +1 -1
  80. package/dist/services/listingEntityService.js.map +1 -1
  81. package/dist/services/listingService.js.map +1 -1
  82. package/dist/services/recruiterService.js.map +1 -1
  83. package/dist/util/filterUtil.js.map +1 -1
  84. package/dist/util/loading.js.map +1 -1
  85. package/dist/util/localStorageUtil.js.map +1 -1
  86. package/dist/util/mapIconUtil.js.map +1 -1
  87. package/dist/util/mapUtil.js.map +1 -1
  88. package/dist/util/sortUtil.js.map +1 -1
  89. package/dist/util/stringUtils.js.map +1 -1
  90. package/jsconfig.json +7 -7
  91. package/package.json +60 -60
  92. package/postcss.config.js +13 -13
  93. package/preset.default.js +15 -15
  94. package/rollup.config.mjs +88 -87
  95. package/src/apis/hcApi.js +93 -93
  96. package/src/clientToken.js +9 -9
  97. package/src/components/HireControlMap.js +129 -124
  98. package/src/components/modules/accordions/MapAccordionItem.js +74 -72
  99. package/src/components/modules/accordions/default.js +171 -171
  100. package/src/components/modules/accordions/filterItem.js +55 -53
  101. package/src/components/modules/accordions/filters.js +47 -47
  102. package/src/components/modules/buttons/button-group-apply.js +123 -116
  103. package/src/components/modules/buttons/commute-pill.js +22 -22
  104. package/src/components/modules/buttons/default.js +194 -194
  105. package/src/components/modules/buttons/items-pill.js +35 -35
  106. package/src/components/modules/buttons/pill-wrapper.js +27 -27
  107. package/src/components/modules/buttons/show-all-button.js +20 -20
  108. package/src/components/modules/cards/default.js +167 -167
  109. package/src/components/modules/cards/filter.js +56 -56
  110. package/src/components/modules/dialogs/apply-dialog.js +48 -48
  111. package/src/components/modules/filter/commute.js +154 -149
  112. package/src/components/modules/filter/index.js +89 -87
  113. package/src/components/modules/filter/item.js +87 -76
  114. package/src/components/modules/filter/location.js +71 -71
  115. package/src/components/modules/filter/points-of-interest.js +44 -44
  116. package/src/components/modules/filter/radio-item.js +57 -53
  117. package/src/components/modules/filter/search.js +92 -92
  118. package/src/components/modules/filter/sort.js +83 -83
  119. package/src/components/modules/grid.js +54 -54
  120. package/src/components/modules/icon.js +33 -33
  121. package/src/components/modules/jobListing/listing-details.js +99 -95
  122. package/src/components/modules/maps/info-window-card.js +17 -17
  123. package/src/components/modules/maps/info-window-content.js +81 -74
  124. package/src/components/modules/maps/list/field-mapper.js +112 -112
  125. package/src/components/modules/maps/list/header-item.js +91 -91
  126. package/src/components/modules/maps/list/header.js +47 -47
  127. package/src/components/modules/maps/list/index.js +112 -107
  128. package/src/components/modules/maps/list/item-expand-card/index.js +22 -22
  129. package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +50 -50
  130. package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +68 -68
  131. package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -22
  132. package/src/components/modules/maps/list/list-item/index.js +135 -133
  133. package/src/components/modules/maps/map-list.js +74 -74
  134. package/src/components/modules/maps/map-marker.js +88 -86
  135. package/src/components/modules/maps/map.js +230 -230
  136. package/src/components/modules/maps/place-marker.js +41 -41
  137. package/src/components/modules/maps/tabs.js +81 -81
  138. package/src/constants/eventTypes.js +13 -0
  139. package/src/constants/placeTypes.js +8 -8
  140. package/src/contexts/mapContext.js +101 -115
  141. package/src/contexts/mapListContext.js +242 -222
  142. package/src/contexts/placesContext.js +102 -102
  143. package/src/contexts/trackEventContext.js +14 -0
  144. package/src/hooks/useList.js +89 -100
  145. package/src/index.js +3 -3
  146. package/src/services/configService.js +16 -16
  147. package/src/services/googlePlacesNearbyService.js +33 -33
  148. package/src/services/listingAggregatorService.js +50 -45
  149. package/src/services/listingEntityService.js +15 -15
  150. package/src/services/listingService.js +26 -26
  151. package/src/services/recruiterService.js +17 -17
  152. package/src/styles/index.css +23 -23
  153. package/src/util/arrayUtil.js +3 -3
  154. package/src/util/fieldMapper.js +22 -22
  155. package/src/util/filterUtil.js +195 -195
  156. package/src/util/loading.js +17 -17
  157. package/src/util/localStorageUtil.js +26 -26
  158. package/src/util/mapIconUtil.js +180 -180
  159. package/src/util/mapUtil.js +91 -91
  160. package/src/util/sortUtil.js +32 -32
  161. package/src/util/stringUtils.js +6 -6
  162. package/src/util/urlFilterUtil.js +90 -90
  163. package/tailwind.config.js +126 -126
  164. package/.editorconfig +0 -12
  165. package/.eslintrc +0 -105
  166. package/.prettierignore +0 -3
@@ -1,91 +1,91 @@
1
- import React, { useState, useEffect } from 'react';
2
-
3
- import Button from '~/components/modules/buttons/default';
4
-
5
- const SORT_STATE = {
6
- notSorted: "not-sorted",
7
- sortedAsc: "sorted-asc",
8
- sortedDesc: "sorted-desc"
9
- };
10
-
11
- const HeaderItem = ({
12
- className,
13
- children,
14
- field,
15
- setSortSetting,
16
- sortSetting,
17
- isSortable,
18
- ...rest
19
- }) => {
20
- const [isSorted, setIsSorted] = useState(SORT_STATE.notSorted);
21
-
22
- const handleChange = field => {
23
- if (isSortable === false)
24
- return;
25
- let setting = {
26
- field: field,
27
- type: isSorted === SORT_STATE.sortedAsc ? "desc" : "asc"
28
- };
29
- setSortSetting(setting);
30
- isSorted === SORT_STATE.notSorted
31
- ? setIsSorted(SORT_STATE.sortedAsc)
32
- : isSorted === SORT_STATE.sortedAsc
33
- ? setIsSorted(SORT_STATE.sortedDesc)
34
- : setIsSorted(SORT_STATE.sortedAsc);
35
- };
36
-
37
- useEffect(() => {
38
- if (sortSetting?.field != null && sortSetting.field != field) {
39
- setIsSorted(SORT_STATE.notSorted);
40
- } else if (
41
- sortSetting?.field != null &&
42
- isSorted == SORT_STATE.notSorted &&
43
- sortSetting.field == field
44
- ) {
45
- setIsSorted(
46
- sortSetting.type == "asc"
47
- ? SORT_STATE.sortedAsc
48
- : SORT_STATE.sortedDesc
49
- );
50
- }
51
- }, [sortSetting, isSorted, field]);
52
-
53
- return (
54
- <Button.Btn
55
- onClick={() => handleChange(field)}
56
- variant="none"
57
- className={`
58
- hc-p-2 hc-rounded-none hc-text-left hc-normal-case hover:hc-bg-uiAccent/5 focus:hc-bg-uiAccent/5
59
- ${field.toLowerCase() === "position" ? "hc-col-span-2" : "hc-col-span-1"}
60
- ${className ?? ""}
61
- `}
62
- {...rest}
63
- >
64
- <Button.Body>
65
- <span className="hc-font-semibold">{children}</span>
66
- {isSortable && (
67
- <div className="hc-flex hc-flex-col hc-pr-2">
68
- <Button.Icon
69
- icon="bi:caret-up-fill"
70
- size="hc-size-2.5"
71
- className={`
72
- hc-transition-opacity
73
- ${isSorted === "sorted-asc" ? "hc-opacity-100 hc-text-primary" : "hc-opacity-30"}
74
- `}
75
- />
76
- <Button.Icon
77
- icon="bi:caret-down-fill"
78
- size="hc-size-2.5"
79
- className={`
80
- transition-opacity
81
- ${isSorted === "sorted-desc" ? "hc-opacity-100" : "hc-opacity-30"}
82
- `}
83
- />
84
- </div>
85
- )}
86
- </Button.Body>
87
- </Button.Btn>
88
- );
89
- };
90
-
91
- export default HeaderItem;
1
+ import React, { useState, useEffect } from 'react';
2
+
3
+ import Button from '~/components/modules/buttons/default';
4
+
5
+ const SORT_STATE = {
6
+ notSorted: "not-sorted",
7
+ sortedAsc: "sorted-asc",
8
+ sortedDesc: "sorted-desc"
9
+ };
10
+
11
+ const HeaderItem = ({
12
+ className,
13
+ children,
14
+ field,
15
+ setSortSetting,
16
+ sortSetting,
17
+ isSortable,
18
+ ...rest
19
+ }) => {
20
+ const [isSorted, setIsSorted] = useState(SORT_STATE.notSorted);
21
+
22
+ const handleChange = field => {
23
+ if (isSortable === false)
24
+ return;
25
+ let setting = {
26
+ field: field,
27
+ type: isSorted === SORT_STATE.sortedAsc ? "desc" : "asc"
28
+ };
29
+ setSortSetting(setting);
30
+ isSorted === SORT_STATE.notSorted
31
+ ? setIsSorted(SORT_STATE.sortedAsc)
32
+ : isSorted === SORT_STATE.sortedAsc
33
+ ? setIsSorted(SORT_STATE.sortedDesc)
34
+ : setIsSorted(SORT_STATE.sortedAsc);
35
+ };
36
+
37
+ useEffect(() => {
38
+ if (sortSetting?.field != null && sortSetting.field != field) {
39
+ setIsSorted(SORT_STATE.notSorted);
40
+ } else if (
41
+ sortSetting?.field != null &&
42
+ isSorted == SORT_STATE.notSorted &&
43
+ sortSetting.field == field
44
+ ) {
45
+ setIsSorted(
46
+ sortSetting.type == "asc"
47
+ ? SORT_STATE.sortedAsc
48
+ : SORT_STATE.sortedDesc
49
+ );
50
+ }
51
+ }, [sortSetting, isSorted, field]);
52
+
53
+ return (
54
+ <Button.Btn
55
+ onClick={() => handleChange(field)}
56
+ variant="none"
57
+ className={`
58
+ hc-p-2 hc-rounded-none hc-text-left hc-normal-case hover:hc-bg-uiAccent/5 focus:hc-bg-uiAccent/5
59
+ ${field.toLowerCase() === "position" ? "hc-col-span-2" : "hc-col-span-1"}
60
+ ${className ?? ""}
61
+ `}
62
+ {...rest}
63
+ >
64
+ <Button.Body>
65
+ <span className="hc-font-semibold">{children}</span>
66
+ {isSortable && (
67
+ <div className="hc-flex hc-flex-col hc-pr-2">
68
+ <Button.Icon
69
+ icon="bi:caret-up-fill"
70
+ size="hc-size-2.5"
71
+ className={`
72
+ hc-transition-opacity
73
+ ${isSorted === "sorted-asc" ? "hc-opacity-100 hc-text-primary" : "hc-opacity-30"}
74
+ `}
75
+ />
76
+ <Button.Icon
77
+ icon="bi:caret-down-fill"
78
+ size="hc-size-2.5"
79
+ className={`
80
+ transition-opacity
81
+ ${isSorted === "sorted-desc" ? "hc-opacity-100" : "hc-opacity-30"}
82
+ `}
83
+ />
84
+ </div>
85
+ )}
86
+ </Button.Body>
87
+ </Button.Btn>
88
+ );
89
+ };
90
+
91
+ export default HeaderItem;
@@ -1,47 +1,47 @@
1
- import React from 'react';
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- import Grid from '~/components/modules/grid';
5
- import HeaderItem from '~/components/modules/maps/list/header-item';
6
-
7
- const ListHeader = ({
8
- className,
9
- fieldsShown,
10
- fieldNames,
11
- fieldIsSortable = true,
12
- setSortSetting,
13
- sortSetting
14
- }) => {
15
- return (
16
- <Grid
17
- columns="hc-grid-flow-col hc-auto-cols-fr"
18
- gap="hc-gap-0"
19
- isAnimated={false}
20
- className={twMerge`
21
- hc-hidden md:hc-grid hc-bg-uiAccent/10 hc-border-b hc-border-uiAccent/10 hc-sticky hc-top-0 hc-z-10
22
- ${className ?? ""}
23
- `}
24
- >
25
- {fieldsShown.map(field => (
26
- <HeaderItem
27
- key={field}
28
- isSortable={fieldIsSortable}
29
- sortSetting={sortSetting}
30
- field={field}
31
- setSortSetting={setSortSetting}
32
- >
33
- {fieldNames[field]}
34
- </HeaderItem>
35
- ))}
36
- <HeaderItem key={"favorite"}
37
- isSortable={false}
38
- field={"favorite"}
39
- >
40
- Favorite
41
- </HeaderItem>
42
-
43
- </Grid>
44
- );
45
- };
46
-
47
- export default ListHeader;
1
+ import React from 'react';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ import Grid from '~/components/modules/grid';
5
+ import HeaderItem from '~/components/modules/maps/list/header-item';
6
+
7
+ const ListHeader = ({
8
+ className,
9
+ fieldsShown,
10
+ fieldNames,
11
+ fieldIsSortable = true,
12
+ setSortSetting,
13
+ sortSetting
14
+ }) => {
15
+ return (
16
+ <Grid
17
+ columns="hc-grid-flow-col hc-auto-cols-fr"
18
+ gap="hc-gap-0"
19
+ isAnimated={false}
20
+ className={twMerge`
21
+ hc-hidden md:hc-grid hc-bg-uiAccent/10 hc-border-b hc-border-uiAccent/10 hc-sticky hc-top-0 hc-z-10
22
+ ${className ?? ""}
23
+ `}
24
+ >
25
+ {fieldsShown.map(field => (
26
+ <HeaderItem
27
+ key={field}
28
+ isSortable={fieldIsSortable}
29
+ sortSetting={sortSetting}
30
+ field={field}
31
+ setSortSetting={setSortSetting}
32
+ >
33
+ {fieldNames[field]}
34
+ </HeaderItem>
35
+ ))}
36
+ <HeaderItem key={"favorite"}
37
+ isSortable={false}
38
+ field={"favorite"}
39
+ >
40
+ Favorite
41
+ </HeaderItem>
42
+
43
+ </Grid>
44
+ );
45
+ };
46
+
47
+ export default ListHeader;
@@ -1,107 +1,112 @@
1
- import React from 'react';
2
-
3
- import Accordion from '~/components/modules/accordions/default';
4
- import Header from '~/components/modules/maps/list/header';
5
- import MapAccordionItem from '~/components/modules/accordions/MapAccordionItem';
6
- import Sort from '~/components/modules/filter/sort';
7
- import ListingDetails from '~/components/modules/jobListing/listing-details';
8
-
9
- import useListLogic from '~/hooks/useList';
10
-
11
- import Loading from "~/util/loading";
12
-
13
- import { useMap } from '~/contexts/mapContext';
14
- import { useMapList } from '~/contexts/mapListContext';
15
-
16
- const ItemsList = ({
17
- fieldNames,
18
- showMap,
19
- fieldsShown,
20
- specialFeatures
21
- }) => {
22
-
23
- const {
24
- itemLimit,
25
- sortSetting,
26
- loader,
27
- scrollContainerRef,
28
- itemRefs,
29
- setSortSetting
30
- } = useListLogic();
31
- const { selectedListItem } = useMap();
32
- const { mapItems, filteredListings, loading, commuteLocation } = useMapList();
33
- const itemExpandedContent = (item, recruiters) =>
34
- item ? <ListingDetails item={item} recruiters={recruiters} /> : null;
35
- if (!fieldsShown.includes('travelTime') && commuteLocation != null && Object.entries(commuteLocation).length > 0) {
36
- fieldsShown.push('travelTime');
37
- fieldNames['travelTime'] = 'Commute';
38
- } else if (fieldsShown.includes('travelTime') && !commuteLocation) {
39
- fieldsShown = fieldsShown.filter(x => x !== 'travelTime');
40
- }
41
-
42
- return (
43
- <div className="hc-relative hc-bg-white md:hc-px-4 hc-flex hc-flex-col">
44
- <div className="hc-flex hc-flex-wrap hc-items-center hc-justify-between hc-gap-4 md:hc-mb-2 hc-p-3 md:hc-p-0 hc-bg-uiAccent/10 md:hc-bg-transparent hc-border-b md:hc-border-none hc-border-uiAccent/20">
45
- <h2 className="hc-text-gray-500 hc-font-semibold hc-text-xs md:hc-text-sm">
46
- {loading &&
47
- <span>Loading...</span>
48
- }
49
- {!loading &&
50
- <span>{filteredListings.length} results</span>
51
- }
52
- </h2>
53
- <div className="hc-block md:hc-hidden">
54
- <Sort
55
- fields={fieldsShown}
56
- setSortSetting={setSortSetting}
57
- fieldNames={fieldNames}
58
- />
59
- </div>
60
- </div>
61
- <div>
62
- <Header
63
- setSortSetting={setSortSetting}
64
- sortSetting={sortSetting}
65
- fieldsShown={fieldsShown}
66
- fieldNames={fieldNames}
67
- />
68
- </div>
69
- <div
70
- ref={scrollContainerRef}
71
- className={`
72
- hc-flex-grow hc-overflow-y-auto
73
- ${showMap ? "md:hc-max-h-45vh hc-max-h-[100vh]" : "md:hc-max-h-95vh hc-max-h-[95vh]"}
74
- `}
75
- >
76
- {loading ? (
77
- <div className="hc-flex hc-justify-center hc-items-center hc-pt-20">
78
- <Loading />
79
- </div>
80
- ) : (
81
- <Accordion className="hc-divide-y hc-divide-uiAccent/10 hc-z-[1000]" defaultValue={selectedListItem?.id}>
82
- {filteredListings.slice(0, itemLimit).map(item => {
83
- return (<MapAccordionItem
84
- key={item.id}
85
- showMap={showMap}
86
- item={item}
87
- itemRefs={itemRefs}
88
- fieldsShown={fieldsShown}
89
- itemExpandedContent={itemExpandedContent}
90
- specialFeatures={specialFeatures}
91
- mapItems={mapItems}
92
- isActive={selectedListItem?.id == item.id}
93
- hasListItemSelected={selectedListItem != null}
94
- />
95
- );
96
- })}
97
- </Accordion>
98
- )}
99
- <div ref={loader} style={{ height: "100px", textAlign: "center" }}>
100
- {filteredListings.length >= itemLimit && <Loading />}
101
- </div>
102
- </div>
103
- </div>
104
- );
105
- };
106
-
107
- export default ItemsList;
1
+ import React from 'react';
2
+
3
+ import Accordion from '~/components/modules/accordions/default';
4
+ import Header from '~/components/modules/maps/list/header';
5
+ import MapAccordionItem from '~/components/modules/accordions/MapAccordionItem';
6
+ import Sort from '~/components/modules/filter/sort';
7
+ import ListingDetails from '~/components/modules/jobListing/listing-details';
8
+
9
+ import useListLogic from '~/hooks/useList';
10
+
11
+ import Loading from "~/util/loading";
12
+
13
+ import { useMap } from '~/contexts/mapContext';
14
+ import { useMapList } from '~/contexts/mapListContext';
15
+ import { useTrackEvent } from '~/contexts/trackEventContext';
16
+
17
+ import { dynamicSort } from '~/util/sortUtil';
18
+
19
+ const ItemsList = ({
20
+ fieldNames,
21
+ showMap,
22
+ fieldsShown,
23
+ specialFeatures
24
+ }) => {
25
+ const { mapItems, filteredListings, loading, commuteLocation, sortSetting, setSortSetting } = useMapList();
26
+ const {
27
+ itemLimit,
28
+ loader,
29
+ scrollContainerRef,
30
+ itemRefs
31
+ } = useListLogic(filteredListings);
32
+ const { selectedListItem } = useMap();
33
+ const { trackEvent, eventTypes } = useTrackEvent();
34
+ const itemExpandedContent = (item, recruiters) =>
35
+ item ? <ListingDetails item={item} recruiters={recruiters} /> : null;
36
+ if (!fieldsShown.includes('travelTime') && commuteLocation != null && Object.entries(commuteLocation).length > 0) {
37
+ fieldsShown.push('travelTime');
38
+ fieldNames['travelTime'] = 'Commute';
39
+ } else if (fieldsShown.includes('travelTime') && !commuteLocation) {
40
+ fieldsShown = fieldsShown.filter(x => x !== 'travelTime');
41
+ }
42
+
43
+ const setTrackedSortSetting = sortSetting => {
44
+ trackEvent(eventTypes.LIST_SORTED, sortSetting);
45
+ setSortSetting(sortSetting);
46
+ };
47
+ return (
48
+ <div className="hc-relative hc-bg-white md:hc-px-4 hc-flex hc-flex-col">
49
+ <div className="hc-flex hc-flex-wrap hc-items-center hc-justify-between hc-gap-4 md:hc-mb-2 hc-p-3 md:hc-p-0 hc-bg-uiAccent/10 md:hc-bg-transparent hc-border-b md:hc-border-none hc-border-uiAccent/20">
50
+ <h2 className="hc-text-gray-500 hc-font-semibold hc-text-xs md:hc-text-sm">
51
+ {loading &&
52
+ <span>Loading...</span>
53
+ }
54
+ {!loading &&
55
+ <span>{filteredListings.length} results</span>
56
+ }
57
+ </h2>
58
+ <div className="hc-block md:hc-hidden">
59
+ <Sort
60
+ fields={fieldsShown}
61
+ setSortSetting={setTrackedSortSetting}
62
+ fieldNames={fieldNames}
63
+ />
64
+ </div>
65
+ </div>
66
+ <div>
67
+ <Header
68
+ setSortSetting={setTrackedSortSetting}
69
+ sortSetting={sortSetting}
70
+ fieldsShown={fieldsShown}
71
+ fieldNames={fieldNames}
72
+ />
73
+ </div>
74
+ <div
75
+ ref={scrollContainerRef}
76
+ className={`
77
+ hc-flex-grow hc-overflow-y-auto
78
+ ${showMap ? "md:hc-max-h-45vh hc-max-h-[100vh]" : "md:hc-max-h-95vh hc-max-h-[95vh]"}
79
+ `}
80
+ >
81
+ {loading ? (
82
+ <div className="hc-flex hc-justify-center hc-items-center hc-pt-20">
83
+ <Loading />
84
+ </div>
85
+ ) : (
86
+ <Accordion className="hc-divide-y hc-divide-uiAccent/10 hc-z-[1000]" defaultValue={selectedListItem?.id}>
87
+ {(sortSetting ? dynamicSort(filteredListings, sortSetting.field, sortSetting.type) : filteredListings).slice(0, itemLimit).map(item => {
88
+ return (<MapAccordionItem
89
+ key={item.id}
90
+ showMap={showMap}
91
+ item={item}
92
+ itemRefs={itemRefs}
93
+ fieldsShown={fieldsShown}
94
+ itemExpandedContent={itemExpandedContent}
95
+ specialFeatures={specialFeatures}
96
+ mapItems={mapItems}
97
+ isActive={selectedListItem?.id == item.id}
98
+ hasListItemSelected={selectedListItem != null}
99
+ />
100
+ );
101
+ })}
102
+ </Accordion>
103
+ )}
104
+ <div ref={loader} style={{ height: "100px", textAlign: "center" }}>
105
+ {filteredListings.length >= itemLimit && <Loading />}
106
+ </div>
107
+ </div>
108
+ </div>
109
+ );
110
+ };
111
+
112
+ export default ItemsList;
@@ -1,22 +1,22 @@
1
- import React from 'react';
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- const CardItemExpand = ({
5
- className,
6
- content,
7
- ...props
8
- }) => {
9
- return (
10
- <div
11
- className={twMerge(
12
- 'hc-flex hc-flex-col lg:hc-flex-row hc-flex-wrap hc-items-stretch hc-gap-x-4 hc-w-full lg:hc-pt-2 hc-border-t hc-border-uiAccent/20',
13
- className ?? ''
14
- )}
15
- {...props}
16
- >
17
- {content}
18
- </div>
19
- );
20
- };
21
-
22
- export default CardItemExpand;
1
+ import React from 'react';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ const CardItemExpand = ({
5
+ className,
6
+ content,
7
+ ...props
8
+ }) => {
9
+ return (
10
+ <div
11
+ className={twMerge(
12
+ 'hc-flex hc-flex-col lg:hc-flex-row hc-flex-wrap hc-items-stretch hc-gap-x-4 hc-w-full lg:hc-pt-2 hc-border-t hc-border-uiAccent/20',
13
+ className ?? ''
14
+ )}
15
+ {...props}
16
+ >
17
+ {content}
18
+ </div>
19
+ );
20
+ };
21
+
22
+ export default CardItemExpand;
@@ -1,50 +1,50 @@
1
- import React from 'react';
2
-
3
- import Button from '~/components/modules/buttons/default';
4
-
5
- const RecruiterContactNav = ({
6
- children,
7
- className
8
- }) => {
9
- return (
10
- <nav
11
- className={`
12
- hc-inline-flex hc-items-center hc-justify-between hc-gap-2 hc-mt-2
13
- ${className ?? ''}
14
- `}
15
- >
16
- {children}
17
- </nav>
18
- );
19
- };
20
-
21
- export const NavButton = ({
22
- className,
23
- href,
24
- target = '_self',
25
- title,
26
- icon,
27
- ...props
28
- }) => {
29
- return (
30
- <Button.Anchor
31
- href={href}
32
- variant="icon"
33
- size="sq"
34
- target={target}
35
- title={title}
36
- className={className ?? ''}
37
- {...props}
38
- >
39
- <span className="hc-sr-only">{title}</span>
40
- <Button.Icon
41
- icon={icon}
42
- size="hc-size-8"
43
- />
44
- </Button.Anchor>
45
- );
46
- };
47
-
48
- RecruiterContactNav.Button = NavButton;
49
-
50
- export default RecruiterContactNav;
1
+ import React from 'react';
2
+
3
+ import Button from '~/components/modules/buttons/default';
4
+
5
+ const RecruiterContactNav = ({
6
+ children,
7
+ className
8
+ }) => {
9
+ return (
10
+ <nav
11
+ className={`
12
+ hc-inline-flex hc-items-center hc-justify-between hc-gap-2 hc-mt-2
13
+ ${className ?? ''}
14
+ `}
15
+ >
16
+ {children}
17
+ </nav>
18
+ );
19
+ };
20
+
21
+ export const NavButton = ({
22
+ className,
23
+ href,
24
+ target = '_self',
25
+ title,
26
+ icon,
27
+ ...props
28
+ }) => {
29
+ return (
30
+ <Button.Anchor
31
+ href={href}
32
+ variant="icon"
33
+ size="sq"
34
+ target={target}
35
+ title={title}
36
+ className={className ?? ''}
37
+ {...props}
38
+ >
39
+ <span className="hc-sr-only">{title}</span>
40
+ <Button.Icon
41
+ icon={icon}
42
+ size="hc-size-8"
43
+ />
44
+ </Button.Anchor>
45
+ );
46
+ };
47
+
48
+ RecruiterContactNav.Button = NavButton;
49
+
50
+ export default RecruiterContactNav;