@ably/ui 8.6.0 → 8.7.0-dev.28a63f9
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.
- package/README.md +1 -1
- package/core/Code/component.css +3 -3
- package/core/Code/component.js +1 -1
- package/core/Code.jsx +353 -7273
- package/core/CompanyAutocomplete/component.js +1 -1
- package/core/ConnectStateWrapper.jsx +13 -4
- package/core/ContactFooter.jsx +13 -119
- package/core/CookieMessage.jsx +21 -293
- package/core/CustomerLogos.jsx +15 -117
- package/core/DropdownMenu/component.js +1 -0
- package/core/DropdownMenu.jsx +313 -0
- package/core/FeaturedLink.jsx +10 -116
- package/core/Flash.jsx +155 -1536
- package/core/Footer.jsx +17 -123
- package/core/Icon.jsx +9 -114
- package/core/Loader.jsx +9 -114
- package/core/Logo.jsx +36 -226
- package/core/Meganav/component.js +1 -2
- package/core/Meganav.jsx +2837 -10168
- package/core/MeganavBlogPostsList/component.js +1 -1
- package/core/MeganavBlogPostsList.jsx +11 -118
- package/core/MeganavContentCompany.jsx +31 -124
- package/core/MeganavContentDevelopers.jsx +32 -126
- package/core/MeganavContentPlatform.jsx +11 -118
- package/core/MeganavContentUseCases.jsx +24 -118
- package/core/MeganavContentWhyAbly/component.js +22 -0
- package/core/MeganavContentWhyAbly.jsx +3279 -0
- package/core/MeganavControl.jsx +10 -116
- package/core/MeganavControlMobileDropdown/component.js +1 -1
- package/core/MeganavControlMobileDropdown.jsx +10 -116
- package/core/MeganavControlMobilePanelClose.jsx +10 -116
- package/core/MeganavControlMobilePanelOpen.jsx +10 -116
- package/core/MeganavItemsDesktop.jsx +13 -121
- package/core/MeganavItemsMobile.jsx +18 -132
- package/core/MeganavItemsSignedIn.jsx +16 -129
- package/core/MeganavSearch.jsx +13 -123
- package/core/MeganavSearchAutocomplete/component.js +1 -2
- package/core/MeganavSearchPanel.jsx +12 -121
- package/core/MeganavSearchSuggestions.jsx +11 -118
- package/core/Notice/component.js +1 -2
- package/core/Notice.jsx +189 -2190
- package/core/SignOutLink.jsx +9 -114
- package/core/Slider/component.js +1 -1
- package/core/Slider.jsx +25 -582
- package/core/Uptime.jsx +15 -118
- package/core/images/ably-logo.png +0 -0
- package/core/scripts.js +1 -1
- package/core/sprites.svg +57 -1
- package/core/styles.css +6 -5
- package/package.json +4 -4
- package/src/core/Code/component.css +1 -67
- package/src/core/Code/component.js +11 -46
- package/src/core/Code/component.jsx +7 -3
- package/src/core/CustomerLogos/component.html.erb +2 -2
- package/src/core/CustomerLogos/component.jsx +3 -2
- package/src/core/CustomerLogos/component.rb +2 -1
- package/src/core/DropdownMenu/component.js +0 -0
- package/src/core/DropdownMenu/component.jsx +112 -0
- package/src/core/FeatureFooter/component.html.erb +4 -4
- package/src/core/Flash/component.jsx +42 -18
- package/src/core/Logo/component.html.erb +2 -27
- package/src/core/Logo/component.jsx +7 -40
- package/src/core/Logo/component.rb +15 -6
- package/src/core/Meganav/component.html.erb +1 -1
- package/src/core/Meganav/component.jsx +1 -1
- package/src/core/Meganav/component.rb +1 -0
- package/src/core/MeganavContentDevelopers/component.html.erb +14 -5
- package/src/core/MeganavContentDevelopers/component.jsx +18 -9
- package/src/core/MeganavContentUseCases/component.html.erb +10 -1
- package/src/core/MeganavContentUseCases/component.jsx +10 -1
- package/src/core/MeganavSearchSuggestions/component.html.erb +1 -1
- package/src/core/core.rb +4 -0
- package/src/core/icons/github.svg +1 -1
- package/src/core/icons/google.svg +3 -0
- package/src/core/icons/icon-display-chat-col.svg +4 -0
- package/src/core/icons/icon-display-integrations-col.svg +8 -0
- package/src/core/icons/icon-gui-check-circled-fill-black.svg +4 -0
- package/src/core/icons/icon-gui-filter-flow-step-1.svg +5 -0
- package/src/core/icons/icon-gui-filter-flow-step-2.svg +5 -0
- package/src/core/icons/icon-gui-filter-flow-step-3.svg +5 -0
- package/src/core/icons/icon-gui-link.svg +4 -0
- package/src/core/icons/icon-gui-resources.svg +3 -0
- package/src/core/icons/icon-multi-user-spaces-col.svg +13 -0
- package/src/core/icons/stackoverflow.svg +3 -0
- package/src/core/icons/youtube.svg +11 -0
- package/src/core/images/ably-logo.png +0 -0
- package/src/core/styles/properties.css +2 -0
- package/src/core/styles/text.css +4 -5
- package/src/core/utils/syntax-highlighter-registry.js +61 -0
- package/src/core/utils/syntax-highlighter.css +69 -0
- package/src/core/utils/syntax-highlighter.js +98 -0
- package/tailwind.config.js +1 -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,
|
|
@@ -467,16 +469,15 @@
|
|
|
467
469
|
}
|
|
468
470
|
|
|
469
471
|
.ui-link {
|
|
470
|
-
@apply
|
|
472
|
+
@apply text-gui-default;
|
|
471
473
|
@apply hover:text-gui-hover active:text-gui-active disabled:text-gui-unavailable;
|
|
472
|
-
@apply focus:text-gui-
|
|
473
|
-
@apply underline;
|
|
474
|
+
@apply focus:text-gui-default focus:outline-gui-focus;
|
|
475
|
+
@apply no-underline;
|
|
474
476
|
}
|
|
475
477
|
|
|
476
478
|
.ui-link-neutral {
|
|
477
|
-
@apply visited:text-dark-grey;
|
|
478
479
|
@apply hover:text-dark-grey active:text-cool-black disabled:text-gui-unavailable;
|
|
479
|
-
@apply focus:text-
|
|
480
|
+
@apply focus:text-charcoal-grey focus:outline-gui-focus-neutral;
|
|
480
481
|
@apply underline;
|
|
481
482
|
}
|
|
482
483
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ably/ui",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0-dev.28a63f9",
|
|
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",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"eslint-plugin-cypress": "^2.11.2",
|
|
35
35
|
"eslint-plugin-react": "^7.21.5",
|
|
36
36
|
"extra-watch-webpack-plugin": "^1.0.3",
|
|
37
|
+
"find-imports": "^1.1.0",
|
|
37
38
|
"mini-css-extract-plugin": "^1.2.1",
|
|
38
39
|
"null-loader": "^4.0.1",
|
|
39
40
|
"postcss": "^8.1.10",
|
|
@@ -42,7 +43,6 @@
|
|
|
42
43
|
"postcss-import": "^13.0.0",
|
|
43
44
|
"postcss-loader": "^4.0.4",
|
|
44
45
|
"prettier": "^2.3.0",
|
|
45
|
-
"prop-types": "^15.7.2",
|
|
46
46
|
"svg-spritemap-webpack-plugin": "^3.7.1",
|
|
47
47
|
"tailwindcss": "^2.0.1",
|
|
48
48
|
"tailwindcss-filters": "^3.0.0",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"addsearch-js-client": "^0.7.0",
|
|
69
69
|
"array-flat-polyfill": "^1.0.1",
|
|
70
|
-
"deepmerge": "^4.2.2",
|
|
71
70
|
"dompurify": "^2.2.9",
|
|
72
71
|
"highlight.js": "^10.7.2",
|
|
72
|
+
"highlightjs-curl": "^1.3.0",
|
|
73
73
|
"js-cookie": "^2.2.1",
|
|
74
|
-
"lodash.debounce": "^4.0.8",
|
|
75
74
|
"lodash.throttle": "^4.1.1",
|
|
76
75
|
"nanoid": "^4.0.0",
|
|
76
|
+
"prop-types": "^15.7.2",
|
|
77
77
|
"react": "^17.0.1",
|
|
78
78
|
"react-dom": "^17.0.1",
|
|
79
79
|
"redux": "^4.0.5",
|
|
@@ -1,67 +1 @@
|
|
|
1
|
-
@import "../
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
register.forEach(({ key, module }) => hljs.registerLanguage(key, module));
|
|
12
|
+
registerDefaultLanguages(languagesRegistry);
|
|
43
13
|
|
|
44
|
-
function
|
|
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 =
|
|
24
|
+
const html = highlightSnippet(language, innerHTML);
|
|
55
25
|
|
|
56
26
|
code.innerHTML = html;
|
|
57
27
|
}
|
|
58
28
|
|
|
59
|
-
|
|
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 "
|
|
5
|
-
import {
|
|
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 =
|
|
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}>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<section class="w-full bg-white">
|
|
2
|
-
|
|
2
|
+
<%= tag.ul class: "py-64 flex flex-row flex-wrap md:flex-nowrap content-between m-auto items-center #{@additional_css}" do %>
|
|
3
3
|
<% companies.each do |company| %>
|
|
4
4
|
<li class="flex-auto text-center sm:w-1/3 w-1/2">
|
|
5
5
|
<%= image_tag company[:logo], alt: "#{company[:label]} logo", class: 'mx-auto' %>
|
|
6
6
|
</li>
|
|
7
7
|
<% end %>
|
|
8
|
-
|
|
8
|
+
<% end %>
|
|
9
9
|
</section>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import T from "prop-types";
|
|
3
3
|
|
|
4
|
-
const CustomerLogos = ({ companies }) => {
|
|
4
|
+
const CustomerLogos = ({ companies, additionalCss = "" }) => {
|
|
5
5
|
return (
|
|
6
6
|
<section className="w-full bg-white">
|
|
7
|
-
<ul className=
|
|
7
|
+
<ul className={`py-64 flex flex-row flex-wrap md:flex-nowrap content-between m-auto items-center ${additionalCss}`}>
|
|
8
8
|
{companies.map((company) => (
|
|
9
9
|
<li key={company.label} className="flex-auto text-center sm:w-1/3 w-1/2">
|
|
10
10
|
<img alt={company.label} src={company.logo} className="mx-auto" />
|
|
@@ -22,6 +22,7 @@ CustomerLogos.propTypes = {
|
|
|
22
22
|
logo: T.string,
|
|
23
23
|
})
|
|
24
24
|
),
|
|
25
|
+
additionalCss: T.string,
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export default CustomerLogos;
|
|
File without changes
|
|
@@ -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;
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
<ul class="relative ml-24 text-p1 font-light leading-8">
|
|
30
30
|
<li>
|
|
31
31
|
<%= render(AblyUi::Core::Icon.new(name: "icon-gui-tick", size: "1.5rem", additional_css: "align-text-bottom")) %>
|
|
32
|
-
|
|
32
|
+
6m messages per month
|
|
33
33
|
</li>
|
|
34
34
|
<li>
|
|
35
35
|
<%= render(AblyUi::Core::Icon.new(name: "icon-gui-tick", size: "1.5rem", additional_css: "align-text-bottom")) %>
|
|
36
|
-
|
|
36
|
+
200 peak connections
|
|
37
37
|
</li>
|
|
38
38
|
<li>
|
|
39
39
|
<%= render(AblyUi::Core::Icon.new(name: "icon-gui-tick", size: "1.5rem", additional_css: "align-text-bottom")) %>
|
|
40
|
-
|
|
40
|
+
200 peak channels
|
|
41
41
|
</li>
|
|
42
42
|
<li>
|
|
43
43
|
<%= render(AblyUi::Core::Icon.new(name: "icon-gui-tick", size: "1.5rem", additional_css: "align-text-bottom")) %>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
</ul>
|
|
47
47
|
</span>
|
|
48
48
|
<span class="flex-0">
|
|
49
|
-
<%= link_to 'Start
|
|
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
|
|
54
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -110,10 +126,8 @@ const Flash = ({ type, content }) => {
|
|
|
110
126
|
<div className={`${FLASH_BG_COLOR[type]} p-32 flex align-center rounded shadow-container-subtle`}>
|
|
111
127
|
{withIcons[type] && <Icon name={withIcons[type]} color={iconColor[type]} size="1.5rem" additionalCSS="mr-16 self-baseline" />}
|
|
112
128
|
<p className={`ui-flash-text ${FLASH_TEXT_COLOR[type]}`} dangerouslySetInnerHTML={{ __html: safeContent }} />
|
|
113
|
-
<button type="button" className="p-0 ml-auto self-start" onClick={closeFlash}>
|
|
114
|
-
<
|
|
115
|
-
<use xlinkHref="#sprite-close"></use>
|
|
116
|
-
</svg>
|
|
129
|
+
<button type="button" className="p-0 ml-auto self-start focus:outline-none" onClick={closeFlash}>
|
|
130
|
+
<Icon name="icon-gui-close" color={iconColor[type]} size="1.5rem" additionalCSS="transition-colors" />
|
|
117
131
|
</button>
|
|
118
132
|
</div>
|
|
119
133
|
</div>
|
|
@@ -125,13 +139,23 @@ Flash.propTypes = {
|
|
|
125
139
|
};
|
|
126
140
|
|
|
127
141
|
const Flashes = ({ flashes }) => {
|
|
128
|
-
const
|
|
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]);
|
|
129
151
|
|
|
130
152
|
return (
|
|
131
153
|
<div className="ui-flash" data-id={FLASH_DATA_ID}>
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
154
|
+
{flashesWithIds
|
|
155
|
+
.filter((item) => !item.removed)
|
|
156
|
+
.map((flash) => (
|
|
157
|
+
<Flash removeFlash={removeFlash} key={flash.id} {...flash} />
|
|
158
|
+
))}
|
|
135
159
|
</div>
|
|
136
160
|
);
|
|
137
161
|
};
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
<%= link_to logo_href, class: '
|
|
2
|
-
<%= tag.
|
|
3
|
-
<path
|
|
4
|
-
d="M62.922 24.9786V4.08813H66.6933V11.6512C67.9709 10.435 69.6164 9.76044 71.3538 9.76044C75.4318 9.76044 79.0498 12.8674 79.0498 17.5484C79.0498 22.2293 75.4318 25.3465 71.3538 25.3465C69.5244 25.3465 67.7971 24.6209 66.5094 23.3024V24.9786H62.922ZM75.2785 17.5484C75.2785 14.932 73.4183 13.1025 70.9859 13.1025C68.6148 13.1025 66.7853 14.84 66.6933 17.3644V17.5484C66.6933 20.1648 68.5534 21.9942 70.9859 21.9942C73.4183 21.9942 75.2785 20.1648 75.2785 17.5484ZM80.7975 24.9786V4.08813H84.5688V24.9786H80.7975ZM89.8425 30.3954L92.0399 25.1523L86.0712 10.1284H90.1491L93.9511 20.6247L97.8144 10.1284H101.954L93.8591 30.4056H89.8425V30.3954ZM56.9329 10.1284V12.0191C55.6247 10.5883 53.7952 9.77066 51.9147 9.77066C47.8367 9.77066 44.2187 12.8777 44.2187 17.5586C44.2187 22.2497 47.8367 25.3465 51.9147 25.3465C53.8668 25.3465 55.7166 24.4982 57.0555 22.9754V24.9888H60.3465V10.1284H56.9329ZM56.5649 17.5484C56.5649 20.1341 54.7048 21.9942 52.2724 21.9942C49.8399 21.9942 47.9798 20.1341 47.9798 17.5484C47.9798 14.9626 49.8399 13.1025 52.2724 13.1025C54.6435 13.1025 56.473 14.8706 56.5649 17.3644V17.5484Z"
|
|
5
|
-
fill="currentColor"
|
|
6
|
-
/>
|
|
7
|
-
<path d="M19.2858 0L3.14788 29.5369L0 27.3293L14.932 0H19.2858ZM19.5107 0L35.6487 29.5369L38.7965 27.3293L23.8646 0H19.5107Z" fill="url(#<%= gradient_id_0 %>)" />
|
|
8
|
-
<path d="M35.4238 29.7107L19.3983 17.16L3.37271 29.7107L6.64323 32L19.3983 22.0147L32.1533 32L35.4238 29.7107Z" fill="url(#<%= gradient_id_1 %>)" />
|
|
9
|
-
<defs>
|
|
10
|
-
<linearGradient id="<%= gradient_id_0 %>" x1="5.47361" y1="37.4219" x2="32.4603" y2="7.45023" gradientUnits="userSpaceOnUse">
|
|
11
|
-
<stop stop-color="#FF5416" />
|
|
12
|
-
<stop offset="0.2535" stop-color="#FF5115" />
|
|
13
|
-
<stop offset="0.461" stop-color="#FF4712" />
|
|
14
|
-
<stop offset="0.6523" stop-color="#FF350E" />
|
|
15
|
-
<stop offset="0.8327" stop-color="#FF1E08" />
|
|
16
|
-
<stop offset="1" stop-color="#FF0000" />
|
|
17
|
-
</linearGradient>
|
|
18
|
-
<linearGradient id="<%= gradient_id_1 %>" x1="10.7084" y1="39.3593" x2="26.6583" y2="21.6452" gradientUnits="userSpaceOnUse">
|
|
19
|
-
<stop stop-color="#FF5416" />
|
|
20
|
-
<stop offset="0.2535" stop-color="#FF5115" />
|
|
21
|
-
<stop offset="0.461" stop-color="#FF4712" />
|
|
22
|
-
<stop offset="0.6523" stop-color="#FF350E" />
|
|
23
|
-
<stop offset="0.8327" stop-color="#FF1E08" />
|
|
24
|
-
<stop offset="1" stop-color="#FF0000" />
|
|
25
|
-
</linearGradient>
|
|
26
|
-
</defs>
|
|
27
|
-
<% end %>
|
|
1
|
+
<%= link_to logo_href, class: 'block', style: "height: 2.125rem", data: { id: data_id }, **additional_link_attrs do %>
|
|
2
|
+
<%= tag.img src: logo_url, width: "108px", alt: "Ably logo", **additional_img_attrs %>
|
|
28
3
|
<% end %>
|
|
@@ -1,46 +1,10 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import T from "prop-types";
|
|
3
|
-
import { nanoid } from "nanoid/non-secure";
|
|
4
|
-
|
|
5
|
-
const Logo = ({ dataId, href = "/" }) => {
|
|
6
|
-
// This fixes a bug where if the logo is rendered more than once on the page, and one of the instances
|
|
7
|
-
// if it is hidden, the other instance will not show the ably shape from the logo.
|
|
8
|
-
|
|
9
|
-
// This is because the defs in this SVG reference ids that need to be unique ids. The browser discards the "newer"
|
|
10
|
-
// linearGradients defined in the other logo, and inherits the `hidden` style from the first.
|
|
11
|
-
const gradientIds = useMemo(() => [nanoid(), nanoid()], []);
|
|
12
3
|
|
|
4
|
+
const Logo = ({ dataId, logoUrl, href = "/", additionalImgAttrs, additionalLinkAttrs }) => {
|
|
13
5
|
return (
|
|
14
|
-
<a href={href} className="
|
|
15
|
-
<
|
|
16
|
-
<path
|
|
17
|
-
d="M62.922 24.9786V4.08813H66.6933V11.6512C67.9709 10.435 69.6164 9.76044 71.3538 9.76044C75.4318 9.76044 79.0498 12.8674 79.0498 17.5484C79.0498 22.2293 75.4318 25.3465 71.3538 25.3465C69.5244 25.3465 67.7971 24.6209 66.5094 23.3024V24.9786H62.922ZM75.2785 17.5484C75.2785 14.932 73.4183 13.1025 70.9859 13.1025C68.6148 13.1025 66.7853 14.84 66.6933 17.3644V17.5484C66.6933 20.1648 68.5534 21.9942 70.9859 21.9942C73.4183 21.9942 75.2785 20.1648 75.2785 17.5484ZM80.7975 24.9786V4.08813H84.5688V24.9786H80.7975ZM89.8425 30.3954L92.0399 25.1523L86.0712 10.1284H90.1491L93.9511 20.6247L97.8144 10.1284H101.954L93.8591 30.4056H89.8425V30.3954ZM56.9329 10.1284V12.0191C55.6247 10.5883 53.7952 9.77066 51.9147 9.77066C47.8367 9.77066 44.2187 12.8777 44.2187 17.5586C44.2187 22.2497 47.8367 25.3465 51.9147 25.3465C53.8668 25.3465 55.7166 24.4982 57.0555 22.9754V24.9888H60.3465V10.1284H56.9329ZM56.5649 17.5484C56.5649 20.1341 54.7048 21.9942 52.2724 21.9942C49.8399 21.9942 47.9798 20.1341 47.9798 17.5484C47.9798 14.9626 49.8399 13.1025 52.2724 13.1025C54.6435 13.1025 56.473 14.8706 56.5649 17.3644V17.5484Z"
|
|
18
|
-
fill="currentColor"
|
|
19
|
-
/>
|
|
20
|
-
<path
|
|
21
|
-
d="M19.2858 0L3.14788 29.5369L0 27.3293L14.932 0H19.2858ZM19.5107 0L35.6487 29.5369L38.7965 27.3293L23.8646 0H19.5107Z"
|
|
22
|
-
fill={`url(#${gradientIds[0]})`}
|
|
23
|
-
/>
|
|
24
|
-
<path d="M35.4238 29.7107L19.3983 17.16L3.37271 29.7107L6.64323 32L19.3983 22.0147L32.1533 32L35.4238 29.7107Z" fill={`url(#${gradientIds[1]})`} />
|
|
25
|
-
<defs>
|
|
26
|
-
<linearGradient id={gradientIds[0]} x1="5.47361" y1="37.4219" x2="32.4603" y2="7.45023" gradientUnits="userSpaceOnUse">
|
|
27
|
-
<stop stopColor="#FF5416" />
|
|
28
|
-
<stop offset="0.2535" stopColor="#FF5115" />
|
|
29
|
-
<stop offset="0.461" stopColor="#FF4712" />
|
|
30
|
-
<stop offset="0.6523" stopColor="#FF350E" />
|
|
31
|
-
<stop offset="0.8327" stopColor="#FF1E08" />
|
|
32
|
-
<stop offset="1" stopColor="#FF0000" />
|
|
33
|
-
</linearGradient>
|
|
34
|
-
<linearGradient id={gradientIds[1]} x1="10.7084" y1="39.3593" x2="26.6583" y2="21.6452" gradientUnits="userSpaceOnUse">
|
|
35
|
-
<stop stopColor="#FF5416" />
|
|
36
|
-
<stop offset="0.2535" stopColor="#FF5115" />
|
|
37
|
-
<stop offset="0.461" stopColor="#FF4712" />
|
|
38
|
-
<stop offset="0.6523" stopColor="#FF350E" />
|
|
39
|
-
<stop offset="0.8327" stopColor="#FF1E08" />
|
|
40
|
-
<stop offset="1" stopColor="#FF0000" />
|
|
41
|
-
</linearGradient>
|
|
42
|
-
</defs>
|
|
43
|
-
</svg>
|
|
6
|
+
<a href={href} data-id={dataId} className="block" style={{ height: "2.125rem" }} {...additionalLinkAttrs}>
|
|
7
|
+
<img src={logoUrl} width="108px" alt="Ably logo" {...additionalImgAttrs} />
|
|
44
8
|
</a>
|
|
45
9
|
);
|
|
46
10
|
};
|
|
@@ -48,6 +12,9 @@ const Logo = ({ dataId, href = "/" }) => {
|
|
|
48
12
|
Logo.propTypes = {
|
|
49
13
|
dataId: T.string,
|
|
50
14
|
href: T.string,
|
|
15
|
+
logoUrl: T.string,
|
|
16
|
+
additionalImgAttrs: T.object,
|
|
17
|
+
additionalLinkAttrs: T.object,
|
|
51
18
|
};
|
|
52
19
|
|
|
53
20
|
export default React.memo(Logo);
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
require 'securerandom'
|
|
2
|
-
|
|
3
1
|
module AblyUi
|
|
4
2
|
module Core
|
|
5
3
|
class Logo < ViewComponent::Base
|
|
6
4
|
include AblyUi::Core::MeganavConfig
|
|
7
5
|
|
|
8
|
-
attr_reader :href,
|
|
6
|
+
attr_reader :href,
|
|
7
|
+
:logo_url,
|
|
8
|
+
:data_id,
|
|
9
|
+
:additional_img_attrs,
|
|
10
|
+
:additional_link_attrs
|
|
9
11
|
|
|
10
|
-
def initialize(
|
|
12
|
+
def initialize(
|
|
13
|
+
href:,
|
|
14
|
+
logo_url:,
|
|
15
|
+
data_id: '',
|
|
16
|
+
additional_img_attrs: {},
|
|
17
|
+
additional_link_attrs: {}
|
|
18
|
+
)
|
|
11
19
|
@data_id = data_id
|
|
12
20
|
@href = href
|
|
13
|
-
@
|
|
14
|
-
@
|
|
21
|
+
@logo_url = logo_url
|
|
22
|
+
@additional_img_attrs = additional_img_attrs
|
|
23
|
+
@additional_link_attrs = additional_link_attrs
|
|
15
24
|
end
|
|
16
25
|
|
|
17
26
|
def logo_href
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
<div class="ui-meganav ui-grid-px">
|
|
5
5
|
<div className="mr-24">
|
|
6
|
-
<%= render(AblyUi::Core::Logo.new(data_id: "meganav-logo", href: logo_link)) %>
|
|
6
|
+
<%= render(AblyUi::Core::Logo.new(data_id: "meganav-logo", href: logo_link, logo_url: ably_logo)) %>
|
|
7
7
|
</div>
|
|
8
8
|
<%= render(AblyUi::Core::MeganavItemsDesktop.new(theme_name: @theme_name, url_base: url_base)) %>
|
|
9
9
|
|