@ably/ui 8.7.0-dev.4e08581 → 8.7.0-dev.52da22c

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 (177) hide show
  1. package/README.md +16 -5
  2. package/core/Code/component.css +3 -3
  3. package/core/Code/component.js +1 -1
  4. package/core/Code.jsx +351 -7148
  5. package/core/CompanyAutocomplete/component.js +2 -1
  6. package/core/CompanyAutocomplete/component.js.LICENSE.txt +1 -0
  7. package/core/ConnectStateWrapper/component.js +1 -1
  8. package/core/ConnectStateWrapper.jsx +7 -7
  9. package/core/ContactFooter/component.js +1 -1
  10. package/core/ContactFooter.jsx +12 -12
  11. package/core/CookieMessage/component.js +1 -1
  12. package/core/CookieMessage.jsx +10 -10
  13. package/core/CustomerLogos/component.js +1 -1
  14. package/core/CustomerLogos.jsx +7 -7
  15. package/core/DropdownMenu/component.js +1 -0
  16. package/core/DropdownMenu.jsx +313 -0
  17. package/core/FeatureFooter/component.js +1 -1
  18. package/core/FeaturedLink/component.js +1 -1
  19. package/core/FeaturedLink.jsx +10 -10
  20. package/core/Flash/component.js +1 -1
  21. package/core/Flash.jsx +142 -70
  22. package/core/Footer/component.css +21 -1
  23. package/core/Footer/component.js +1 -1
  24. package/core/Footer.jsx +162 -76
  25. package/core/Icon/component.js +1 -1
  26. package/core/Icon.jsx +7 -7
  27. package/core/Loader/component.js +1 -1
  28. package/core/Loader.jsx +7 -7
  29. package/core/Logo/component.js +1 -1
  30. package/core/Logo.jsx +33 -118
  31. package/core/Meganav/component.css +59 -20
  32. package/core/Meganav/component.js +1 -1
  33. package/core/Meganav/component.json +2 -2
  34. package/core/Meganav.jsx +1120 -1211
  35. package/core/MeganavBlogPostsList/component.js +2 -1
  36. package/core/MeganavBlogPostsList/component.js.LICENSE.txt +1 -0
  37. package/core/MeganavBlogPostsList.jsx +13 -13
  38. package/core/MeganavContentCompany/component.js +1 -1
  39. package/core/MeganavContentCompany.jsx +328 -731
  40. package/core/MeganavContentDevelopers/component.js +1 -1
  41. package/core/MeganavContentDevelopers.jsx +119 -78
  42. package/core/{MeganavContentPlatform → MeganavContentProducts}/component.js +1 -1
  43. package/core/{MeganavContentPlatform.jsx → MeganavContentProducts.jsx} +34 -58
  44. package/core/MeganavContentUseCases/component.js +1 -1
  45. package/core/MeganavContentUseCases.jsx +63 -55
  46. package/core/MeganavControl/component.js +1 -1
  47. package/core/MeganavControl.jsx +10 -10
  48. package/core/MeganavControlMobileDropdown/component.js +1 -1
  49. package/core/MeganavControlMobileDropdown.jsx +11 -11
  50. package/core/MeganavControlMobilePanelClose/component.js +1 -1
  51. package/core/MeganavControlMobilePanelClose.jsx +10 -10
  52. package/core/MeganavControlMobilePanelOpen/component.js +1 -1
  53. package/core/MeganavControlMobilePanelOpen.jsx +10 -10
  54. package/core/MeganavItemsDesktop/component.js +1 -1
  55. package/core/MeganavItemsDesktop.jsx +17 -17
  56. package/core/MeganavItemsMobile/component.js +1 -1
  57. package/core/MeganavItemsMobile.jsx +39 -39
  58. package/core/MeganavItemsSignedIn/component.js +1 -1
  59. package/core/MeganavItemsSignedIn.jsx +33 -33
  60. package/core/MeganavSearch/component.js +1 -1
  61. package/core/MeganavSearch.jsx +23 -23
  62. package/core/MeganavSearchAutocomplete/component.js +1 -1
  63. package/core/MeganavSearchAutocomplete.jsx +4 -4
  64. package/core/MeganavSearchPanel/component.js +1 -1
  65. package/core/MeganavSearchPanel.jsx +19 -19
  66. package/core/MeganavSearchSuggestions/component.js +1 -1
  67. package/core/MeganavSearchSuggestions.jsx +13 -13
  68. package/core/Notice/component.js +1 -1
  69. package/core/Notice.jsx +152 -80
  70. package/core/Showcase/component.js +1 -1
  71. package/core/Showcase.jsx +1 -1
  72. package/core/SignOutLink/component.js +1 -1
  73. package/core/SignOutLink.jsx +7 -7
  74. package/core/Slider/component.js +1 -1
  75. package/core/Slider.jsx +14 -14
  76. package/core/Uptime/component.js +1 -1
  77. package/core/Uptime.jsx +300 -715
  78. package/core/images/ably-logo.png +0 -0
  79. package/core/images/best-support-2023.svg +1 -0
  80. package/core/images/fastest-implementation-2023.svg +1 -0
  81. package/core/images/high-performer-2022.png +0 -0
  82. package/core/images/high-performer-2023.svg +1 -0
  83. package/core/images/highest-user-adoption-2022.png +0 -0
  84. package/core/images/highest-user-adoption-2023.svg +1 -0
  85. package/core/images/users-love-us-2022.png +0 -0
  86. package/core/scripts.js +2 -1
  87. package/core/scripts.js.LICENSE.txt +1 -0
  88. package/core/sprites.svg +135 -1
  89. package/core/styles.css +3 -7
  90. package/package.json +7 -6
  91. package/reset/scripts.js +1 -1
  92. package/reset/styles.css +1 -11
  93. package/src/core/Code/component.css +1 -67
  94. package/src/core/Code/component.js +11 -46
  95. package/src/core/Code/component.jsx +7 -3
  96. package/src/core/DropdownMenu/component.jsx +112 -0
  97. package/src/core/FeatureFooter/component.html.erb +1 -1
  98. package/src/core/Flash/component.jsx +40 -14
  99. package/src/core/Footer/component.css +21 -1
  100. package/src/core/Footer/component.html.erb +120 -63
  101. package/src/core/Footer/component.jsx +128 -61
  102. package/src/core/HeadwayWidget/HeadwayWidget.jsx +229 -0
  103. package/src/core/HeadwayWidget/index.js +5 -0
  104. package/src/core/Logo/component.html.erb +2 -27
  105. package/src/core/Logo/component.jsx +7 -40
  106. package/src/core/Logo/component.rb +15 -6
  107. package/src/core/Meganav/MeganavHeadwayPortal.jsx +20 -0
  108. package/src/core/Meganav/component.css +59 -18
  109. package/src/core/Meganav/component.html.erb +1 -1
  110. package/src/core/Meganav/component.json +2 -2
  111. package/src/core/Meganav/component.jsx +16 -12
  112. package/src/core/Meganav/component.rb +7 -6
  113. package/src/core/MeganavContentCompany/component.html.erb +9 -0
  114. package/src/core/MeganavContentCompany/component.jsx +9 -0
  115. package/src/core/MeganavContentDevelopers/component.html.erb +47 -21
  116. package/src/core/MeganavContentDevelopers/component.js +16 -0
  117. package/src/core/MeganavContentDevelopers/component.jsx +52 -23
  118. package/src/core/{MeganavContentPlatform → MeganavContentProducts}/component.html.erb +15 -33
  119. package/src/core/{MeganavContentPlatform → MeganavContentProducts}/component.jsx +18 -39
  120. package/src/core/{MeganavContentPlatform → MeganavContentProducts}/component.rb +1 -1
  121. package/src/core/MeganavContentUseCases/component.html.erb +43 -39
  122. package/src/core/MeganavContentUseCases/component.jsx +42 -39
  123. package/src/core/MeganavItemsDesktop/component.jsx +1 -1
  124. package/src/core/MeganavItemsDesktop/component.rb +1 -1
  125. package/src/core/MeganavSearchSuggestions/component.html.erb +1 -1
  126. package/src/core/core.rb +16 -4
  127. package/src/core/icons/github.svg +1 -1
  128. package/src/core/icons/google.svg +3 -0
  129. package/src/core/icons/icon-display-asset-tracking-col.svg +18 -0
  130. package/src/core/icons/icon-display-chat-col.svg +4 -0
  131. package/src/core/icons/icon-display-data-broadcast-col.svg +26 -0
  132. package/src/core/icons/icon-display-data-synchronization-col.svg +14 -0
  133. package/src/core/icons/icon-display-events-col.svg +13 -0
  134. package/src/core/icons/icon-display-examples-col.svg +11 -0
  135. package/src/core/icons/icon-display-integrations-col.svg +8 -0
  136. package/src/core/icons/icon-display-kafka-at-the-edge-col.svg +8 -0
  137. package/src/core/icons/icon-display-push-notifications-col.svg +6 -0
  138. package/src/core/icons/icon-gui-check-circled-fill-black.svg +4 -0
  139. package/src/core/icons/icon-gui-filter-flow-step-1.svg +5 -0
  140. package/src/core/icons/icon-gui-filter-flow-step-2.svg +5 -0
  141. package/src/core/icons/icon-gui-filter-flow-step-3.svg +5 -0
  142. package/src/core/icons/icon-gui-resources.svg +3 -0
  143. package/src/core/icons/icon-social-x.svg +3 -0
  144. package/src/core/icons/icon-tech-apachekafka.svg +3 -0
  145. package/src/core/icons/stackoverflow.svg +3 -0
  146. package/src/core/icons/youtube.svg +11 -0
  147. package/src/core/images/ably-logo.png +0 -0
  148. package/src/core/images/best-support-2023.svg +1 -0
  149. package/src/core/images/fastest-implementation-2023.svg +1 -0
  150. package/src/core/images/high-performer-2022.png +0 -0
  151. package/src/core/images/high-performer-2023.svg +1 -0
  152. package/src/core/images/highest-user-adoption-2022.png +0 -0
  153. package/src/core/images/highest-user-adoption-2023.svg +1 -0
  154. package/src/core/images/users-love-us-2022.png +0 -0
  155. package/src/core/styles/properties.css +2 -0
  156. package/src/core/styles/text.css +1 -1
  157. package/src/core/utils/syntax-highlighter-registry.js +63 -0
  158. package/src/core/utils/syntax-highlighter.css +69 -0
  159. package/src/core/utils/syntax-highlighter.js +103 -0
  160. package/tailwind.config.js +1 -0
  161. package/core/.DS_Store +0 -0
  162. package/core/Meganav/component.js.LICENSE.txt +0 -7
  163. package/core/MeganavContentWhyAbly/component.js +0 -6
  164. package/core/MeganavContentWhyAbly.jsx +0 -6
  165. package/core/MeganavSearchAutocomplete/component.js.LICENSE.txt +0 -7
  166. package/core/Notice/component.js.LICENSE.txt +0 -9
  167. package/core/fonts/.DS_Store +0 -0
  168. package/core/images/.DS_Store +0 -0
  169. package/preview/vendor/bundle/ruby/3.0.0/bundler/gems/ably-ui-abffd210ec0f/preview/tmp/.keep +0 -0
  170. package/preview/vendor/bundle/ruby/3.0.0/bundler/gems/ably-ui-abffd210ec0f/preview/tmp/pids/.keep +0 -0
  171. package/src/.DS_Store +0 -0
  172. package/src/core/.DS_Store +0 -0
  173. package/src/core/fonts/.DS_Store +0 -0
  174. package/src/core/images/.DS_Store +0 -0
  175. package/src/reset/.DS_Store +0 -0
  176. /package/src/core/{MeganavContentPlatform → DropdownMenu}/component.js +0 -0
  177. /package/{preview/vendor/bundle/ruby/3.0.0/bundler/gems/ably-ui-abffd210ec0f/preview/log/.keep → src/core/MeganavContentProducts/component.js} +0 -0
package/core/styles.css CHANGED
@@ -47,6 +47,8 @@
47
47
  --icon-color-glassdoor: #0baa41;
48
48
  --icon-color-github: #000000;
49
49
  --icon-color-discord: #5865f2;
50
+ --icon-color-stackoverflow: #f48024;
51
+ --icon-color-youtube: #ff0000;
50
52
 
51
53
  --gradient-active-orange: linear-gradient(
52
54
  61.2deg,
@@ -345,7 +347,7 @@
345
347
 
346
348
  .ui-text-h4 {
347
349
  @apply font-sans font-medium text-cool-black;
348
- @apply text-h4 uppercase;
350
+ @apply text-h4;
349
351
  @apply tracking-widen-0.1;
350
352
  }
351
353
 
@@ -543,12 +545,6 @@
543
545
  color: #76767c;
544
546
  }
545
547
 
546
- .ui-textarea:-ms-input-placeholder {
547
- /* CSS vars don't work in ::placeholder in Webkit :( */
548
- /* color: var(--text-dark-grey); */
549
- color: #76767c;
550
- }
551
-
552
548
  .ui-textarea::placeholder {
553
549
  /* CSS vars don't work in ::placeholder in Webkit :( */
554
550
  /* color: var(--text-dark-grey); */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ably/ui",
3
- "version": "8.7.0-dev.4e08581",
3
+ "version": "8.7.0-dev.52da22c",
4
4
  "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,13 +27,13 @@
27
27
  "change-case": "^4.1.1",
28
28
  "commander": "^7.2.0",
29
29
  "css-loader": "^5.0.0",
30
- "cypress": "^6.4.0",
31
- "cypress-plugin-snapshots": "^1.4.4",
30
+ "cypress": "^13.3.1",
32
31
  "eslint": "^7.12.1",
33
32
  "eslint-config-prettier": "^6.15.0",
34
33
  "eslint-plugin-cypress": "^2.11.2",
35
34
  "eslint-plugin-react": "^7.21.5",
36
35
  "extra-watch-webpack-plugin": "^1.0.3",
36
+ "find-imports": "^1.1.0",
37
37
  "mini-css-extract-plugin": "^1.2.1",
38
38
  "null-loader": "^4.0.1",
39
39
  "postcss": "^8.1.10",
@@ -64,17 +64,18 @@
64
64
  "release": "./scripts/release.sh"
65
65
  },
66
66
  "dependencies": {
67
+ "@mrtkrcm/cypress-plugin-snapshots": "https://github.com/mrtkrcm/cypress-plugin-snapshots#v1.13.0",
67
68
  "addsearch-js-client": "^0.7.0",
68
69
  "array-flat-polyfill": "^1.0.1",
69
70
  "dompurify": "^2.2.9",
70
71
  "highlight.js": "^10.7.2",
72
+ "highlightjs-curl": "^1.3.0",
71
73
  "js-cookie": "^2.2.1",
72
- "lodash.debounce": "^4.0.8",
73
74
  "lodash.throttle": "^4.1.1",
74
75
  "nanoid": "^4.0.0",
75
76
  "prop-types": "^15.7.2",
76
- "react": "^17.0.1",
77
- "react-dom": "^17.0.1",
77
+ "react": "^18.2.0",
78
+ "react-dom": "^18.2.0",
78
79
  "redux": "^4.0.5",
79
80
  "scroll-lock": "^2.1.4"
80
81
  },
package/reset/scripts.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AblyUi=t():(e.AblyUi=e.AblyUi||{},e.AblyUi.Reset=t())}(this,(function(){return(()=>{"use strict";var e={};return(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e),e})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AblyUi=t():(e.AblyUi=e.AblyUi||{},e.AblyUi.Reset=t())}(this,(()=>(()=>{"use strict";var e={};return(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e),e})()));
package/reset/styles.css CHANGED
@@ -86,8 +86,7 @@
86
86
  abbr[title] {
87
87
  border-bottom: none; /* 1 */
88
88
  text-decoration: underline; /* 2 */
89
- -webkit-text-decoration: underline dotted;
90
- text-decoration: underline dotted; /* 2 */
89
+ text-decoration: underline dotted; /* 2 */
91
90
  }
92
91
 
93
92
  /**
@@ -444,19 +443,10 @@
444
443
  resize: vertical;
445
444
  }
446
445
 
447
- input:-ms-input-placeholder,
448
- textarea:-ms-input-placeholder {
449
- color: #a0aec0;
450
- }
451
-
452
446
  input::-moz-placeholder, textarea::-moz-placeholder {
453
447
  color: #a0aec0;
454
448
  }
455
449
 
456
- input:-ms-input-placeholder, textarea:-ms-input-placeholder {
457
- color: #a0aec0;
458
- }
459
-
460
450
  input::placeholder,
461
451
  textarea::placeholder {
462
452
  color: #a0aec0;
@@ -1,67 +1 @@
1
- @import "../fonts/source-code-pro.css";
2
-
3
- @layer components {
4
- .hljs {
5
- background: var(--syntax-black);
6
- color: var(--syntax-light-grey);
7
- }
8
-
9
- .hljs-emphasis {
10
- font-style: italic;
11
- }
12
-
13
- .hljs-strong {
14
- font-weight: bold;
15
- }
16
-
17
- .hljs-comment,
18
- .hljs-quote {
19
- color: var(--syntax-dark-grey);
20
- }
21
-
22
- .hljs-variable,
23
- .hljs-template-variable,
24
- .hljs-tag,
25
- .hljs-name,
26
- .hljs-selector-id,
27
- .hljs-selector-class,
28
- .hljs-regexp,
29
- .hljs-deletion {
30
- color: var(--syntax-red);
31
- }
32
-
33
- .hljs-number,
34
- .hljs-built_in,
35
- .hljs-literal,
36
- .hljs-type,
37
- .hljs-params,
38
- .hljs-meta,
39
- .hljs-link {
40
- color: var(--syntax-orange);
41
- }
42
-
43
- .hljs-attribute {
44
- color: var(--syntax-yellow);
45
- }
46
-
47
- .hljs-string,
48
- .hljs-symbol,
49
- .hljs-bullet,
50
- .hljs-addition {
51
- color: var(--syntax-green);
52
- }
53
-
54
- .hljs-title,
55
- .hljs-section {
56
- color: var(--syntax-blue);
57
- }
58
-
59
- .hljs-keyword,
60
- .hljs-selector-tag {
61
- color: var(--syntax-lilac);
62
- }
63
-
64
- .hljs-subst {
65
- color: var(--syntax-mid-grey);
66
- }
67
- }
1
+ @import "../utils/syntax-highlighter.css";
@@ -1,47 +1,17 @@
1
1
  import "./component.css";
2
- import hljs from "highlight.js/lib/core";
3
2
 
4
- import bash from "highlight.js/lib/languages/bash";
5
- import cpp from "highlight.js/lib/languages/cpp";
6
- import csharp from "highlight.js/lib/languages/csharp";
7
- import dart from "highlight.js/lib/languages/dart";
8
- import plaintext from "highlight.js/lib/languages/plaintext";
9
- import go from "highlight.js/lib/languages/go";
10
- import java from "highlight.js/lib/languages/java";
11
- import javascript from "highlight.js/lib/languages/javascript";
12
- import json from "highlight.js/lib/languages/json";
13
- import objectivec from "highlight.js/lib/languages/objectivec";
14
- import php from "highlight.js/lib/languages/php";
15
- import python from "highlight.js/lib/languages/python";
16
- import ruby from "highlight.js/lib/languages/ruby";
17
- import swift from "highlight.js/lib/languages/swift";
18
- import xml from "highlight.js/lib/languages/xml";
3
+ // Note: importing syntax-highlighter here means the component.js file will include
4
+ // all the language dependecies, creating a large a bundle. Prefer using the highlighter serverside.
5
+ import {
6
+ highlightSnippet,
7
+ registerDefaultLanguages,
8
+ } from "../utils/syntax-highlighter";
19
9
 
20
- // Supported languages need to be imported here
21
- // https://github.com/highlightjs/highlight.js/blob/master/SUPPORTED_LANGUAGES.md
22
- const register = [
23
- { label: "", key: "plaintext", module: plaintext },
24
- { label: "JS", key: "javascript", module: javascript },
25
- { label: "Java", key: "java", module: java },
26
- { label: "Ruby", key: "ruby", module: ruby },
27
- { label: "Python", key: "python", module: python },
28
- { label: "PHP", key: "php", module: php },
29
- { label: "Shell", key: "bash", module: bash },
30
- { label: "C#", key: "cs", module: csharp },
31
- { label: "Go", key: "go", module: go },
32
- { label: "HTML", key: "xml", module: xml },
33
- { label: "C++", key: "cpp", module: cpp },
34
- { label: "Dart", key: "dart", module: dart },
35
- { label: "Swift", key: "swift", module: swift },
36
- { label: "Objective C", key: "objectivec", module: objectivec },
37
- { label: "Node.js", key: "javascript", module: javascript },
38
- { label: "JSON", key: "json", module: json },
39
- ];
10
+ import languagesRegistry from "../utils/syntax-highlighter-registry";
40
11
 
41
- // Initialize a sub-set of languages as used
42
- register.forEach(({ key, module }) => hljs.registerLanguage(key, module));
12
+ registerDefaultLanguages(languagesRegistry);
43
13
 
44
- function convertCodeToHTML(el) {
14
+ function highlightEl(el) {
45
15
  if (!el) throw "Missing code element";
46
16
 
47
17
  const pre = el.querySelector("pre");
@@ -51,14 +21,9 @@ function convertCodeToHTML(el) {
51
21
  if (!code || !pre || !language) throw "Malformed code element";
52
22
 
53
23
  const { innerHTML } = code;
54
- const html = hljs.highlight(innerHTML, { language }).value;
24
+ const html = highlightSnippet(language, innerHTML);
55
25
 
56
26
  code.innerHTML = html;
57
27
  }
58
28
 
59
- function highlight(language, snippet) {
60
- return hljs.highlight(snippet, { language }).value;
61
- }
62
-
63
- export { highlight };
64
- export default convertCodeToHTML;
29
+ export default highlightEl;
@@ -1,12 +1,16 @@
1
1
  import React from "react";
2
2
  import T from "prop-types";
3
3
 
4
- import "./component.css";
5
- import { highlight } from "./component.js";
4
+ import "../utils/syntax-highlighter.css";
5
+ import { highlightSnippet, registerDefaultLanguages } from "../utils/syntax-highlighter";
6
+ import languagesRegistry from "../utils/syntax-highlighter-registry";
7
+
8
+ registerDefaultLanguages(languagesRegistry);
6
9
 
7
10
  const Code = ({ language, snippet, textSize = "ui-text-code", padding = "p-32", additionalCSS = "" }) => {
8
- const HTMLraw = highlight(language, `${snippet}`.trim());
11
+ const HTMLraw = highlightSnippet(language, `${snippet}`.trim());
9
12
  const className = `language-${language} ${textSize}`;
13
+
10
14
  return (
11
15
  <div className={`hljs overflow-auto ${padding} ${additionalCSS}`} data-id="code">
12
16
  <pre lang={language}>
@@ -0,0 +1,112 @@
1
+ import React, { createContext, useContext, useState, useEffect, useRef } from "react";
2
+ import T from "prop-types";
3
+ import Icon from "../Icon/component.jsx";
4
+
5
+ const DropdownMenuContext = createContext();
6
+
7
+ const DropdownMenu = ({ children }) => {
8
+ const [isOpen, setOpen] = useState(false);
9
+ const ref = useRef(null);
10
+
11
+ useEffect(() => {
12
+ const clickHandler = (e) => {
13
+ if (ref?.current?.contains(e.target)) return;
14
+ setOpen(false);
15
+ };
16
+
17
+ document.addEventListener("click", clickHandler);
18
+
19
+ return () => {
20
+ document.removeEventListener("click", clickHandler);
21
+ };
22
+ }, []);
23
+
24
+ return (
25
+ <DropdownMenuContext.Provider value={{ isOpen, setOpen }}>
26
+ <div id="dropdown-menu" className="relative" ref={ref}>
27
+ {children}
28
+ </div>
29
+ </DropdownMenuContext.Provider>
30
+ );
31
+ };
32
+
33
+ DropdownMenu.propTypes = {
34
+ children: T.node,
35
+ };
36
+
37
+ const Trigger = ({ children, additionalTriggerCSS = "" }) => {
38
+ const { isOpen, setOpen } = useContext(DropdownMenuContext);
39
+
40
+ return (
41
+ <button
42
+ id="menu-trigger"
43
+ onClick={() => setOpen(!isOpen)}
44
+ className={`${additionalTriggerCSS} flex items-center p-8 ml-8 group hover:text-gui-hover hover:bg-light-grey active:text-gui-active focus:text-gui-focus focus:outline-none rounded-lg`}
45
+ >
46
+ <span className="leading-normal">{children}</span>
47
+ <Icon
48
+ name="icon-gui-disclosure-arrow"
49
+ color="text-cool-black"
50
+ size="1.25rem"
51
+ additionalCSS="transform rotate-90 group-hover:text-gui-hover group-active:text-gui-active group-focus:text-gui-focus"
52
+ />
53
+ </button>
54
+ );
55
+ };
56
+
57
+ Trigger.propTypes = {
58
+ children: T.node,
59
+ additionalTriggerCSS: T.string,
60
+ };
61
+
62
+ const Content = ({ children, anchorPosition = "right", additionalContentCSS }) => {
63
+ const { isOpen } = useContext(DropdownMenuContext);
64
+
65
+ if (!isOpen) {
66
+ return null;
67
+ }
68
+
69
+ const anchorPositionClasses = anchorPosition === "right" ? "right-0" : "left-0";
70
+
71
+ return (
72
+ <div
73
+ id="menu-content"
74
+ className={`${additionalContentCSS} absolute p-8 z-10 border border-mid-grey bg-white rounded shadow-container ${anchorPositionClasses}`}
75
+ style={{ minWidth: 275, top: 44 }}
76
+ >
77
+ {children}
78
+ </div>
79
+ );
80
+ };
81
+
82
+ Content.propTypes = {
83
+ children: T.node,
84
+ anchorPosition: T.string,
85
+ additionalContentCSS: T.string,
86
+ };
87
+
88
+ const Link = ({ url, title, subtitle, iconName, children }) => {
89
+ return (
90
+ <a href={url} className="menu-link group block p-8 hover:bg-light-grey hover:text-cool-black rounded">
91
+ <p className="mb-4">
92
+ {title}
93
+ {iconName ? <Icon name={iconName} size="1rem" color="text-cool-black" additionalCSS="align-middle ml-8 relative -top-1 -left-4" /> : null}
94
+ </p>
95
+ {subtitle ? <p className="text-p3 mb-16 text-dark-grey">{subtitle}</p> : null}
96
+ {children}
97
+ </a>
98
+ );
99
+ };
100
+
101
+ Link.propTypes = {
102
+ url: T.string,
103
+ title: T.string,
104
+ subtitle: T.string,
105
+ iconName: T.string,
106
+ children: T.node,
107
+ };
108
+
109
+ DropdownMenu.Trigger = Trigger;
110
+ DropdownMenu.Content = Content;
111
+ DropdownMenu.Link = Link;
112
+ export default DropdownMenu;
@@ -46,7 +46,7 @@
46
46
  </ul>
47
47
  </span>
48
48
  <span class="flex-0">
49
- <%= link_to 'Start with a free account', abs_url("/sign-up"), class: "ui-btn-secondary self-start mt-24" %>
49
+ <%= link_to 'Start building', abs_url("/sign-up"), class: "ui-btn-secondary self-start mt-24" %>
50
50
  </span>
51
51
  </div>
52
52
  </div>
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect, useState, useRef } from "react";
2
2
  import DOMPurify from "dompurify";
3
3
  import T from "prop-types";
4
+ import { nanoid } from "nanoid/non-secure";
4
5
 
5
6
  import { getRemoteDataStore } from "../remote-data-store";
6
7
  import ConnectStateWrapper from "../ConnectStateWrapper/component.jsx";
@@ -50,30 +51,45 @@ const FLASH_TEXT_COLOR = {
50
51
  const AUTO_HIDE = ["success", "info", "notice"];
51
52
  const AUTO_HIDE_TIME = 8000;
52
53
 
53
- const Flash = ({ type, content }) => {
54
- const ref = useRef(null);
55
- const [closed, setClosed] = useState(false);
56
- const [flashHeight, setFlashHeight] = useState(0);
57
- const [triggerEntryAnimation, setTriggerEntryAnimation] = useState(false);
54
+ const useAutoHide = (type, closeFlash) => {
55
+ const timeoutId = useRef(null);
58
56
 
59
- useEffect(() => setTriggerEntryAnimation(true), []);
60
57
  useEffect(() => {
61
58
  if (AUTO_HIDE.includes(type)) {
62
- setTimeout(() => {
63
- // closeFlash is idempotent, we can call it even if the flash has been already closed
59
+ timeoutId.current = setTimeout(() => {
64
60
  closeFlash();
65
61
  }, AUTO_HIDE_TIME);
66
62
  }
67
- }, [closed]);
63
+
64
+ return () => {
65
+ if (timeoutId.current) {
66
+ clearTimeout(timeoutId.current);
67
+ }
68
+ };
69
+ }, []);
70
+ };
71
+
72
+ const Flash = ({ id, type, content, removeFlash }) => {
73
+ const ref = useRef(null);
74
+ const [closed, setClosed] = useState(false);
75
+ const [flashHeight, setFlashHeight] = useState(0);
76
+ const [triggerEntryAnimation, setTriggerEntryAnimation] = useState(false);
68
77
 
69
78
  const closeFlash = () => {
70
79
  if (ref.current) {
71
80
  setFlashHeight(ref.current.getBoundingClientRect().height);
72
81
  }
73
82
 
74
- setTimeout(() => setClosed(true), 0);
83
+ setClosed(true);
84
+
85
+ setTimeout(() => {
86
+ removeFlash(id);
87
+ }, 100);
75
88
  };
76
89
 
90
+ useEffect(() => setTriggerEntryAnimation(true), []);
91
+ useAutoHide(type, closeFlash);
92
+
77
93
  const animateEntry = triggerEntryAnimation && !closed;
78
94
 
79
95
  let style;
@@ -123,13 +139,23 @@ Flash.propTypes = {
123
139
  };
124
140
 
125
141
  const Flashes = ({ flashes }) => {
126
- const items = flashes?.items || [];
142
+ const [flashesWithIds, setFlashesWithIds] = useState([]);
143
+
144
+ const removeFlash = (flashId) => setFlashesWithIds((items) => items.filter((item) => item.id !== flashId));
145
+
146
+ useEffect(() => {
147
+ setFlashesWithIds((state) => {
148
+ return [...state, ...(flashes?.items || []).map((flash) => ({ ...flash, id: nanoid(), removed: false }))];
149
+ });
150
+ }, [flashes]);
127
151
 
128
152
  return (
129
153
  <div className="ui-flash" data-id={FLASH_DATA_ID}>
130
- {items.map((flash) => (
131
- <Flash key={flash.type} {...flash} />
132
- ))}
154
+ {flashesWithIds
155
+ .filter((item) => !item.removed)
156
+ .map((flash) => (
157
+ <Flash removeFlash={removeFlash} key={flash.id} {...flash} />
158
+ ))}
133
159
  </div>
134
160
  );
135
161
  };
@@ -8,6 +8,26 @@
8
8
  }
9
9
 
10
10
  .ui-footer-link {
11
- @apply text-gui-default hover:text-gui-hover hover:underline text-menu3 font-light;
11
+ @apply text-gui-default hover:text-gui-hover text-menu3 font-light;
12
+ }
13
+
14
+ .ui-footer-compliance-text {
15
+ font-size: 12px;
16
+ }
17
+
18
+ .ui-footer-tick-icon {
19
+ min-width: 1.5rem;
20
+ }
21
+
22
+ @media (max-width: 1040px) {
23
+ .ui-footer-bottom-links {
24
+ @apply pb-40;
25
+ }
26
+ }
27
+
28
+ @media screen {
29
+ .ui-footer-glassdoor {
30
+ display: none;
31
+ }
12
32
  }
13
33
  }