@abcagency/hc-ui-components 1.1.1 → 1.2.1

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 (234) hide show
  1. package/.editorconfig +12 -0
  2. package/.eslintrc +144 -0
  3. package/.prettierignore +3 -0
  4. package/dist/_virtual/_rollupPluginBabelHelpers.js +516 -0
  5. package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  6. package/dist/apis/hcApi.js +189 -0
  7. package/dist/apis/hcApi.js.map +1 -0
  8. package/dist/clientToken.js +10 -0
  9. package/dist/clientToken.js.map +1 -0
  10. package/dist/components/HireControlMap.js +130 -0
  11. package/dist/components/HireControlMap.js.map +1 -0
  12. package/dist/components/modules/accordions/MapAccordionItem.js +76 -0
  13. package/dist/components/modules/accordions/MapAccordionItem.js.map +1 -0
  14. package/dist/components/modules/accordions/default.js +108 -0
  15. package/dist/components/modules/accordions/default.js.map +1 -0
  16. package/dist/components/modules/accordions/filterItem.js +50 -0
  17. package/dist/components/modules/accordions/filterItem.js.map +1 -0
  18. package/dist/components/modules/accordions/filters.js +46 -0
  19. package/dist/components/modules/accordions/filters.js.map +1 -0
  20. package/dist/components/modules/buttons/button-group-apply.js +84 -0
  21. package/dist/components/modules/buttons/button-group-apply.js.map +1 -0
  22. package/dist/components/modules/buttons/commute-pill.js +18 -0
  23. package/dist/components/modules/buttons/commute-pill.js.map +1 -0
  24. package/dist/components/modules/buttons/default.js +145 -0
  25. package/dist/components/modules/buttons/default.js.map +1 -0
  26. package/dist/components/modules/buttons/items-pill.js +23 -0
  27. package/dist/components/modules/buttons/items-pill.js.map +1 -0
  28. package/dist/components/modules/buttons/pill-wrapper.js +20 -0
  29. package/dist/components/modules/buttons/pill-wrapper.js.map +1 -0
  30. package/dist/components/modules/buttons/show-all-button.js +39 -0
  31. package/dist/components/modules/buttons/show-all-button.js.map +1 -0
  32. package/dist/components/modules/cards/default.js +102 -0
  33. package/dist/components/modules/cards/default.js.map +1 -0
  34. package/dist/components/modules/cards/filter.js +38 -0
  35. package/dist/components/modules/cards/filter.js.map +1 -0
  36. package/dist/components/modules/dialogs/apply-dialog.js +46 -0
  37. package/dist/components/modules/dialogs/apply-dialog.js.map +1 -0
  38. package/dist/components/modules/filter/commute.js +184 -0
  39. package/dist/components/modules/filter/commute.js.map +1 -0
  40. package/dist/components/modules/filter/index.js +79 -0
  41. package/dist/components/modules/filter/index.js.map +1 -0
  42. package/dist/components/modules/filter/item.js +71 -0
  43. package/dist/components/modules/filter/item.js.map +1 -0
  44. package/dist/components/modules/filter/location.js +68 -0
  45. package/dist/components/modules/filter/location.js.map +1 -0
  46. package/dist/components/modules/filter/points-of-interest.js +38 -0
  47. package/dist/components/modules/filter/points-of-interest.js.map +1 -0
  48. package/dist/components/modules/filter/radio-item.js +46 -0
  49. package/dist/components/modules/filter/radio-item.js.map +1 -0
  50. package/dist/components/modules/filter/search.js +83 -0
  51. package/dist/components/modules/filter/search.js.map +1 -0
  52. package/dist/components/modules/filter/sort.js +93 -0
  53. package/dist/components/modules/filter/sort.js.map +1 -0
  54. package/dist/components/modules/grid.js +39 -0
  55. package/dist/components/modules/grid.js.map +1 -0
  56. package/dist/components/modules/icon.js +23 -0
  57. package/dist/components/modules/icon.js.map +1 -0
  58. package/dist/components/modules/jobListing/listing-details.js +69 -0
  59. package/dist/components/modules/jobListing/listing-details.js.map +1 -0
  60. package/dist/components/modules/maps/info-window-card.js +14 -0
  61. package/dist/components/modules/maps/info-window-card.js.map +1 -0
  62. package/dist/components/modules/maps/info-window-content.js +39 -0
  63. package/dist/components/modules/maps/info-window-content.js.map +1 -0
  64. package/dist/components/modules/maps/list/field-mapper.js +88 -0
  65. package/dist/components/modules/maps/list/field-mapper.js.map +1 -0
  66. package/dist/components/modules/maps/list/header-item.js +59 -0
  67. package/dist/components/modules/maps/list/header-item.js.map +1 -0
  68. package/dist/components/modules/maps/list/header.js +37 -0
  69. package/dist/components/modules/maps/list/header.js.map +1 -0
  70. package/dist/components/modules/maps/list/index.js +93 -0
  71. package/dist/components/modules/maps/list/index.js.map +1 -0
  72. package/dist/components/modules/maps/list/item-expand-card/index.js +16 -0
  73. package/dist/components/modules/maps/list/item-expand-card/index.js.map +1 -0
  74. package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +38 -0
  75. package/dist/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js.map +1 -0
  76. package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js +40 -0
  77. package/dist/components/modules/maps/list/item-expand-card/recruiter-details.js.map +1 -0
  78. package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js +20 -0
  79. package/dist/components/modules/maps/list/item-expand-card/recruiter-headshot.js.map +1 -0
  80. package/dist/components/modules/maps/list/list-item/index.js +98 -0
  81. package/dist/components/modules/maps/list/list-item/index.js.map +1 -0
  82. package/dist/components/modules/maps/map-list.js +57 -0
  83. package/dist/components/modules/maps/map-list.js.map +1 -0
  84. package/dist/components/modules/maps/map-marker.js +85 -0
  85. package/dist/components/modules/maps/map-marker.js.map +1 -0
  86. package/dist/components/modules/maps/map.js +201 -0
  87. package/dist/components/modules/maps/map.js.map +1 -0
  88. package/dist/components/modules/maps/place-marker.js +37 -0
  89. package/dist/components/modules/maps/place-marker.js.map +1 -0
  90. package/dist/components/modules/maps/tabs.js +84 -0
  91. package/dist/components/modules/maps/tabs.js.map +1 -0
  92. package/dist/constants/placeTypes.js +11 -0
  93. package/dist/constants/placeTypes.js.map +1 -0
  94. package/dist/contexts/mapContext.js +133 -0
  95. package/dist/contexts/mapContext.js.map +1 -0
  96. package/dist/contexts/mapListContext.js +278 -0
  97. package/dist/contexts/mapListContext.js.map +1 -0
  98. package/dist/contexts/placesContext.js +152 -0
  99. package/dist/contexts/placesContext.js.map +1 -0
  100. package/dist/hooks/useList.js +119 -0
  101. package/dist/hooks/useList.js.map +1 -0
  102. package/dist/index.js +2 -4536
  103. package/dist/index.js.map +1 -0
  104. package/dist/services/_virtual/_rollupPluginBabelHelpers.js +372 -0
  105. package/dist/services/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  106. package/dist/services/apis/hcApi.js +189 -0
  107. package/dist/services/apis/hcApi.js.map +1 -0
  108. package/dist/services/clientToken.js +7 -0
  109. package/dist/services/clientToken.js.map +1 -0
  110. package/dist/services/configService.js +33 -0
  111. package/dist/services/configService.js.map +1 -0
  112. package/dist/services/googlePlacesNearbyService.js +61 -0
  113. package/dist/services/googlePlacesNearbyService.js.map +1 -0
  114. package/dist/services/listingAggregatorService.js +56 -0
  115. package/dist/services/listingAggregatorService.js.map +1 -0
  116. package/dist/services/listingEntityService.js +36 -0
  117. package/dist/services/listingEntityService.js.map +1 -0
  118. package/dist/services/listingService.js +60 -112
  119. package/dist/services/listingService.js.map +1 -0
  120. package/dist/services/recruiterService.js +36 -0
  121. package/dist/services/recruiterService.js.map +1 -0
  122. package/dist/services/styles/index.css +3 -0
  123. package/dist/styles/index.css +3 -0
  124. package/dist/util/filterUtil.js +213 -0
  125. package/dist/util/filterUtil.js.map +1 -0
  126. package/dist/util/loading.js +16 -0
  127. package/dist/util/loading.js.map +1 -0
  128. package/dist/util/localStorageUtil.js +32 -0
  129. package/dist/util/localStorageUtil.js.map +1 -0
  130. package/dist/util/mapIconUtil.js +73 -0
  131. package/dist/util/mapIconUtil.js.map +1 -0
  132. package/dist/util/mapUtil.js +76 -0
  133. package/dist/util/mapUtil.js.map +1 -0
  134. package/dist/util/sortUtil.js +33 -0
  135. package/dist/util/sortUtil.js.map +1 -0
  136. package/dist/util/stringUtils.js +9 -0
  137. package/dist/util/stringUtils.js.map +1 -0
  138. package/jsconfig.json +7 -0
  139. package/package.json +51 -38
  140. package/postcss.config.js +13 -15
  141. package/{src/tailwind/preset.default.js → preset.default.js} +15 -15
  142. package/rollup.config.mjs +87 -0
  143. package/src/apis/hcApi.js +93 -87
  144. package/src/clientToken.js +9 -9
  145. package/src/components/HireControlMap.js +121 -0
  146. package/src/components/modules/accordions/MapAccordionItem.js +72 -69
  147. package/src/components/modules/accordions/default.js +171 -173
  148. package/src/components/modules/accordions/filterItem.js +53 -53
  149. package/src/components/modules/accordions/filters.js +47 -44
  150. package/src/components/modules/buttons/button-group-apply.js +113 -85
  151. package/src/components/modules/buttons/commute-pill.js +22 -21
  152. package/src/components/modules/buttons/default.js +196 -196
  153. package/src/components/modules/buttons/items-pill.js +32 -31
  154. package/src/components/modules/buttons/pill-wrapper.js +27 -26
  155. package/src/components/modules/buttons/show-all-button.js +20 -20
  156. package/src/components/modules/cards/default.js +167 -168
  157. package/src/components/modules/cards/filter.js +56 -55
  158. package/src/components/modules/dialogs/apply-dialog.js +48 -47
  159. package/src/components/modules/filter/commute.js +148 -151
  160. package/src/components/modules/filter/index.js +87 -86
  161. package/src/components/modules/filter/item.js +76 -77
  162. package/src/components/modules/filter/location.js +71 -69
  163. package/src/components/modules/filter/points-of-interest.js +44 -43
  164. package/src/components/modules/filter/radio-item.js +53 -51
  165. package/src/components/modules/filter/search.js +92 -91
  166. package/src/components/modules/filter/sort.js +83 -83
  167. package/src/components/modules/grid.js +55 -56
  168. package/src/components/modules/icon.js +33 -33
  169. package/src/components/modules/jobListing/listing-details.js +94 -88
  170. package/src/components/modules/maps/info-window-card.js +17 -17
  171. package/src/components/modules/maps/info-window-content.js +58 -60
  172. package/src/components/modules/maps/list/field-mapper.js +112 -111
  173. package/src/components/modules/maps/list/header-item.js +91 -90
  174. package/src/components/modules/maps/list/header.js +47 -46
  175. package/src/components/modules/maps/list/index.js +107 -104
  176. package/src/components/modules/maps/list/item-expand-card/index.js +22 -21
  177. package/src/components/modules/maps/list/item-expand-card/recruiter-contact-nav.js +50 -48
  178. package/src/components/modules/maps/list/item-expand-card/recruiter-details.js +68 -67
  179. package/src/components/modules/maps/list/item-expand-card/recruiter-headshot.js +22 -22
  180. package/src/components/modules/maps/list/list-item/index.js +134 -133
  181. package/src/components/modules/maps/map-list.js +74 -73
  182. package/src/components/modules/maps/map-marker.js +86 -84
  183. package/src/components/modules/maps/map.js +229 -226
  184. package/src/components/modules/maps/place-marker.js +1 -1
  185. package/src/components/modules/maps/tabs.js +81 -79
  186. package/src/constants/placeTypes.js +8 -8
  187. package/src/contexts/mapContext.js +20 -19
  188. package/src/contexts/mapListContext.js +20 -15
  189. package/src/contexts/placesContext.js +4 -0
  190. package/src/hooks/useList.js +12 -10
  191. package/src/index.js +3 -103
  192. package/src/services/configService.js +16 -16
  193. package/src/services/googlePlacesNearbyService.js +33 -33
  194. package/src/services/listingAggregatorService.js +5 -4
  195. package/src/services/listingEntityService.js +2 -1
  196. package/src/services/listingService.js +27 -28
  197. package/src/services/recruiterService.js +17 -17
  198. package/src/styles/{globals.css → index.css} +23 -23
  199. package/src/util/arrayUtil.js +3 -3
  200. package/src/util/fieldMapper.js +22 -19
  201. package/src/util/filterUtil.js +19 -19
  202. package/src/util/loading.js +17 -17
  203. package/src/util/localStorageUtil.js +26 -26
  204. package/src/util/mapIconUtil.js +3 -3
  205. package/src/util/sortUtil.js +32 -32
  206. package/src/util/stringUtils.js +6 -6
  207. package/{src/tailwind/tailwind.config.js → tailwind.config.js} +126 -127
  208. package/dist/globals.css +0 -3
  209. package/dist/output.css +0 -784
  210. package/dist/services/globals.css +0 -3
  211. package/rollup.config.js +0 -68
  212. package/src/components/layout/footer.js +0 -34
  213. package/src/components/layout/header.js +0 -23
  214. package/src/components/layout/layout.js +0 -36
  215. package/src/components/modules/animations/slidein.js +0 -41
  216. package/src/components/modules/navigation/nav-link.js +0 -65
  217. package/src/components/modules/navigation/navbar.js +0 -106
  218. package/src/components/modules/navigation/skip-link.js +0 -21
  219. package/src/components/modules/navigation/social.js +0 -29
  220. package/src/components/modules/sections/default.js +0 -59
  221. package/src/components/modules/sections/sectionContext.js +0 -4
  222. package/src/hooks/useClickOutside.js +0 -16
  223. package/src/hooks/useEventListener.js +0 -25
  224. package/src/hooks/useEventTracker.js +0 -19
  225. package/src/hooks/useRefScrollProgress.js +0 -24
  226. package/src/hooks/useScript.js +0 -63
  227. package/src/hooks/useScrollDirection.js +0 -39
  228. package/src/hooks/useSectionTracker.js +0 -95
  229. package/src/hooks/useUserAgent.js +0 -43
  230. package/src/hooks/useWindowSize.js +0 -28
  231. package/src/index.css +0 -25
  232. package/src/styles/fonts.js +0 -0
  233. package/src/util/page-head.js +0 -62
  234. package/src/util/provider.js +0 -12
@@ -1,151 +1,148 @@
1
- import { Fragment, useRef, useState, useEffect } from "react";
2
- import { Combobox, Transition } from "@headlessui/react";
3
- import Button from "~/components/modules/buttons/default";
4
- import Icon from "~/components/modules/icon";
5
- import usePlacesAutocomplete, {
6
- getGeocode,
7
- getLatLng
8
- } from "use-places-autocomplete";
9
- import { useMap } from "~/contexts/mapContext";
10
- import { useMapList } from "~/contexts/mapListContext";
11
- import { getStorageItem } from "~/util/localStorageUtil";
12
- import React from 'react'
13
-
14
- const FilterCommute = ({ className }) => {
15
- const {
16
- ready,
17
- value,
18
- suggestions: { status, data },
19
- setValue,
20
- clearSuggestions
21
- } = usePlacesAutocomplete();
22
-
23
- const [selected, setSelected] = useState(getStorageItem('selectedCommute', ''));
24
- const inputRef = useRef(null);
25
- const { setCommuteLocation, commuteLocation } = useMapList();
26
- const [isCurrentLocation, setIsCurrentLocation] = useState(getStorageItem('isCurrentLocation', false));
27
-
28
- useEffect(() => {
29
- if (commuteLocation !== null && commuteLocation != '') return;
30
- setIsCurrentLocation(false);
31
- localStorage.removeItem('isCurrentLocation');
32
- localStorage.removeItem('selectedCommute');
33
- setSelected("");
34
- }, [commuteLocation]);
35
-
36
- const handleSelect = async (val, isCurrLocation = false) => {
37
- setValue(val, false);
38
- setSelected(val);
39
- localStorage.setItem('selectedCommute', val);
40
- clearSuggestions();
41
- if (isCurrLocation) return;
42
- try {
43
- const results = await getGeocode({ address: val });
44
- const { lat, lng } = await getLatLng(results[0]);
45
- setCommuteLocation({ lat, lng });
46
- } catch (error) { }
47
- };
48
-
49
- const fetchLocation = () => {
50
- if (!navigator.geolocation) {
51
- console.error("Geolocation is not supported by this browser.");
52
- return;
53
- }
54
- navigator.geolocation.getCurrentPosition(
55
- position => {
56
- setCommuteLocation({
57
- lat: position.coords.latitude,
58
- lng: position.coords.longitude
59
- });
60
- handleSelect("Current Location");
61
- },
62
- error => {
63
- console.error("Error fetching location", error);
64
- },
65
- );
66
- };
67
-
68
- return (
69
- <div className={`relative ${className ?? ""}`}>
70
- <label
71
- htmlFor="commute"
72
- className="hc-flex hc-items-center hc-gap-2 hc-mb-2 hc-text-xs hc-uppercase hc-font-bold hc-text-uiText"
73
- >
74
- <Icon
75
- icon="ri:pin-distance-fill"
76
- size="hc-size-5"
77
- className="hc-text-uiAccent/30"
78
- />
79
- <span>
80
- <span className="md:hc-hidden lg:hc-inline">Calculate your</span> commute
81
- </span>
82
- </label>
83
-
84
- <Combobox value={selected} onChange={handleSelect}>
85
- <div className="hc-relative hc-mt-1">
86
- <div className="hc-relative hc-flex hc-items-center hc-w-full hc-pr-2 hc-cursor-default hc-overflow-hidden hc-rounded hc-bg-white hc-text-left hc-border hc-border-uiAccent/20 focus-within:hc-ring-1 focus-within:hc-ring-uiAccent focus:hc-outline-none">
87
- <Combobox.Input
88
- className="hc-w-full hc-border-none hc-py-2 hc-pl-4 hc-pr-1 hc-text-sm hc-leading-5 hc-text-gray-900 focus:hc-ring-0 placeholder:hc-text-gray-400"
89
- onChange={e => {
90
- setValue(e.target.value);
91
- setSelected(e.target.value);
92
- }}
93
- value={selected}
94
- disabled={!ready}
95
- placeholder="Starting point"
96
- ref={inputRef}
97
- />
98
- <Button.Btn
99
- variant="icon"
100
- size="sqsm"
101
- onClick={() => {
102
- setIsCurrentLocation(!isCurrentLocation);
103
- localStorage.setItem('isCurrentLocation', !isCurrentLocation);
104
- if (isCurrentLocation || commuteLocation) {
105
- setCommuteLocation("");
106
- setSelected("");
107
- } else if (!commuteLocation) { fetchLocation(); }
108
- }}
109
-
110
- className=""
111
- >
112
- <span className="hc-sr-only">Use your location</span>
113
- {commuteLocation ? <Icon icon="mdi:times"></Icon> : <Button.Icon className={isCurrentLocation ? 'hc-text-blue-500' : 'hc-text-current'} icon="mdi:hc-my-location" />}
114
- </Button.Btn>
115
- </div>
116
- <Transition
117
- as={Fragment}
118
- leave="hc-transition hc-ease-in hc-duration-100"
119
- leaveFrom="hc-opacity-100"
120
- leaveTo="hc-opacity-0"
121
- afterLeave={clearSuggestions}
122
- >
123
- <Combobox.Options className="hc-absolute hc-z-20 hc-mt-1 hc-max-h-60 hc-w-full hc-overflow-auto hc-rounded hc-bg-white hc-py-1 hc-text-base hc-shadow hc-ring-1 hc-ring-uiAccent/10 focus:hc-outline-none sm:hc-text-sm">
124
- {status === "OK" &&
125
- data.map(data => (
126
- <Combobox.Option
127
- key={data.place_id}
128
- value={data.description}
129
- className={({ active }) =>
130
- `hc-relative hc-cursor-default hc-select-none hc-px-4 hc-py-2 ${active ? "hc-bg-primary hc-text-white" : "hc-text-uiText"
131
- }`
132
- }
133
- >
134
- {({ selected, active }) => (
135
- <span
136
- className={`hc-block hc-truncate ${selected ? "hc-font-bold" : "hc-font-medium"}`}
137
- >
138
- {data.description}
139
- </span>
140
- )}
141
- </Combobox.Option>
142
- ))}
143
- </Combobox.Options>
144
- </Transition>
145
- </div>
146
- </Combobox>
147
- </div>
148
- );
149
- };
150
-
151
- export default FilterCommute;
1
+ import React, { Fragment, useRef, useState, useEffect } from 'react';
2
+ import { Combobox, Transition } from '@headlessui/react';
3
+ import usePlacesAutocomplete, { getGeocode, getLatLng } from 'use-places-autocomplete';
4
+
5
+ import Button from '~/components/modules/buttons/default';
6
+ import Icon from "~/components/modules/icon";
7
+
8
+ import { useMapList } from '~/contexts/mapListContext';
9
+ import { getStorageItem } from '~/util/localStorageUtil';
10
+
11
+ const FilterCommute = ({ className }) => {
12
+ const {
13
+ ready,
14
+ value,
15
+ suggestions: { status, data },
16
+ setValue,
17
+ clearSuggestions
18
+ } = usePlacesAutocomplete();
19
+
20
+ const [selected, setSelected] = useState(getStorageItem('selectedCommute', ''));
21
+ const inputRef = useRef(null);
22
+ const { setCommuteLocation, commuteLocation } = useMapList();
23
+ const [isCurrentLocation, setIsCurrentLocation] = useState(getStorageItem('isCurrentLocation', false));
24
+
25
+ useEffect(() => {
26
+ if (commuteLocation !== null && commuteLocation != '') return;
27
+ setIsCurrentLocation(false);
28
+ localStorage.removeItem('isCurrentLocation');
29
+ localStorage.removeItem('selectedCommute');
30
+ setSelected("");
31
+ }, [commuteLocation]);
32
+
33
+ const handleSelect = async (val, isCurrLocation = false) => {
34
+ setValue(val, false);
35
+ setSelected(val);
36
+ localStorage.setItem('selectedCommute', val);
37
+ clearSuggestions();
38
+ if (isCurrLocation) return;
39
+ try {
40
+ const results = await getGeocode({ address: val });
41
+ const { lat, lng } = await getLatLng(results[0]);
42
+ setCommuteLocation({ lat, lng });
43
+ } catch (error) { }
44
+ };
45
+
46
+ const fetchLocation = () => {
47
+ if (!navigator.geolocation) {
48
+ console.error("Geolocation is not supported by this browser.");
49
+ return;
50
+ }
51
+ navigator.geolocation.getCurrentPosition(
52
+ position => {
53
+ setCommuteLocation({
54
+ lat: position.coords.latitude,
55
+ lng: position.coords.longitude
56
+ });
57
+ handleSelect("Current Location");
58
+ },
59
+ error => {
60
+ console.error("Error fetching location", error);
61
+ },
62
+ );
63
+ };
64
+
65
+ return (
66
+ <div className={`relative ${className ?? ""}`}>
67
+ <label
68
+ htmlFor="commute"
69
+ className="hc-flex hc-items-center hc-gap-2 hc-mb-2 hc-text-xs hc-uppercase hc-font-bold hc-text-uiText"
70
+ >
71
+ <Icon
72
+ icon="ri:pin-distance-fill"
73
+ size="hc-size-5"
74
+ className="hc-text-uiAccent/30"
75
+ />
76
+ <span>
77
+ <span className="md:hc-hidden lg:hc-inline">Calculate your</span> commute
78
+ </span>
79
+ </label>
80
+
81
+ <Combobox value={selected} onChange={handleSelect}>
82
+ <div className="hc-relative hc-mt-1">
83
+ <div className="hc-relative hc-flex hc-items-center hc-w-full hc-pr-2 hc-cursor-default hc-overflow-hidden hc-rounded hc-bg-white hc-text-left hc-border hc-border-uiAccent/20 focus-within:hc-ring-1 focus-within:hc-ring-uiAccent focus:hc-outline-none">
84
+ <Combobox.Input
85
+ className="hc-w-full hc-border-none hc-py-2 hc-pl-4 hc-pr-1 hc-text-sm hc-leading-5 hc-text-gray-900 focus:hc-ring-0 placeholder:hc-text-gray-400"
86
+ onChange={e => {
87
+ setValue(e.target.value);
88
+ setSelected(e.target.value);
89
+ }}
90
+ value={selected}
91
+ disabled={!ready}
92
+ placeholder="Starting point"
93
+ ref={inputRef}
94
+ />
95
+ <Button.Btn
96
+ variant="icon"
97
+ size="sqsm"
98
+ onClick={() => {
99
+ setIsCurrentLocation(!isCurrentLocation);
100
+ localStorage.setItem('isCurrentLocation', !isCurrentLocation);
101
+ if (isCurrentLocation || commuteLocation) {
102
+ setCommuteLocation("");
103
+ setSelected("");
104
+ } else if (!commuteLocation) { fetchLocation(); }
105
+ }}
106
+
107
+ className=""
108
+ >
109
+ <span className="hc-sr-only">Use your location</span>
110
+ {commuteLocation ? <Icon icon="mdi:times"></Icon> : <Button.Icon className={isCurrentLocation ? 'hc-text-blue-500' : 'hc-text-current'} icon="mdi:hc-my-location" />}
111
+ </Button.Btn>
112
+ </div>
113
+ <Transition
114
+ as={Fragment}
115
+ leave="hc-transition hc-ease-in hc-duration-100"
116
+ leaveFrom="hc-opacity-100"
117
+ leaveTo="hc-opacity-0"
118
+ afterLeave={clearSuggestions}
119
+ >
120
+ <Combobox.Options className="hc-absolute hc-z-20 hc-mt-1 hc-max-h-60 hc-w-full hc-overflow-auto hc-rounded hc-bg-white hc-py-1 hc-text-base hc-shadow hc-ring-1 hc-ring-uiAccent/10 focus:hc-outline-none sm:hc-text-sm">
121
+ {status === "OK" &&
122
+ data.map(data => (
123
+ <Combobox.Option
124
+ key={data.place_id}
125
+ value={data.description}
126
+ className={({ active }) =>
127
+ `hc-relative hc-cursor-default hc-select-none hc-px-4 hc-py-2 ${active ? "hc-bg-primary hc-text-white" : "hc-text-uiText"
128
+ }`
129
+ }
130
+ >
131
+ {({ selected, active }) => (
132
+ <span
133
+ className={`hc-block hc-truncate ${selected ? "hc-font-bold" : "hc-font-medium"}`}
134
+ >
135
+ {data.description}
136
+ </span>
137
+ )}
138
+ </Combobox.Option>
139
+ ))}
140
+ </Combobox.Options>
141
+ </Transition>
142
+ </div>
143
+ </Combobox>
144
+ </div>
145
+ );
146
+ };
147
+
148
+ export default FilterCommute;
@@ -1,86 +1,87 @@
1
- import { useState } from "react";
2
- import FilterSearch from "~/components/modules/filter/search";
3
- import FiltersAccordion from "~/components/modules/accordions/filters";
4
- import FilterLocations from "~/components/modules/filter/location";
5
- import Button from "~/components/modules/buttons/default";
6
- import { useMap } from "~/contexts/mapContext";
7
- import { useMapList } from "~/contexts/mapListContext";
8
- import React from 'react'
9
-
10
- const Filter = ({
11
- className,
12
- showMap
13
- }) => {
14
- const [hasActiveFilters, setHasActiveFilters] = useState(false);
15
- const [defaultValue, setDefaultValue] = useState(null);
16
- const { setSelectedListItem, setLocation, filterReset } = useMap();
17
- const {
18
- filteredListings,
19
- selectedFilters,
20
- setSelectedFilters,
21
- setMobileTab,
22
- handleSettingFavorites,
23
- setQuery,
24
- siteConfig
25
- } = useMapList();
26
-
27
- return (
28
- <div
29
- className={`
30
- hc-relative hc-max-h-[95vh] md:hc-max-h-screen hc-overflow-y-auto hc-overflow-x-auto
31
- ${className ?? ""}
32
- `}
33
- >
34
- <div className="hc-px-4 md:hc-pt-4 hc-space-y-4">
35
- <FiltersAccordion
36
- setHasActiveFilters={setHasActiveFilters}
37
- defaultValue={defaultValue}
38
- setDefaultValue={value => { setDefaultValue(value == defaultValue ? "" : value); }}
39
- setLocation={setLocation}
40
- setSelectedListItem={setSelectedListItem}
41
- />
42
- <FilterSearch />
43
- {siteConfig.hideLocations !== true &&
44
- <FilterLocations
45
- setHasActiveFilters={setHasActiveFilters}
46
- defaultValue={defaultValue}
47
- showMap={showMap}
48
- setDefaultValue={value => { setDefaultValue(value == defaultValue ? "" : value); }}
49
- setLocation={setLocation}
50
- setSelectedListItem={setSelectedListItem}
51
- />
52
- }
53
- </div>
54
- <div className="hc-sticky hc-bottom-0 hc-inset-x-0 hc-flex hc-items-center hc-justify-between hc-gap-2 hc-py-2 hc-px-4 hc-mt-2 hc-bg-white md:hc-bg-gray-100">
55
- <Button.Btn
56
- onClick={() => { filterReset(); setSelectedFilters({}); setQuery(null); handleSettingFavorites(null); }}
57
- variant="outline"
58
- size="sm"
59
- >
60
- Reset
61
- </Button.Btn>
62
- {selectedFilters && Object.keys(selectedFilters).length > 0 &&
63
- <Button.Btn
64
- onClick={() => setMobileTab("listTab")}
65
- variant="primary"
66
- size="sm"
67
- className={`
68
- md:hidden
69
- ${hasActiveFilters ? "hc-opacity-0 hc-pointer-events-none" : "hc-opacity-100"}
70
- `}
71
- >
72
- <Button.Body>
73
- <Button.Icon
74
- icon="fluent:search-12-filled"
75
- size="hc-size-3.5"
76
- />
77
- Show {filteredListings.length} Jobs
78
- </Button.Body>
79
- </Button.Btn>
80
- }
81
- </div>
82
- </div>
83
- );
84
- };
85
-
86
- export default Filter;
1
+ import React, { useState } from 'react';
2
+
3
+ import FilterSearch from '~/components/modules/filter/search';
4
+ import FiltersAccordion from '~/components/modules/accordions/filters';
5
+ import FilterLocations from '~/components/modules/filter/location';
6
+ import Button from '~/components/modules/buttons/default';
7
+
8
+ import { useMap } from '~/contexts/mapContext';
9
+ import { useMapList } from '~/contexts/mapListContext';
10
+
11
+ const Filter = ({
12
+ className,
13
+ showMap
14
+ }) => {
15
+ const [hasActiveFilters, setHasActiveFilters] = useState(false);
16
+ const [defaultValue, setDefaultValue] = useState(null);
17
+ const { setSelectedListItem, setLocation, filterReset } = useMap();
18
+ const {
19
+ filteredListings,
20
+ selectedFilters,
21
+ setSelectedFilters,
22
+ setMobileTab,
23
+ handleSettingFavorites,
24
+ setQuery,
25
+ siteConfig
26
+ } = useMapList();
27
+
28
+ return (
29
+ <div
30
+ className={`
31
+ hc-relative hc-max-h-[95vh] md:hc-max-h-screen hc-overflow-y-auto hc-overflow-x-auto
32
+ ${className ?? ""}
33
+ `}
34
+ >
35
+ <div className="hc-px-4 md:hc-pt-4 hc-space-y-4">
36
+ <FiltersAccordion
37
+ setHasActiveFilters={setHasActiveFilters}
38
+ defaultValue={defaultValue}
39
+ setDefaultValue={value => { setDefaultValue(value == defaultValue ? "" : value); }}
40
+ setLocation={setLocation}
41
+ setSelectedListItem={setSelectedListItem}
42
+ />
43
+ <FilterSearch />
44
+ {siteConfig.hideLocations !== true &&
45
+ <FilterLocations
46
+ setHasActiveFilters={setHasActiveFilters}
47
+ defaultValue={defaultValue}
48
+ showMap={showMap}
49
+ setDefaultValue={value => { setDefaultValue(value == defaultValue ? "" : value); }}
50
+ setLocation={setLocation}
51
+ setSelectedListItem={setSelectedListItem}
52
+ />
53
+ }
54
+ </div>
55
+ <div className="hc-sticky hc-bottom-0 hc-inset-x-0 hc-flex hc-items-center hc-justify-between hc-gap-2 hc-py-2 hc-px-4 hc-mt-2 hc-bg-white md:hc-bg-gray-100">
56
+ <Button.Btn
57
+ onClick={() => { filterReset(); setSelectedFilters({}); setQuery(null); handleSettingFavorites(null); }}
58
+ variant="outline"
59
+ size="sm"
60
+ >
61
+ Reset
62
+ </Button.Btn>
63
+ {selectedFilters && Object.keys(selectedFilters).length > 0 &&
64
+ <Button.Btn
65
+ onClick={() => setMobileTab("listTab")}
66
+ variant="primary"
67
+ size="sm"
68
+ className={`
69
+ md:hc-hidden
70
+ ${hasActiveFilters ? "hc-opacity-0 hc-pointer-events-none" : "hc-opacity-100"}
71
+ `}
72
+ >
73
+ <Button.Body>
74
+ <Button.Icon
75
+ icon="fluent:search-12-filled"
76
+ size="hc-size-3.5"
77
+ />
78
+ Show {filteredListings.length} Jobs
79
+ </Button.Body>
80
+ </Button.Btn>
81
+ }
82
+ </div>
83
+ </div>
84
+ );
85
+ };
86
+
87
+ export default Filter;
@@ -1,77 +1,76 @@
1
- import { useState, useEffect, useRef } from "react";
2
- import React from 'react'
3
-
4
- const FilterItem = ({
5
- className,
6
- item,
7
- type = 'checkbox',
8
- itemKey = null,
9
- hasCount = true,
10
- field,
11
- selectedFilters,
12
- setSelectedFilters,
13
- ...rest
14
- }) => {
15
- const itemName = item.name ? item.name : item;
16
- itemKey = itemKey === null ? itemName : itemKey;
17
- var isActive =
18
- selectedFilters != undefined && !!selectedFilters[field]?.[itemKey];
19
-
20
- const changeHandler = () => {
21
- setSelectedFilters(prevFilters => {
22
- const updatedFilters = { ...prevFilters };
23
- if (!isActive) {
24
- if (!updatedFilters[field]) {
25
- updatedFilters[field] = {};
26
- }
27
- updatedFilters[field][itemKey] = true;
28
- return updatedFilters;
29
- }
30
- delete updatedFilters[field][itemKey];
31
- if (Object.keys(updatedFilters[field]).length === 0) {
32
- delete updatedFilters[field];
33
- }
34
- return updatedFilters;
35
- });
36
- };
37
- const [activeItem, setActiveItem] = useState(isActive);
38
-
39
- useEffect(() => {
40
- if (selectedFilters && selectedFilters[field] && Object.keys(selectedFilters[field])?.length > 0) return;
41
- else if (activeItem === true) {
42
- setActiveItem(false);
43
- }
44
- }, [selectedFilters]);
45
-
46
- return (
47
- <label
48
- className={`
49
- hc-flex hc-items-start hc-gap-2 hc-px-2 hc-py-1.5 hc-rounded-sm hc-text-sm hc-cursor-pointer hc-transition hc-hover:bg-uiAccent/5
50
- ${className ?? ""}
51
- `}
52
- {...rest}
53
- >
54
- <input
55
- id={itemKey}
56
- name={field}
57
- disabled={item.count == 0}
58
- value={itemName}
59
- type={type}
60
- className={`hc-size-4 hc-mt-px hc-text-primary hc-border-uiAccent/30 hc-transition-colors hc-rounded-sm`}
61
- checked={activeItem}
62
- onChange={() => {
63
- setActiveItem(!activeItem);
64
- changeHandler();
65
- }}
66
- />
67
- <span className="font-medium">{itemName}</span>
68
- {hasCount && (
69
- <span className="hc-inline-block hc-mt-1 hc-ml-auto hc-text-xs hc-leading-none hc-text-primary">
70
- ({item.count})
71
- </span>
72
- )}
73
- </label>
74
- );
75
- };
76
-
77
- export default FilterItem;
1
+ import React, { useState, useEffect } from 'react';
2
+
3
+ const FilterItem = ({
4
+ className,
5
+ item,
6
+ type = 'checkbox',
7
+ itemKey = null,
8
+ hasCount = true,
9
+ field,
10
+ selectedFilters,
11
+ setSelectedFilters,
12
+ ...rest
13
+ }) => {
14
+ const itemName = item.name ? item.name : item;
15
+ itemKey = itemKey === null ? itemName : itemKey;
16
+ var isActive =
17
+ selectedFilters != undefined && !!selectedFilters[field]?.[itemKey];
18
+
19
+ const changeHandler = () => {
20
+ setSelectedFilters(prevFilters => {
21
+ const updatedFilters = { ...prevFilters };
22
+ if (!isActive) {
23
+ if (!updatedFilters[field]) {
24
+ updatedFilters[field] = {};
25
+ }
26
+ updatedFilters[field][itemKey] = true;
27
+ return updatedFilters;
28
+ }
29
+ delete updatedFilters[field][itemKey];
30
+ if (Object.keys(updatedFilters[field]).length === 0) {
31
+ delete updatedFilters[field];
32
+ }
33
+ return updatedFilters;
34
+ });
35
+ };
36
+ const [activeItem, setActiveItem] = useState(isActive);
37
+
38
+ useEffect(() => {
39
+ if (selectedFilters && selectedFilters[field] && Object.keys(selectedFilters[field])?.length > 0) return;
40
+ else if (activeItem === true) {
41
+ setActiveItem(false);
42
+ }
43
+ }, [selectedFilters]);
44
+
45
+ return (
46
+ <label
47
+ className={`
48
+ hc-flex hc-items-start hc-gap-2 hc-px-2 hc-py-1.5 hc-rounded-sm hc-text-sm hc-cursor-pointer hc-transition hover:hc-bg-uiAccent/5
49
+ ${className ?? ""}
50
+ `}
51
+ {...rest}
52
+ >
53
+ <input
54
+ id={itemKey}
55
+ name={field}
56
+ disabled={item.count == 0}
57
+ value={itemName}
58
+ type={type}
59
+ className={`hc-size-4 hc-mt-px hc-text-primary hc-border-uiAccent/30 hc-transition-colors hc-rounded-sm`}
60
+ checked={activeItem}
61
+ onChange={() => {
62
+ setActiveItem(!activeItem);
63
+ changeHandler();
64
+ }}
65
+ />
66
+ <span className="font-medium">{itemName}</span>
67
+ {hasCount && (
68
+ <span className="hc-inline-block hc-mt-1 hc-ml-auto hc-text-xs hc-leading-none hc-text-primary">
69
+ ({item.count})
70
+ </span>
71
+ )}
72
+ </label>
73
+ );
74
+ };
75
+
76
+ export default FilterItem;