@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,106 +0,0 @@
1
- import { useState } from 'react';
2
- import { Link } from 'react-router-dom';
3
- import NavLink from '~/components/modules/navigation/nav-link';
4
- import Icon from '~/components/modules/icon';
5
- import React from 'react'
6
- import routes from '~/data/routes.json';
7
- import site from '~/data/site.json';
8
-
9
- const Navbar = ({ isPinned }) => {
10
- const [isExpanded, toggleExpansion] = useState(false);
11
-
12
- return (
13
- <div
14
- className={`
15
- hc-px-4 hc-transition-all hc-bg-white/20 hc-border-b hc-border-gray-400/20 hc-backdrop-blur
16
- ${isPinned ? 'mb:hc-bg-transparent md:hc-border-0 md:hc-backdrop-blur-[unset]' : ''}
17
- `}
18
- >
19
- <div
20
- className={`
21
- hc-flex hc-flex-wrap hc-items-center hc-justify-between hc-py-2 hc-px-6 hc-container hc-transition-all
22
- ${isPinned ? 'md:hc-translate-y-2 md:hc-bg-white/20 md:hc-border md:hc-border-gray-400/20 md:!hc-backdrop-blur md:hc-rounded-full' : ''}
23
- `}
24
- >
25
- <Link
26
- href="/"
27
- className="hc-flex hc-gap-2 hc-items-center"
28
- >
29
- <Icon
30
- icon="mdi:robot"
31
- size="hc-size-6"
32
- />
33
- <h1 className="hc-text-gray-800 hc-font-bold hc-text-md hc-no-underline">
34
- {site.title}
35
- </h1>
36
- </Link>
37
-
38
- <button
39
- className={`
40
- hc-block md:hc-hidden hc-px-3 hc-py-2 hc-transition-colors hover:hc-text-indigo-700 focus:hc-text-indigo-700
41
- ${isExpanded ? 'hc-text-indigo-700' : 'hc-text-gray-800'}
42
- `}
43
- onClick={() => toggleExpansion(!isExpanded)}
44
- >
45
- <svg
46
- viewBox="0 0 20 20"
47
- xmlns="http://www.w3.org/2000/svg"
48
- className={`
49
- hc-block hc-size-5 hc-fill-current hc-transition-transform
50
- ${isExpanded ? `hc-transform-gpu hc-rotate-180` : ``}
51
- `}
52
- >
53
- <title>Menu</title>
54
- <rect
55
- y="3"
56
- width="20"
57
- height="2"
58
- className={`
59
- hc-transition
60
- ${isExpanded ? `hc-transform-gpu hc-rotate-45 hc-translate-y-[0] hc-translate-x-[6px]` : ``}
61
- `}
62
- />
63
- <rect
64
- y="9"
65
- width="20"
66
- height="2"
67
- className={`
68
- hc-transition
69
- ${isExpanded ? `hc-opacity-0` : ``}
70
- `}
71
- />
72
- <rect
73
- y="15"
74
- width="20"
75
- height="2"
76
- className={`
77
- hc-transition
78
- ${isExpanded ? `hc-transform-gpu -hc-rotate-45 hc-translate-y-[6px] hc-translate-x-[-8px]` : ``}
79
- `}
80
- />
81
- </svg>
82
- </button>
83
-
84
- <nav
85
- className={`
86
- md:hc-flex md:hc-items-center md:hc-gap-2 hc-w-full md:hc-w-auto pt-2 md:hc-pt-0
87
- ${isExpanded ? 'hc-block' : 'hc-hidden'}
88
- `}
89
- >
90
- {routes.map(link => (
91
- <NavLink.Anchor
92
- key={link.title}
93
- href={link.route}
94
- className="hc-block md:hc-inline-block hc-px-3.5 hc-py-1.5 hc-rounded-full hc-border hc-border-transparent hc-text-xs hc-text-gray-800 hc-transition-colors hover:hc-border-indigo-700 hover:hc-text-indigo-700 focus:hc-border-indigo-700 focus:hc-text-indigo-700"
95
- activeClassName="hc-bg-indigo-700 !hc-text-white"
96
- >
97
- {link.title}
98
- </NavLink.Anchor>
99
- ))}
100
- </nav>
101
- </div>
102
- </div>
103
- );
104
- };
105
-
106
- export default Navbar;
@@ -1,21 +0,0 @@
1
- import React from 'react'
2
-
3
- const SkipLink = ({
4
- href = '#start-of-content',
5
- className,
6
- children = 'Skip to content'
7
- }) => {
8
- return (
9
- <a
10
- href={href}
11
- className={`
12
- hc-sr-only focus:hc-not-sr-only focus:hc-absolute focus:hc-py-2 focus:hc-px-6 hc-bg-gray-900 dark:hc-bg-white hc-text-white dark:hc-text-gray-900 hc-font-bold hc-text-center hc-transition-colors hover:hc-bg-gray-700
13
- ${className ?? ''}
14
- `}
15
- >
16
- {children}
17
- </a>
18
- );
19
- };
20
-
21
- export default SkipLink;
@@ -1,29 +0,0 @@
1
- import Button from '~/components/modules/buttons/default';
2
- import React from 'react'
3
- import site from '~/data/site.json';
4
-
5
- const NavSocial = () => {
6
- const socials = site.social;
7
-
8
- return (
9
- <nav className="hc-flex hc-justify-self-end hc-gap-3">
10
- {socials.map((data, index) => (
11
- <Button.Anchor
12
- key={`${index}`}
13
- href={data.url}
14
- variant="icon"
15
- size="sq"
16
- >
17
- <span className="hc-sr-only">{data.label}</span>
18
-
19
- <Button.Icon
20
- icon={data.icon}
21
- size="hc-size-4"
22
- />
23
- </Button.Anchor>
24
- ))}
25
- </nav>
26
- );
27
- };
28
-
29
- export default NavSocial;
@@ -1,59 +0,0 @@
1
- import { InView } from 'react-intersection-observer';
2
- import React from 'react'
3
- import useSectionTracker from '~/hooks/useSectionTracker';
4
-
5
- const isBrowser = typeof window !== 'undefined';
6
-
7
- const Section = ({
8
- children,
9
- className,
10
- ...props
11
- }) => {
12
- const sectionIsIntersecting = useSectionTracker();
13
-
14
- const onChange = (inView, entry) => {
15
- if (inView) {
16
- if (entry.intersectionRatio > 0 && sectionIsIntersecting) {
17
- sectionIsIntersecting(entry.target.id, entry.intersectionRatio, entry.intersectionRatio * entry.boundingClientRect.height / (isBrowser ? window.innerHeight : 1));
18
- }
19
- }
20
- };
21
-
22
- return (
23
- <InView
24
- as="section"
25
- threshold={[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]}
26
- onChange={onChange}
27
- className={`
28
- hc-scroll-mt-20
29
- ${className ?? ''}
30
- `}
31
- {...props}
32
- >
33
- {children}
34
- </InView>
35
- );
36
- };
37
-
38
- export const SectionTitle = ({
39
- as = 'h2',
40
- children,
41
- className
42
- }) => {
43
- const Title = as;
44
-
45
- return (
46
- <Title
47
- className={`
48
- hc-mb-4 hc-text-2xl
49
- ${className ?? ''}
50
- `}
51
- >
52
- {children}
53
- </Title>
54
- );
55
- };
56
-
57
- Section.Title = SectionTitle;
58
-
59
- export default Section;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
-
3
- const reactThingy = React
4
- export const SectionContext = reactThingy.createContext(null)
@@ -1,16 +0,0 @@
1
- import useEventListener from '~/hooks/useEventListener';
2
-
3
- const isBrowser = typeof window !== "undefined";
4
-
5
- const useClickOutside = (ref, cb) => {
6
- useEventListener(
7
- 'click',
8
- e => {
9
- if (ref.current == null || ref.current.contains(e.target)) return;
10
- cb(e);
11
- },
12
- isBrowser ? document : null
13
- );
14
- };
15
-
16
- export default useClickOutside;
@@ -1,25 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
-
3
- const isBrowser = typeof window !== "undefined";
4
-
5
- const useEventListener = (
6
- eventType,
7
- callback,
8
- element = isBrowser ?? window
9
- ) => {
10
- const callbackRef = useRef(callback);
11
-
12
- useEffect(() => {
13
- callbackRef.current = callback;
14
- }, [callback]);
15
-
16
- useEffect(() => {
17
- if (element == null) return;
18
- const handler = e => callbackRef.current(e);
19
- element.addEventListener(eventType, handler);
20
-
21
- return () => element.removeEventListener(eventType, handler);
22
- }, [eventType, element]);
23
- };
24
-
25
- export default useEventListener;
@@ -1,19 +0,0 @@
1
- const isBrowser = typeof window !== 'undefined';
2
-
3
- if (isBrowser) {
4
- window.dataLayer = window.dataLayer || [];
5
- }
6
-
7
- const trackEvent = (category, action, label, value) => {
8
- if (isBrowser && window.dataLayer) {
9
- window.dataLayer.push({
10
- 'event': 'eventTracking',
11
- 'category': category,
12
- 'action': action,
13
- 'label': label,
14
- 'value': value
15
- });
16
- }
17
- };
18
-
19
- export default trackEvent;
@@ -1,24 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import useWindowSize from './useWindowSize';
3
-
4
- export default function useRefScrollProgress({ inputRef }) {
5
- const ref = inputRef;
6
- const [start, setStart] = useState(null);
7
- const [end, setEnd] = useState(null);
8
- const size = useWindowSize();
9
-
10
- useEffect(() => {
11
- if (!ref.current) {
12
- return;
13
- }
14
-
15
- const rect = ref.current.getBoundingClientRect();
16
- const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
17
- const offsetTop = rect.top + scrollTop;
18
-
19
- setStart(offsetTop / document.body.clientHeight);
20
- setEnd((offsetTop + rect.height) / document.body.clientHeight);
21
- }, [ref, size]);
22
-
23
- return { ref, start, end };
24
- }
@@ -1,63 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- const isBrowser = typeof window !== 'undefined';
4
-
5
- function useScript(src) {
6
- // Keep track of script status ("idle", "loading", "ready", "error")
7
- const [status, setStatus] = useState(src ? "loading" : "idle");
8
- useEffect(
9
- () => {
10
- // Allow falsy src value if waiting on other data needed for
11
- // constructing the script URL passed to this hook.
12
- if (!isBrowser || !src) {
13
- setStatus("idle");
14
- return;
15
- }
16
- // Fetch existing script element by src
17
- // It may have been added by another intance of this hook
18
- let script = document.querySelector(`script[src="${src}"]`);
19
- if (!script) {
20
- // Create script
21
- script = document.createElement("script");
22
- script.src = src;
23
- script.async = true;
24
- script.setAttribute("data-status", "loading");
25
- // Add script to document body
26
- document.body.appendChild(script);
27
- // Store status in attribute on script
28
- // This can be read by other instances of this hook
29
- const setAttributeFromEvent = event => {
30
- script.setAttribute(
31
- "data-status",
32
- event.type === "load" ? "ready" : "error"
33
- );
34
- };
35
- script.addEventListener("load", setAttributeFromEvent);
36
- script.addEventListener("error", setAttributeFromEvent);
37
- } else {
38
- // Grab existing script status from attribute and set to state.
39
- setStatus(script.getAttribute("data-status"));
40
- }
41
- // Script event handler to update status in state
42
- // Note: Even if the script already exists we still need to add
43
- // event handlers to update the state for *this* hook instance.
44
- const setStateFromEvent = event => {
45
- setStatus(event.type === "load" ? "ready" : "error");
46
- };
47
- // Add event listeners
48
- script.addEventListener("load", setStateFromEvent);
49
- script.addEventListener("error", setStateFromEvent);
50
- // Remove event listeners on cleanup
51
- return () => {
52
- if (script) {
53
- script.removeEventListener("load", setStateFromEvent);
54
- script.removeEventListener("error", setStateFromEvent);
55
- }
56
- };
57
- },
58
- [src] // Only re-run effect if script src changes
59
- );
60
- return status;
61
- }
62
-
63
- export default useScript;
@@ -1,39 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- export const useScrollDirection = () => {
4
- const threshold = 1;
5
- const [scrollDir, setScrollDir] = useState('up');
6
-
7
- useEffect(() => {
8
- let previousScrollYPosition = window.scrollY;
9
-
10
- const scrolledMoreThanThreshold = currentScrollYPosition =>
11
- Math.abs(currentScrollYPosition - previousScrollYPosition) > threshold;
12
-
13
- const isScrollingUp = currentScrollYPosition =>
14
- currentScrollYPosition > previousScrollYPosition &&
15
- !(previousScrollYPosition > 0 && currentScrollYPosition === 0) &&
16
- !(currentScrollYPosition > 0 && previousScrollYPosition === 0);
17
-
18
- const updateScrollDirection = () => {
19
- const currentScrollYPosition = window.scrollY;
20
-
21
- if (scrolledMoreThanThreshold(currentScrollYPosition)) {
22
- const newScrollDirection = isScrollingUp(currentScrollYPosition)
23
- ? 'down'
24
- : 'up';
25
- setScrollDir(newScrollDirection);
26
- previousScrollYPosition =
27
- currentScrollYPosition > 0 ? currentScrollYPosition : 0;
28
- }
29
- };
30
-
31
- const onScroll = () => window.requestAnimationFrame(updateScrollDirection);
32
-
33
- window.addEventListener("scroll", onScroll);
34
-
35
- return () => window.removeEventListener("scroll", onScroll);
36
- }, []);
37
-
38
- return scrollDir;
39
- };
@@ -1,95 +0,0 @@
1
- import { useState, useContext } from 'react';
2
- import trackEvent from '~/hooks/useEventTracker';
3
-
4
- import { SectionContext } from '~/components/modules/sections/sectionContext';
5
-
6
- const isBrowser = typeof window !== 'undefined';
7
-
8
- const ignore = ['intro'];
9
- const RATIO = 0.33;
10
- // let first = true;
11
-
12
- const useSectionTracker = () => {
13
- const { setCurrentSection } = useContext(SectionContext);
14
-
15
- const [lastSection, setLastSection] = useState('');
16
- const [sections, setSections] = useState([]);
17
- let timeout = null;
18
-
19
- // Allows a blank hash or ensures there is a # in the hash and replaces current state
20
- const setHash = hash => {
21
- if (hash !== ' ' && hash.indexOf('#') === -1) {
22
- hash = `#${hash}`;
23
- }
24
- if (window.history.replaceState) {
25
- window.history.replaceState(window.history.state, null, hash);
26
- } else {
27
- window.location.replace(hash);
28
- }
29
- };
30
-
31
- // Called when a section is intersecting
32
- const sectionIsIntersecting = (id, ratio, threshold) => {
33
- // Ignore sections we don't want to track
34
- if (ignore.indexOf(id) !== -1) {
35
- return;
36
- }
37
-
38
- const newThreshold = threshold;
39
- let found = false;
40
-
41
- // Update sections we've seen before
42
- sections.forEach(section => {
43
- if (section.id === id) {
44
- if (newThreshold < RATIO) {
45
- section.active = false;
46
- } else {
47
- section.active = true;
48
- }
49
- section.threshold = newThreshold;
50
- found = true;
51
- }
52
- });
53
-
54
- // Otherwise, add the section to the list
55
- if (!found) {
56
- setSections(sections => {
57
- sections.push({ id, threshold: newThreshold, active: newThreshold < RATIO ? false : true });
58
- return sections;
59
- });
60
- }
61
-
62
- let maxThreshold = 0;
63
- let sectionId = '';
64
-
65
- clearTimeout(timeout);
66
-
67
- timeout = setTimeout(() => {
68
- // Find the section with the largest threshold
69
- sections.forEach(section => {
70
- if (section.active && section.threshold > maxThreshold) {
71
- maxThreshold = section.threshold;
72
- sectionId = section.id;
73
- }
74
- });
75
-
76
- // Set the current section (hash, track event)
77
- if (isBrowser && sectionId && sectionId !== lastSection) {
78
- setHash(ignore.some(id => id === sectionId) ? ' ' : sectionId);
79
- trackEvent('Engagement', 'View Section', sectionId);
80
- setCurrentSection(sectionId);
81
- // } else {
82
- } else if (isBrowser && window.scrollY < 100) {
83
- setCurrentSection(' ');
84
- setHash(' ');
85
- }
86
-
87
- // Remember this section for next time so we don't set it again if not necessary
88
- setLastSection(sectionId);
89
- }, 500);
90
- };
91
-
92
- return sectionIsIntersecting;
93
- };
94
-
95
- export default useSectionTracker;
@@ -1,43 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import UAParser from 'ua-parser-js';
3
-
4
- const isBrowser = () => typeof window !== 'undefined';
5
-
6
- const useUserAgent = () => {
7
- const [state, setState] = useState(null);
8
-
9
- useEffect(() => {
10
- if (!isBrowser) {
11
- return null;
12
- }
13
-
14
- let didRun = true;
15
-
16
- try {
17
- const uaParser = new UAParser.UAParser();
18
- uaParser.setUA(window.navigator.userAgent);
19
- const payload = {
20
- os: uaParser.getOS(),
21
- browser: uaParser.getBrowser(),
22
- cpu: uaParser.getCPU(),
23
- device: uaParser.getDevice(),
24
- engine: uaParser.getEngine()
25
- };
26
- if (didRun) {
27
- setState(payload);
28
- }
29
- } catch (err) {
30
- if (didRun) {
31
- setState(null);
32
- }
33
- }
34
-
35
- return () => {
36
- didRun = false;
37
- };
38
- }, []);
39
-
40
- return state;
41
- };
42
-
43
- export default useUserAgent;
@@ -1,28 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
-
3
- export default function useWindowSize() {
4
- // Initialize state with undefined width/height so server and client renders match
5
- // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
6
- const [windowSize, setWindowSize] = useState({
7
- width: undefined,
8
- height: undefined
9
- });
10
-
11
- useEffect(() => {
12
- // Handler to call on window resize
13
- function handleResize() {
14
- // Set window width/height to state
15
- setWindowSize({
16
- width: window.innerWidth,
17
- height: window.innerHeight
18
- });
19
- }
20
- // Add event listener
21
- window.addEventListener("resize", () => {
22
- window.requestAnimationFrame(handleResize);
23
- });
24
- // Remove event listener on cleanup
25
- return () => window.removeEventListener("resize", handleResize);
26
- }, []); // Empty array ensures that effect is only run on mount
27
- return windowSize;
28
- }
package/src/index.css DELETED
@@ -1,25 +0,0 @@
1
- @config "./tailwind/tailwind.config.js";
2
- @tailwind base;
3
- @tailwind components;
4
- @tailwind utilities;
5
-
6
-
7
- /* @layer base {
8
- html {
9
- @apply text-400 text-uiText [scroll-behavior:smooth];
10
- }
11
- }
12
-
13
- @layer components {
14
- .track * {
15
- @apply pointer-events-none;
16
- }
17
-
18
- .stretched-link::after {
19
- @apply content-[''] absolute inset-0 z-[1] pointer-events-auto bg-transparent;
20
- }
21
- }
22
-
23
- .fit-content{
24
- height:fit-content;
25
- } */
File without changes
@@ -1,62 +0,0 @@
1
- import { useMapList } from "~/contexts/mapListContext";
2
- import React from 'react';
3
- const PageHead = ({
4
- description,
5
- keywords,
6
- title
7
- }) => {
8
- const {siteConfig} = useMapList();
9
- //const router = useRouter();
10
- const defaultTitle = siteConfig.title;
11
- const pageTitle = title || defaultTitle;
12
- const metaDescription = description || siteConfig.description;
13
-
14
- return (
15
- <div>
16
- <title>{title ? `${title} | ${defaultTitle}` : defaultTitle}</title>
17
- <meta name="description" content={metaDescription} />
18
- {keywords?.length > 0
19
- ? (
20
- <meta name="keywords" content={`${keywords.join(', ')}`} />
21
- ) : null
22
- }
23
-
24
- <meta property="og:title" content={pageTitle} />
25
- <meta property="og:description" content={metaDescription} />
26
- {siteConfig?.shareImage &&
27
- <meta property="og:image" content={`/${siteConfig.shareImage}`} />
28
- }
29
- <meta property="og:type" content="website" />
30
-
31
- <meta name="twitter:card" content="summary" />
32
- <meta name="twitter:creator" content={siteConfig?.author} />
33
- <meta name="twitter:title" content={pageTitle} />
34
- <meta name="twitter:description" content={metaDescription} />
35
- <script type="application/ld+json">
36
- {`
37
- {
38
- "@context": "https://schema.org",
39
- "@type": "WebPage",
40
- "url": "pathame",
41
- "legalName": "${defaultTitle}",
42
- "name": "${pageTitle}",
43
- "about": "${metaDescription}",
44
- "brand": "${defaultTitle}"
45
- }
46
- `}
47
- </script>
48
-
49
- <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
50
-
51
- {/* Only show these in Production */}
52
- {'' !== 'development' && <>
53
- <link rel="icon" href="/favicon.ico" sizes="any" />
54
- <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
55
- <link rel="manifest" href="/manifest.webmanifest" />
56
- <meta name="msapplication-TileColor" content={siteConfig?.colors?.manifest?.tileColor ?? '#000'} />
57
- </>}
58
- </div>
59
- );
60
- };
61
-
62
- export default PageHead;
@@ -1,12 +0,0 @@
1
- import { Provider as RWBProvider } from 'react-wrap-balancer';
2
- import React from 'react';
3
-
4
- export function Provider({
5
- children
6
- }) {
7
- return (
8
- <RWBProvider>
9
- {children}
10
- </RWBProvider>
11
- );
12
- }