@abcagency/hc-ui-components 1.3.23 → 1.3.24

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 (102) hide show
  1. package/package.json +4 -5
  2. package/src/.editorconfig +12 -0
  3. package/src/apis/hcApi.ts +109 -0
  4. package/src/bundleIndex.js +14 -0
  5. package/src/clientToken.js +9 -0
  6. package/src/components/HireControlMap.js +135 -0
  7. package/src/components/containers/accordions/filter-container.js +48 -0
  8. package/src/components/containers/accordions/filter-item-container.js +66 -0
  9. package/src/components/containers/accordions/map-accordion-item-container.js +70 -0
  10. package/src/components/containers/filter/commute-container.js +89 -0
  11. package/src/components/containers/filter/filter-container.js +76 -0
  12. package/src/components/containers/filter/filter-item-container.js +71 -0
  13. package/src/components/containers/filter/location-container.js +45 -0
  14. package/src/components/containers/filter/points-of-interest-container.js +33 -0
  15. package/src/components/containers/filter/points-of-interest-radio-item-container.js +35 -0
  16. package/src/components/containers/filter/search-container.js +50 -0
  17. package/src/components/containers/jobListing/listing-details-container.js +40 -0
  18. package/src/components/containers/list/item-list-container.tsx +81 -0
  19. package/src/components/containers/list/list-item/list-item-container.js +43 -0
  20. package/src/components/containers/maps/info-window-content-container.js +51 -0
  21. package/src/components/containers/maps/map-container.js +204 -0
  22. package/src/components/containers/maps/map-list-container.js +48 -0
  23. package/src/components/containers/maps/map-marker-container.js +78 -0
  24. package/src/components/modules/accordions/MapAccordionItem.js +30 -0
  25. package/src/components/modules/accordions/default.js +171 -0
  26. package/src/components/modules/accordions/filterItem.js +27 -0
  27. package/src/components/modules/accordions/filters.js +32 -0
  28. package/src/components/modules/buttons/button-group-apply.js +123 -0
  29. package/src/components/modules/buttons/commute-pill.js +22 -0
  30. package/src/components/modules/buttons/default.js +194 -0
  31. package/src/components/modules/buttons/items-pill.js +35 -0
  32. package/src/components/modules/buttons/pill-wrapper.js +27 -0
  33. package/src/components/modules/buttons/show-all-button.js +20 -0
  34. package/src/components/modules/cards/default.js +167 -0
  35. package/src/components/modules/cards/filter.js +56 -0
  36. package/src/components/modules/dialogs/apply-dialog.js +48 -0
  37. package/src/components/modules/filter/commute.js +108 -0
  38. package/src/components/modules/filter/index.js +55 -0
  39. package/src/components/modules/filter/item.js +48 -0
  40. package/src/components/modules/filter/location.js +48 -0
  41. package/src/components/modules/filter/radio-item.js +42 -0
  42. package/src/components/modules/filter/search.js +65 -0
  43. package/src/components/modules/filter/sort.js +83 -0
  44. package/src/components/modules/grid.js +54 -0
  45. package/src/components/modules/icon.js +33 -0
  46. package/src/components/modules/jobListing/listing-details.js +109 -0
  47. package/src/components/modules/list/field-mapper.js +114 -0
  48. package/src/components/modules/list/header-item.js +91 -0
  49. package/src/components/modules/list/header.js +49 -0
  50. package/src/components/modules/list/item-expand-card/index.js +22 -0
  51. package/src/components/modules/list/item-expand-card/recruiter-contact-nav.js +50 -0
  52. package/src/components/modules/list/item-expand-card/recruiter-details.js +68 -0
  53. package/src/components/modules/list/item-expand-card/recruiter-headshot.js +22 -0
  54. package/src/components/modules/list/item-list.tsx +84 -0
  55. package/src/components/modules/list/list-item/list-item.js +130 -0
  56. package/src/components/modules/maps/info-window-card.js +17 -0
  57. package/src/components/modules/maps/info-window-content.js +35 -0
  58. package/src/components/modules/maps/map-list.js +28 -0
  59. package/src/components/modules/maps/map-marker.js +29 -0
  60. package/src/components/modules/maps/map.js +76 -0
  61. package/src/components/modules/maps/place-marker.js +41 -0
  62. package/src/components/modules/maps/tabs.js +81 -0
  63. package/src/constants/eventTypes.js +13 -0
  64. package/src/constants/placeTypes.js +8 -0
  65. package/src/contexts/mapContext.tsx +129 -0
  66. package/src/contexts/mapListContext.tsx +311 -0
  67. package/src/contexts/placesContext.js +102 -0
  68. package/src/contexts/trackEventContext.js +14 -0
  69. package/src/enums/SectionType.ts +9 -0
  70. package/src/hooks/useList.js +89 -0
  71. package/src/index.js +3 -0
  72. package/src/services/configService.ts +16 -0
  73. package/src/services/googlePlacesNearbyService.ts +42 -0
  74. package/src/services/listingAggregatorService.ts +76 -0
  75. package/src/services/listingEntityService.ts +16 -0
  76. package/src/services/listingService.ts +40 -0
  77. package/src/services/recruiterService.ts +18 -0
  78. package/src/styles/bundle.css +268 -0
  79. package/src/styles/index.css +24 -0
  80. package/src/types/Address.ts +7 -0
  81. package/src/types/ContentSection.ts +9 -0
  82. package/src/types/GetListingParams.ts +8 -0
  83. package/src/types/LatLng.ts +4 -0
  84. package/src/types/ListingEntity.ts +11 -0
  85. package/src/types/ListingFields.ts +25 -0
  86. package/src/types/Listings.ts +32 -0
  87. package/src/types/Recruiter.ts +9 -0
  88. package/src/types/SimilarListing.ts +24 -0
  89. package/src/types/config/Colors.ts +8 -0
  90. package/src/types/config/MapConfig.ts +31 -0
  91. package/src/types/config/PointsOfInterestConfig.ts +13 -0
  92. package/src/types/config/SearchConfig.ts +4 -0
  93. package/src/util/arrayUtil.js +3 -0
  94. package/src/util/fieldMapper.js +22 -0
  95. package/src/util/filterUtil.js +239 -0
  96. package/src/util/loading.js +17 -0
  97. package/src/util/localStorageUtil.ts +34 -0
  98. package/src/util/mapIconUtil.js +180 -0
  99. package/src/util/mapUtil.js +91 -0
  100. package/src/util/sortUtil.js +33 -0
  101. package/src/util/stringUtils.js +6 -0
  102. package/src/util/urlFilterUtil.js +85 -0
@@ -0,0 +1,194 @@
1
+ import React from 'react';
2
+ import { forwardRef } from 'react';
3
+ import { Link } from 'react-router-dom';
4
+ import { twMerge } from 'tailwind-merge';
5
+
6
+ import Icon from '~/components/modules/icon';
7
+
8
+ const linkDefaultClasses = "hc-normal-case hc-text-inherit !hc-font-[inherit] hc-[font-weight:inherit] !hc-p-0 hc-rounded-none";
9
+ const underlineClasses = "!underline decoration-1 underline-offset-2 hover:!no-underline focus:!no-underline";
10
+
11
+ const ButtonVariant = {
12
+ none: '',
13
+ primary: 'hc-bg-primary hc-border hc-border-primary hc-text-white hover:hc-bg-opacity-70 focus:hc-bg-opacity-70',
14
+ secondary: 'hc-bg-secondary hc-border hc-border-secondary hc-text-white hover:hc-bg-opacity-70 focus:hc-bg-opacity-70',
15
+ outline: 'hc-bg-transparent hc-border hc-border-primary hc-text-primary hover:hc-bg-primaryDark hover:hc-border-primaryDark hover:hc-text-white focus:hc-bg-primaryDark focus:hc-border-primaryDark focus:hc-text-white',
16
+ link: `${linkDefaultClasses} hc-text-primary hover:hc-text-uiText focus:hc-text-uiText`,
17
+ icon: 'hc-opacity-100 hover:hc-opacity-70 focus:hc-opacity-70'
18
+ };
19
+
20
+ const ButtonSize = {
21
+ none: '',
22
+ default: 'hc-py-2 hc-px-6 hc-text-base',
23
+ sq: 'hc-p-2.5',
24
+ sqsm: 'hc-p-1',
25
+ xs: 'hc-py-1.5 hc-px-3 hc-text-xs',
26
+ sm: 'hc-py-1.5 hc-px-4 hc-text-sm',
27
+ lg: 'hc-py-4 hc-px-10 hc-text-lg'
28
+ };
29
+
30
+ const ButtonDefaults = {
31
+ style: 'hc-group hc-font-medium hc-uppercase hc-text-center hc-rounded hc-transition',
32
+ size: ButtonSize.default,
33
+ variant: ButtonVariant.primary,
34
+ block: 'hc-block hc-w-full'
35
+ };
36
+
37
+ const linkVariants = variant => variant === 'link';
38
+
39
+ const buttonClasses = (variant, size, isBlock, hasUnderline, className) => twMerge(
40
+ isBlock ? ButtonDefaults.block : linkVariants(variant) ? 'hc-inline' : 'hc-inline-block',
41
+ ButtonDefaults.style,
42
+ variant ? ButtonVariant[variant] : ButtonDefaults.variant,
43
+ size ? ButtonSize[size] : ButtonDefaults.size,
44
+ hasUnderline ? underlineClasses : '',
45
+ className ?? ''
46
+ );
47
+
48
+ const Button = ({
49
+ children
50
+ }) => {
51
+ return (
52
+ { children }
53
+ );
54
+ };
55
+
56
+ export const Anchor = ({
57
+ children,
58
+ href,
59
+ className,
60
+ size,
61
+ variant,
62
+ isBlock,
63
+ hasUnderline,
64
+ target = '_blank',
65
+ ...rest
66
+ }) => {
67
+ return (
68
+ <a
69
+ href={href}
70
+ target={target}
71
+ className={buttonClasses(variant, size, isBlock, hasUnderline, className)}
72
+ onClick={href === '#' ? e => {
73
+ e.preventDefault();
74
+ } : null}
75
+ {...rest}
76
+ >
77
+ {children}
78
+ </a>
79
+ );
80
+ };
81
+
82
+ export const AnchorLink = ({
83
+ children,
84
+ Link,
85
+ href,
86
+ className,
87
+ size,
88
+ variant,
89
+ isBlock,
90
+ hasUnderline,
91
+ ...rest
92
+ }) => {
93
+ return (
94
+ <Link
95
+ href={href}
96
+ className={`
97
+ ${buttonClasses(variant, size, isBlock, hasUnderline, className)}
98
+ `}
99
+ {...rest}
100
+ >
101
+ {children}
102
+ </Link>
103
+ );
104
+ };
105
+
106
+ export const ScrollAnchor = forwardRef((props, ref) => {
107
+ const {
108
+ children,
109
+ href,
110
+ className,
111
+ size,
112
+ variant,
113
+ isBlock,
114
+ hasUnderline,
115
+ ...rest
116
+ } = props;
117
+
118
+ return (
119
+ <Link
120
+ ref={ref}
121
+ href={`#${href}`}
122
+ scroll={false}
123
+ className={buttonClasses(variant, size, isBlock, hasUnderline, className)}
124
+ {...rest}
125
+ >
126
+ {children}
127
+ </Link>
128
+ );
129
+ });
130
+
131
+ export const Btn = forwardRef((props, ref) => {
132
+ const {
133
+ children,
134
+ type = 'button',
135
+ className,
136
+ size,
137
+ variant,
138
+ isBlock,
139
+ hasUnderline,
140
+ ...rest
141
+ } = props;
142
+ return (
143
+ <button
144
+ ref={ref}
145
+ type={type}
146
+ className={buttonClasses(variant, size, isBlock, hasUnderline, className)}
147
+ {...rest}
148
+ >
149
+ {children}
150
+ </button>
151
+ );
152
+ });
153
+
154
+ export const ButtonBody = ({
155
+ children,
156
+ className
157
+ }) => {
158
+ return (
159
+ <span
160
+ className={twMerge(
161
+ 'hc-inline-flex hc-w-full hc-items-center hc-justify-between hc-gap-1.5',
162
+ className ?? ''
163
+ )}
164
+ >
165
+ {children}
166
+ </span>
167
+ );
168
+ };
169
+
170
+ export const ButtonIcon = ({
171
+ icon,
172
+ size = 'hc-size-4',
173
+ className
174
+ }) => {
175
+ return (
176
+ <Icon
177
+
178
+ icon={icon}
179
+ size={size}
180
+ className={className ?? ''}
181
+ />
182
+ );
183
+ };
184
+
185
+ Button.Anchor = Anchor;
186
+ Button.Link = AnchorLink;
187
+ Button.Scroll = ScrollAnchor;
188
+ Button.Btn = Btn;
189
+ Button.Body = ButtonBody;
190
+ Button.Icon = ButtonIcon;
191
+
192
+ Btn.displayName = 'Button:Button';
193
+ ScrollAnchor.displayName = 'Button:ScrollAnchor';
194
+ export default Button;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { forwardRef } from 'react';
3
+
4
+ import Button from '~/components/modules/buttons/default';
5
+
6
+ export const ButtonItemsPill = forwardRef((
7
+ {
8
+ className,
9
+ activeItemsCount,
10
+ ...props
11
+ },
12
+ ref
13
+ ) => {
14
+ return (
15
+ <Button.Btn
16
+ ref={ref}
17
+ size="none"
18
+ variant="none"
19
+ className={`
20
+ hc-relative hc-z-[2] hc-group hc-inline-flex hc-items-center hc-gap-px hc-ml-auto hc-mr-1.5 hc-pl-1.5 hc-pr-1 hc-py-0.5 hc-rounded hc-bg-primary/10 hc-text-xs hc-font-bold hc-text-primary hc-ring-1 hc-ring-inset hc-ring-primary/20
21
+ ${className ?? ''}
22
+ `}
23
+ {...props}
24
+ >
25
+ {activeItemsCount > 9 ? '9+' : activeItemsCount}
26
+ <Button.Icon
27
+ icon="uil:times"
28
+ size="hc-size-3.5"
29
+ />
30
+ </Button.Btn>
31
+ );
32
+ });
33
+
34
+ ButtonItemsPill.displayName = 'ButtonItemsPill';
35
+ export default ButtonItemsPill;
@@ -0,0 +1,27 @@
1
+ import React, { forwardRef } from 'react';
2
+
3
+ import Button from '~/components/modules/buttons/default';
4
+
5
+ export const PillWrapper = forwardRef((
6
+ {
7
+ className,
8
+ children,
9
+ ...props
10
+ },
11
+ ref
12
+ ) => {
13
+ return (
14
+ <Button.Btn
15
+ ref={ref}
16
+ size="none"
17
+ variant="none"
18
+ className={`hc-relative hc-group hc-inline-flex hc-items-center hc-gap-px hc-ml-auto hc-mr-1.5 hc-pl-1.5 hc-pr-1 hc-py-0.5 hc-rounded hc-bg-primary/10 hc-text-xs hc-font-bold hc-text-primary hc-ring-1 hc-ring-inset hc-ring-primary/20 ${className}`}
19
+ {...props}
20
+ >
21
+ {children}
22
+ </Button.Btn>
23
+ );
24
+ });
25
+
26
+ PillWrapper.displayName = 'PillWrapper';
27
+ export default PillWrapper;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ const ShowAllButton = ({ mapInteracted, markerConfigs, setMapInteracted, fitBounds, mapRef, pinIconUrl, setSelectedFilters, setQuery, listingCount }) => {
4
+ if (!mapInteracted || !markerConfigs) {
5
+ return null;
6
+ }
7
+
8
+ return (
9
+ <button
10
+ style={{ fontFamily: 'Roboto, Arial, sans-serif', fontSize: '14px', fontWeight: '500' }}
11
+ className="hc-absolute hc-bottom-10 hc-left-2.5 hc-z-10 hc-flex hc-items-center hc-justify-center hc-pl-2 hc-pb-1 hc-pt-1.5 hc-pr-3 hc-bg-white hc-text-black hc-border-none hc-rounded-full hc-shadow hc-cursor-pointer hc-text-sm hc-font-medium"
12
+ onClick={() => { setMapInteracted(false); fitBounds(mapRef.current, true); if (listingCount < 2) { setSelectedFilters({}); setQuery(null); }; }}
13
+ >
14
+ <img src={pinIconUrl} alt="Pin Icon" className="hc-size-5" />
15
+ Show All
16
+ </button>
17
+ );
18
+ };
19
+
20
+ export default ShowAllButton;
@@ -0,0 +1,167 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import { twMerge } from 'tailwind-merge';
4
+
5
+ const cardClasses = (className, hasShadow) => twMerge(
6
+ 'hc-relative hc-flex hc-flex-wrap hc-flex-col hc-bg-clip-border hc-break-words hc-bg-white hc-border hc-border-gray-100',
7
+ hasShadow ? 'hc-shadow-lg' : '',
8
+ className ?? ''
9
+ );
10
+
11
+ const Card = ({ children }) => {
12
+ return (
13
+ <>{children}</>
14
+ );
15
+ };
16
+
17
+ export const CardDefault = forwardRef((
18
+ {
19
+ as = 'div',
20
+ className,
21
+ hasShadow = false,
22
+ image,
23
+ body,
24
+ children,
25
+ footer,
26
+ ...rest
27
+ },
28
+ ref
29
+ ) => {
30
+ const Container = as;
31
+
32
+ return (
33
+ <Container
34
+ ref={ref}
35
+ className={cardClasses(className, hasShadow)}
36
+ {...rest}
37
+ >
38
+ {image}
39
+ {children}
40
+ {body}
41
+ {footer}
42
+ </Container>
43
+ );
44
+ });
45
+
46
+ const CardLink = ({
47
+ as = 'link',
48
+ href,
49
+ className,
50
+ hasShadow = false,
51
+ image,
52
+ body,
53
+ children,
54
+ footer,
55
+ ...rest
56
+ }) => {
57
+ const Container = as === 'link' ? Link : as;
58
+
59
+ return (
60
+ <Container
61
+ to={href}
62
+ className={twMerge(
63
+ cardClasses(className, hasShadow),
64
+ 'hc-group hc-transition hover:hc-shadow-xl hover:hc-border-indigo-300 focus:hc-shadow-xl focus:hc-border-indigo-300'
65
+ )}
66
+ {...rest}
67
+ >
68
+ {image && image}
69
+ {children}
70
+ {body && body}
71
+ {footer && footer}
72
+ </Container>
73
+ );
74
+ };
75
+
76
+ export const CardImage = ({
77
+ image,
78
+ alt,
79
+ className,
80
+ imageClassName,
81
+ ...rest
82
+ }) => {
83
+ return (
84
+ <div
85
+ className={twMerge(
86
+ 'hc-w-full',
87
+ className ?? ''
88
+ )}
89
+ >
90
+ <img
91
+ src={typeof image === 'string' ? image : image.src}
92
+ width={image.width ? image.width : null}
93
+ height={image.height ? image.height : null}
94
+ alt={alt ?? ''}
95
+ className={twMerge(
96
+ 'hc-w-full hc-h-auto',
97
+ imageClassName ?? ''
98
+ )}
99
+ {...rest}
100
+ />
101
+ </div>
102
+ );
103
+ };
104
+
105
+ export const CardBody = ({
106
+ children,
107
+ className
108
+ }) => {
109
+ return (
110
+ <div
111
+ className={twMerge(
112
+ 'hc-flex-auto hc-p-4 md:hc-px-6 lg:hc-px-8',
113
+ className ?? ''
114
+ )}
115
+ >
116
+ {children}
117
+ </div>
118
+ );
119
+ };
120
+
121
+ export const CardTitle = ({
122
+ as = 'h3',
123
+ children,
124
+ className,
125
+ ...rest
126
+ }) => {
127
+ const Title = as;
128
+
129
+ return (
130
+ <Title
131
+ className={twMerge(
132
+ 'hc-text-2xl hc-font-bold',
133
+ className ?? ''
134
+ )}
135
+ {...rest}
136
+ >
137
+ {children}
138
+ </Title>
139
+ );
140
+ };
141
+
142
+ export const CardFooter = ({
143
+ children,
144
+ className
145
+ }) => {
146
+ return (
147
+ <div
148
+ className={twMerge(
149
+ 'hc-py-2 hc-px-4 md:hc-px-6 lg:hc-px-8 hc-bg-gray-100',
150
+ className ?? ''
151
+ )}
152
+ >
153
+ {children}
154
+ </div>
155
+ );
156
+ };
157
+
158
+ Card.Default = CardDefault;
159
+ Card.Link = CardLink;
160
+ Card.Image = CardImage;
161
+ Card.Body = CardBody;
162
+ Card.Title = CardTitle;
163
+ Card.Footer = CardFooter;
164
+
165
+ CardDefault.displayName = 'Card:Default';
166
+
167
+ export default Card;
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+
3
+ import Card from '~/components/modules/cards/default';
4
+ import Icon from '~/components/modules/icon';
5
+
6
+ const CardFilter = ({
7
+ as,
8
+ className,
9
+ children,
10
+ ...rest
11
+ }) => {
12
+ return (
13
+ <Card.Default
14
+ as={as}
15
+ className={`
16
+ hc-bg-uiAccent/5 hc-border hc-border-uiAccent/20 hc-rounded
17
+ ${className ?? ''}
18
+ `}
19
+ {...rest}
20
+ >
21
+ <Card.Body className="!hc-p-3">
22
+ {children}
23
+ </Card.Body>
24
+ </Card.Default>
25
+ );
26
+ };
27
+
28
+ export const CardTitle = ({
29
+ as,
30
+ children,
31
+ icon,
32
+ className,
33
+ ...rest
34
+ }) => {
35
+ return (
36
+ <Card.Title
37
+ as={as}
38
+ className={`
39
+ hc-flex hc-items-center hc-gap-2 hc-mb-2 hc-text-xs hc-uppercase hc-font-bold hc-text-uiText
40
+ ${className ?? ''}
41
+ `}
42
+ {...rest}
43
+ >
44
+ <Icon
45
+ icon={icon}
46
+ size="hc-size-5"
47
+ className="hc-text-uiAccent/30"
48
+ />
49
+ {children}
50
+ </Card.Title>
51
+ );
52
+ };
53
+
54
+ CardFilter.Title = CardTitle;
55
+
56
+ export default CardFilter;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import * as Dialog from '@radix-ui/react-dialog';
3
+
4
+ import Button from '~/components/modules/buttons/default';
5
+ import Icon from '~/components/modules/icon';
6
+
7
+ const ApplyDialog = ({ children, applyUrl, internalApplyLink, companyName }) => (
8
+
9
+ <Dialog.Root >
10
+ <Dialog.Trigger asChild>
11
+ {children}
12
+ </Dialog.Trigger>
13
+ <Dialog.Portal>
14
+ <Dialog.Overlay className="hc-bg-black/50 hc-fixed hc-inset-0 hc-animate-overlayShow" />
15
+ <Dialog.Content className="z-99 hc-fit-content hc-h-fit hc-animate-contentShow hc-fixed hc-inset-0 hc-m-auto hc-max-h-[85vh] hc-w-[90vw] hc-max-w-[450px] hc-rounded-[6px] hc-bg-white hc-p-[25px] hc-shadow-lg focus:hc-outline-none hc-flex hc-flex-col hc-items-center hc-text-center">
16
+ <Dialog.Title className="hc-text-[17px] hc-font-medium hc-w-full">
17
+ Career Opportunities
18
+ </Dialog.Title>
19
+ <Dialog.Description className="hc-mt-4 hc-mb-5 hc-text-[15px] hc-leading-normal hc-w-full">
20
+ Are you currently a {companyName} employee?
21
+ </Dialog.Description>
22
+ <div className="hc-flex hc-justify-center hc-space-x-4 hc-w-full">
23
+ <Dialog.Close asChild>
24
+ <Button.Anchor variant="outline" href={internalApplyLink}>
25
+ Yes
26
+ </Button.Anchor>
27
+ </Dialog.Close>
28
+ <Dialog.Close asChild>
29
+ <Button.Anchor variant="primary" href={applyUrl}>
30
+ No
31
+ </Button.Anchor>
32
+ </Dialog.Close>
33
+ </div>
34
+ <Dialog.Close asChild>
35
+ <Button.Anchor className="hc-absolute hc-top-[10px] hc-right-[10px] hc-inline-flex hc-h-[25px] hc-w-[25px] hc-items-center hc-justify-center hc-rounded-full focus:hc-outline-none"
36
+ variant="ghost" aria-label="Close">
37
+ <Icon
38
+ icon="mdi:times"
39
+ className="hc-cursor-pointer hc-text-black hover:hc-text-gray-500 hover:hc-opacity-75"
40
+ />
41
+ </Button.Anchor>
42
+ </Dialog.Close>
43
+ </Dialog.Content>
44
+ </Dialog.Portal>
45
+ </Dialog.Root>
46
+ );
47
+
48
+ export default ApplyDialog;
@@ -0,0 +1,108 @@
1
+ import React, { Fragment } from 'react';
2
+ import { Combobox, Transition } from '@headlessui/react';
3
+
4
+ import Button from '~/components/modules/buttons/default';
5
+ import Icon from "~/components/modules/icon";
6
+
7
+ const FilterCommute = ({
8
+ className,
9
+ ready,
10
+ status,
11
+ data,
12
+ selected,
13
+ isCurrentLocation,
14
+ inputRef,
15
+ handleSelect,
16
+ setValue,
17
+ setSelected,
18
+ clearSuggestions,
19
+ commuteLocation,
20
+ setIsCurrentLocation,
21
+ fetchLocation,
22
+ setCommuteLocation
23
+ }) => {
24
+ return (
25
+ <div className={`relative ${className ?? ""}`}>
26
+ <label
27
+ htmlFor="commute"
28
+ className="hc-flex hc-items-center hc-gap-2 hc-mb-2 hc-text-xs hc-uppercase hc-font-bold hc-text-uiText"
29
+ >
30
+ <Icon
31
+ icon="ri:pin-distance-fill"
32
+ size="hc-size-5"
33
+ className="hc-text-uiAccent/30"
34
+ />
35
+ <span>
36
+ <span className="md:hc-hidden lg:hc-inline">Calculate your</span> commute
37
+ </span>
38
+ </label>
39
+
40
+ <Combobox value={selected} onChange={handleSelect}>
41
+ <div className="hc-relative hc-mt-1">
42
+ <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">
43
+ <Combobox.Input
44
+ 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"
45
+ onChange={e => {
46
+ setCommuteLocation("");
47
+ setValue(e.target.value);
48
+ setSelected(e.target.value);
49
+ }}
50
+ value={selected}
51
+ disabled={!ready}
52
+ placeholder="Starting point"
53
+ ref={inputRef}
54
+ />
55
+ <Button.Btn
56
+ variant="icon"
57
+ size="sqsm"
58
+ onClick={() => {
59
+ setIsCurrentLocation(!isCurrentLocation);
60
+ localStorage.setItem('isCurrentLocation', !isCurrentLocation);
61
+ if (isCurrentLocation || commuteLocation) {
62
+ setCommuteLocation("");
63
+ setSelected("");
64
+ } else if (!commuteLocation) { fetchLocation(); }
65
+ }}
66
+
67
+ className=""
68
+ >
69
+ <span className="hc-sr-only">Use your location</span>
70
+ {commuteLocation ? <Icon icon="mdi:times"></Icon> : <Button.Icon className={isCurrentLocation ? 'hc-text-blue-500' : 'hc-text-current'} icon="mdi:my-location" />}
71
+ </Button.Btn>
72
+ </div>
73
+ <Transition
74
+ as={Fragment}
75
+ leave="hc-transition hc-ease-in hc-duration-100"
76
+ leaveFrom="hc-opacity-100"
77
+ leaveTo="hc-opacity-0"
78
+ afterLeave={clearSuggestions}
79
+ >
80
+ <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">
81
+ {status === "OK" &&
82
+ data.map(data => (
83
+ <Combobox.Option
84
+ key={data.place_id}
85
+ value={data.description}
86
+ className={({ active }) =>
87
+ `hc-relative hc-cursor-default hc-select-none hc-px-4 hc-py-2 ${active ? "hc-bg-primary hc-text-white" : "hc-text-uiText"
88
+ }`
89
+ }
90
+ >
91
+ {({ selected }) => (
92
+ <span
93
+ className={`hc-block hc-truncate ${selected ? "hc-font-bold" : "hc-font-medium"}`}
94
+ >
95
+ {data.description}
96
+ </span>
97
+ )}
98
+ </Combobox.Option>
99
+ ))}
100
+ </Combobox.Options>
101
+ </Transition>
102
+ </div>
103
+ </Combobox>
104
+ </div>
105
+ );
106
+ };
107
+
108
+ export default FilterCommute;
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import Button from '~/components/modules/buttons/default';
3
+
4
+ const Filter = ({
5
+ className,
6
+ hasActiveFilters,
7
+ filteredListings,
8
+ selectedFilters,
9
+ setMobileTab,
10
+ handleReset,
11
+ children
12
+ }) => {
13
+ return (
14
+ <div
15
+ className={`
16
+ hc-relative hc-max-h-[95vh] md:hc-max-h-screen hc-overflow-y-auto hc-overflow-x-auto
17
+ ${className ?? ""}
18
+ `}
19
+ >
20
+ <div className="hc-px-4 md:hc-pt-4 hc-space-y-4">
21
+ {children}
22
+ </div>
23
+ <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">
24
+ <Button.Btn
25
+ onClick={handleReset}
26
+ variant="outline"
27
+ size="sm"
28
+ >
29
+ Reset
30
+ </Button.Btn>
31
+ {selectedFilters && Object.keys(selectedFilters).length > 0 &&
32
+ <Button.Btn
33
+ onClick={() => setMobileTab("listTab")}
34
+ variant="primary"
35
+ size="sm"
36
+ className={`
37
+ md:hc-hidden
38
+ ${hasActiveFilters ? "hc-opacity-0 hc-pointer-events-none" : "hc-opacity-100"}
39
+ `}
40
+ >
41
+ <Button.Body>
42
+ <Button.Icon
43
+ icon="fluent:search-12-filled"
44
+ size="hc-size-3.5"
45
+ />
46
+ Show {filteredListings.length} Jobs
47
+ </Button.Body>
48
+ </Button.Btn>
49
+ }
50
+ </div>
51
+ </div>
52
+ );
53
+ };
54
+
55
+ export default Filter;