@ably/ui 10.1.0 → 10.2.0
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/core/DropdownMenu.jsx +0 -4
- package/core/Flash.jsx +132 -57
- package/core/Logo.jsx +28 -113
- package/core/Meganav.jsx +166 -174
- package/core/Notice/component.js +1 -1
- package/core/Notice.jsx +133 -58
- package/core/images/ably-logo.png +0 -0
- package/core/sprites.svg +3 -3
- package/package.json +1 -1
- package/src/core/DropdownMenu/component.jsx +0 -2
- package/src/core/Flash/component.jsx +42 -14
- 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/core.rb +4 -0
- package/src/core/icons/github.svg +1 -1
- package/src/core/icons/stackoverflow.svg +1 -1
- package/src/core/icons/youtube.svg +1 -1
- package/src/core/images/ably-logo.png +0 -0
package/core/Notice.jsx
CHANGED
|
@@ -92,22 +92,55 @@ var ConnectStateWrapper = function ConnectStateWrapper(Component, selectors) {
|
|
|
92
92
|
|
|
93
93
|
/***/ }),
|
|
94
94
|
|
|
95
|
-
/***/
|
|
95
|
+
/***/ 8696:
|
|
96
96
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
|
|
99
|
+
// EXPORTS
|
|
100
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
101
|
+
"FLASH_DATA_ID": () => (/* binding */ FLASH_DATA_ID)
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// UNUSED EXPORTS: Flashes, default, reducerFlashes
|
|
105
|
+
|
|
106
|
+
// EXTERNAL MODULE: external {"commonjs":"react","commonjs2":"react"}
|
|
107
|
+
var external_commonjs_react_commonjs2_react_ = __webpack_require__(9281);
|
|
108
|
+
var external_commonjs_react_commonjs2_react_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_react_commonjs2_react_);
|
|
109
|
+
// EXTERNAL MODULE: external {"commonjs":"dompurify","commonjs2":"dompurify"}
|
|
110
|
+
var external_commonjs_dompurify_commonjs2_dompurify_ = __webpack_require__(6357);
|
|
111
|
+
var external_commonjs_dompurify_commonjs2_dompurify_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_dompurify_commonjs2_dompurify_);
|
|
112
|
+
// EXTERNAL MODULE: external {"commonjs":"prop-types","commonjs2":"prop-types"}
|
|
113
|
+
var external_commonjs_prop_types_commonjs2_prop_types_ = __webpack_require__(3474);
|
|
114
|
+
var external_commonjs_prop_types_commonjs2_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_prop_types_commonjs2_prop_types_);
|
|
115
|
+
;// CONCATENATED MODULE: ./node_modules/nanoid/non-secure/index.js
|
|
116
|
+
let urlAlphabet =
|
|
117
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
|
118
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
119
|
+
return (size = defaultSize) => {
|
|
120
|
+
let id = ''
|
|
121
|
+
let i = size
|
|
122
|
+
while (i--) {
|
|
123
|
+
id += alphabet[(Math.random() * alphabet.length) | 0]
|
|
124
|
+
}
|
|
125
|
+
return id
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
let nanoid = (size = 21) => {
|
|
129
|
+
let id = ''
|
|
130
|
+
let i = size
|
|
131
|
+
while (i--) {
|
|
132
|
+
id += urlAlphabet[(Math.random() * 64) | 0]
|
|
133
|
+
}
|
|
134
|
+
return id
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// EXTERNAL MODULE: ./src/core/remote-data-store.js
|
|
138
|
+
var remote_data_store = __webpack_require__(3511);
|
|
139
|
+
// EXTERNAL MODULE: ./src/core/ConnectStateWrapper/component.jsx
|
|
140
|
+
var component = __webpack_require__(9787);
|
|
141
|
+
// EXTERNAL MODULE: ./src/core/Icon/component.jsx
|
|
142
|
+
var Icon_component = __webpack_require__(9008);
|
|
143
|
+
;// CONCATENATED MODULE: ./src/core/Flash/component.jsx
|
|
111
144
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
112
145
|
|
|
113
146
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -142,6 +175,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
142
175
|
|
|
143
176
|
|
|
144
177
|
|
|
178
|
+
|
|
145
179
|
var REDUCER_KEY = "flashes";
|
|
146
180
|
var FLASH_DATA_ID = "ui-flashes";
|
|
147
181
|
var initialState = {
|
|
@@ -171,8 +205,8 @@ var selectFlashes = function selectFlashes(store) {
|
|
|
171
205
|
};
|
|
172
206
|
|
|
173
207
|
var FlashT = {
|
|
174
|
-
type:
|
|
175
|
-
content: (
|
|
208
|
+
type: external_commonjs_prop_types_commonjs2_prop_types_default().oneOf(["error", "success", "notice", "info", "alert"]),
|
|
209
|
+
content: (external_commonjs_prop_types_commonjs2_prop_types_default()).string
|
|
176
210
|
};
|
|
177
211
|
var FLASH_BG_COLOR = {
|
|
178
212
|
error: "bg-gui-error",
|
|
@@ -191,48 +225,60 @@ var FLASH_TEXT_COLOR = {
|
|
|
191
225
|
var AUTO_HIDE = ["success", "info", "notice"];
|
|
192
226
|
var AUTO_HIDE_TIME = 8000;
|
|
193
227
|
|
|
228
|
+
var useAutoHide = function useAutoHide(type, closeFlash) {
|
|
229
|
+
var timeoutId = (0,external_commonjs_react_commonjs2_react_.useRef)(null);
|
|
230
|
+
(0,external_commonjs_react_commonjs2_react_.useEffect)(function () {
|
|
231
|
+
if (AUTO_HIDE.includes(type)) {
|
|
232
|
+
timeoutId.current = setTimeout(function () {
|
|
233
|
+
closeFlash();
|
|
234
|
+
}, AUTO_HIDE_TIME);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return function () {
|
|
238
|
+
if (timeoutId.current) {
|
|
239
|
+
clearTimeout(timeoutId.current);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}, []);
|
|
243
|
+
};
|
|
244
|
+
|
|
194
245
|
var Flash = function Flash(_ref) {
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
|
|
246
|
+
var id = _ref.id,
|
|
247
|
+
type = _ref.type,
|
|
248
|
+
content = _ref.content,
|
|
249
|
+
removeFlash = _ref.removeFlash;
|
|
250
|
+
var ref = (0,external_commonjs_react_commonjs2_react_.useRef)(null);
|
|
198
251
|
|
|
199
|
-
var _useState = (0,
|
|
252
|
+
var _useState = (0,external_commonjs_react_commonjs2_react_.useState)(false),
|
|
200
253
|
_useState2 = _slicedToArray(_useState, 2),
|
|
201
254
|
closed = _useState2[0],
|
|
202
255
|
setClosed = _useState2[1];
|
|
203
256
|
|
|
204
|
-
var _useState3 = (0,
|
|
257
|
+
var _useState3 = (0,external_commonjs_react_commonjs2_react_.useState)(0),
|
|
205
258
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
206
259
|
flashHeight = _useState4[0],
|
|
207
260
|
setFlashHeight = _useState4[1];
|
|
208
261
|
|
|
209
|
-
var _useState5 = (0,
|
|
262
|
+
var _useState5 = (0,external_commonjs_react_commonjs2_react_.useState)(false),
|
|
210
263
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
211
264
|
triggerEntryAnimation = _useState6[0],
|
|
212
265
|
setTriggerEntryAnimation = _useState6[1];
|
|
213
266
|
|
|
214
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
215
|
-
return setTriggerEntryAnimation(true);
|
|
216
|
-
}, []);
|
|
217
|
-
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
218
|
-
if (AUTO_HIDE.includes(type)) {
|
|
219
|
-
setTimeout(function () {
|
|
220
|
-
// closeFlash is idempotent, we can call it even if the flash has been already closed
|
|
221
|
-
closeFlash();
|
|
222
|
-
}, AUTO_HIDE_TIME);
|
|
223
|
-
}
|
|
224
|
-
}, [closed]);
|
|
225
|
-
|
|
226
267
|
var closeFlash = function closeFlash() {
|
|
227
268
|
if (ref.current) {
|
|
228
269
|
setFlashHeight(ref.current.getBoundingClientRect().height);
|
|
229
270
|
}
|
|
230
271
|
|
|
272
|
+
setClosed(true);
|
|
231
273
|
setTimeout(function () {
|
|
232
|
-
|
|
233
|
-
},
|
|
274
|
+
removeFlash(id);
|
|
275
|
+
}, 100);
|
|
234
276
|
};
|
|
235
277
|
|
|
278
|
+
(0,external_commonjs_react_commonjs2_react_.useEffect)(function () {
|
|
279
|
+
return setTriggerEntryAnimation(true);
|
|
280
|
+
}, []);
|
|
281
|
+
useAutoHide(type, closeFlash);
|
|
236
282
|
var animateEntry = triggerEntryAnimation && !closed;
|
|
237
283
|
var style;
|
|
238
284
|
|
|
@@ -250,7 +296,7 @@ var Flash = function Flash(_ref) {
|
|
|
250
296
|
style = {};
|
|
251
297
|
}
|
|
252
298
|
|
|
253
|
-
var safeContent =
|
|
299
|
+
var safeContent = external_commonjs_dompurify_commonjs2_dompurify_default().sanitize(content, {
|
|
254
300
|
ALLOWED_TAGS: ["a"],
|
|
255
301
|
ALLOWED_ATTR: ["href", "data-method", "rel"]
|
|
256
302
|
});
|
|
@@ -266,28 +312,28 @@ var Flash = function Flash(_ref) {
|
|
|
266
312
|
error: "text-white",
|
|
267
313
|
alert: "text-white"
|
|
268
314
|
};
|
|
269
|
-
return /*#__PURE__*/
|
|
315
|
+
return /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement("div", {
|
|
270
316
|
className: "ui-flash-message ui-grid-px ".concat(animateEntry ? "ui-flash-message-enter" : ""),
|
|
271
317
|
style: style,
|
|
272
318
|
ref: ref,
|
|
273
319
|
"data-id": "ui-flash"
|
|
274
|
-
}, /*#__PURE__*/
|
|
320
|
+
}, /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement("div", {
|
|
275
321
|
className: "".concat(FLASH_BG_COLOR[type], " p-32 flex align-center rounded shadow-container-subtle")
|
|
276
|
-
}, withIcons[type] && /*#__PURE__*/
|
|
322
|
+
}, withIcons[type] && /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement(Icon_component.default, {
|
|
277
323
|
name: withIcons[type],
|
|
278
324
|
color: iconColor[type],
|
|
279
325
|
size: "1.5rem",
|
|
280
326
|
additionalCSS: "mr-16 self-baseline"
|
|
281
|
-
}), /*#__PURE__*/
|
|
327
|
+
}), /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement("p", {
|
|
282
328
|
className: "ui-flash-text ".concat(FLASH_TEXT_COLOR[type]),
|
|
283
329
|
dangerouslySetInnerHTML: {
|
|
284
330
|
__html: safeContent
|
|
285
331
|
}
|
|
286
|
-
}), /*#__PURE__*/
|
|
332
|
+
}), /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement("button", {
|
|
287
333
|
type: "button",
|
|
288
334
|
className: "p-0 ml-auto self-start focus:outline-none",
|
|
289
335
|
onClick: closeFlash
|
|
290
|
-
}, /*#__PURE__*/
|
|
336
|
+
}, /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement(Icon_component.default, {
|
|
291
337
|
name: "icon-gui-close",
|
|
292
338
|
color: iconColor[type],
|
|
293
339
|
size: "1.5rem",
|
|
@@ -299,26 +345,55 @@ Flash.propTypes = _objectSpread({}, FlashT);
|
|
|
299
345
|
|
|
300
346
|
var Flashes = function Flashes(_ref2) {
|
|
301
347
|
var flashes = _ref2.flashes;
|
|
302
|
-
|
|
303
|
-
|
|
348
|
+
|
|
349
|
+
var _useState7 = (0,external_commonjs_react_commonjs2_react_.useState)([]),
|
|
350
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
351
|
+
flashesWithIds = _useState8[0],
|
|
352
|
+
setFlashesWithIds = _useState8[1];
|
|
353
|
+
|
|
354
|
+
var removeFlash = function removeFlash(flashId) {
|
|
355
|
+
return setFlashesWithIds(function (items) {
|
|
356
|
+
return items.filter(function (item) {
|
|
357
|
+
return item.id !== flashId;
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
(0,external_commonjs_react_commonjs2_react_.useEffect)(function () {
|
|
363
|
+
setFlashesWithIds(function (state) {
|
|
364
|
+
return [].concat(_toConsumableArray(state), _toConsumableArray(((flashes === null || flashes === void 0 ? void 0 : flashes.items) || []).map(function (flash) {
|
|
365
|
+
return _objectSpread(_objectSpread({}, flash), {}, {
|
|
366
|
+
id: nanoid(),
|
|
367
|
+
removed: false
|
|
368
|
+
});
|
|
369
|
+
})));
|
|
370
|
+
});
|
|
371
|
+
}, [flashes]);
|
|
372
|
+
console.log({
|
|
373
|
+
flashesWithIds: flashesWithIds
|
|
374
|
+
});
|
|
375
|
+
return /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement("div", {
|
|
304
376
|
className: "ui-flash",
|
|
305
377
|
"data-id": FLASH_DATA_ID
|
|
306
|
-
},
|
|
307
|
-
return
|
|
308
|
-
|
|
378
|
+
}, flashesWithIds.filter(function (item) {
|
|
379
|
+
return !item.removed;
|
|
380
|
+
}).map(function (flash) {
|
|
381
|
+
return /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement(Flash, _extends({
|
|
382
|
+
removeFlash: removeFlash,
|
|
383
|
+
key: flash.id
|
|
309
384
|
}, flash));
|
|
310
385
|
}));
|
|
311
386
|
};
|
|
312
387
|
|
|
313
388
|
Flashes.propTypes = {
|
|
314
|
-
flashes:
|
|
315
|
-
items:
|
|
389
|
+
flashes: external_commonjs_prop_types_commonjs2_prop_types_default().shape({
|
|
390
|
+
items: external_commonjs_prop_types_commonjs2_prop_types_default().arrayOf(external_commonjs_prop_types_commonjs2_prop_types_default().shape(FlashT))
|
|
316
391
|
})
|
|
317
392
|
};
|
|
318
393
|
|
|
319
394
|
var BackendFlashes = function BackendFlashes(_ref3) {
|
|
320
395
|
var flashes = _ref3.flashes;
|
|
321
|
-
(0,
|
|
396
|
+
(0,external_commonjs_react_commonjs2_react_.useEffect)(function () {
|
|
322
397
|
var transformedFlashes = flashes.map(function (flash) {
|
|
323
398
|
var _flash = _slicedToArray(flash, 2),
|
|
324
399
|
type = _flash[0],
|
|
@@ -331,24 +406,24 @@ var BackendFlashes = function BackendFlashes(_ref3) {
|
|
|
331
406
|
}) || [];
|
|
332
407
|
|
|
333
408
|
if (transformedFlashes.length > 0) {
|
|
334
|
-
var store = (0,
|
|
409
|
+
var store = (0,remote_data_store/* getRemoteDataStore */.cO)();
|
|
335
410
|
store.dispatch({
|
|
336
411
|
type: "flash/push",
|
|
337
412
|
payload: transformedFlashes
|
|
338
413
|
});
|
|
339
414
|
}
|
|
340
415
|
}, []);
|
|
341
|
-
var WrappedFlashes = (0,
|
|
416
|
+
var WrappedFlashes = (0,component.default)(Flashes, {
|
|
342
417
|
flashes: selectFlashes
|
|
343
418
|
});
|
|
344
|
-
return /*#__PURE__*/
|
|
419
|
+
return /*#__PURE__*/external_commonjs_react_commonjs2_react_default().createElement(WrappedFlashes, null);
|
|
345
420
|
};
|
|
346
421
|
|
|
347
422
|
BackendFlashes.propTypes = {
|
|
348
|
-
flashes:
|
|
423
|
+
flashes: external_commonjs_prop_types_commonjs2_prop_types_default().arrayOf(external_commonjs_prop_types_commonjs2_prop_types_default().arrayOf((external_commonjs_prop_types_commonjs2_prop_types_default()).string))
|
|
349
424
|
};
|
|
350
425
|
|
|
351
|
-
/*
|
|
426
|
+
/* harmony default export */ const Flash_component = ((/* unused pure expression or super */ null && (BackendFlashes)));
|
|
352
427
|
|
|
353
428
|
/***/ }),
|
|
354
429
|
|
|
@@ -599,8 +674,8 @@ var external_commonjs_lodash_throttle_commonjs2_lodash_throttle_ = __webpack_req
|
|
|
599
674
|
var external_commonjs_lodash_throttle_commonjs2_lodash_throttle_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_lodash_throttle_commonjs2_lodash_throttle_);
|
|
600
675
|
// EXTERNAL MODULE: ./src/core/dom-query.js
|
|
601
676
|
var dom_query = __webpack_require__(9581);
|
|
602
|
-
// EXTERNAL MODULE: ./src/core/Flash/component.jsx
|
|
603
|
-
var component = __webpack_require__(
|
|
677
|
+
// EXTERNAL MODULE: ./src/core/Flash/component.jsx + 1 modules
|
|
678
|
+
var component = __webpack_require__(8696);
|
|
604
679
|
;// CONCATENATED MODULE: ./src/core/Notice/component.js
|
|
605
680
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
606
681
|
|
|
Binary file
|
package/core/sprites.svg
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<path d="M24 13C24 6.37258 18.6274 1 12 1C5.37258 1 0 6.37258 0 13C0 18.9895 4.3882 23.954 10.125 24.8542V16.4688H7.07812V13H10.125V10.3563C10.125 7.34875 11.9166 5.6875 14.6576 5.6875C15.9701 5.6875 17.3438 5.92188 17.3438 5.92188V8.875H15.8306C14.34 8.875 13.875 9.80008 13.875 10.75V13H17.2031L16.6711 16.4688H13.875V24.8542C19.6118 23.954 24 18.9895 24 13Z" fill="currentColor"/>
|
|
12
12
|
<path d="M16.6711 16.4688L17.2031 13H13.875V10.75C13.875 9.80102 14.34 8.875 15.8306 8.875H17.3438V5.92188C17.3438 5.92188 15.9705 5.6875 14.6576 5.6875C11.9166 5.6875 10.125 7.34875 10.125 10.3563V13H7.07812V16.4688H10.125V24.8542C11.3674 25.0486 12.6326 25.0486 13.875 24.8542V16.4688H16.6711Z" fill="none"/>
|
|
13
13
|
</symbol><symbol id="sprite-github" viewBox="0 0 24 24"><title>sprite-github</title>
|
|
14
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C5.4 0 0 5.41945 0 12.0432C0 17.3623 3.4 21.8785 8.2 23.4843C8.8 23.5846 9 23.1832 9 22.8821C9 22.581 9 21.8785 9 20.8749C5.7 21.5774 5 19.2692 5 19.2692C4.5 17.8641 3.7 17.4627 3.7 17.4627C2.6 16.7601 3.8 16.7602 3.8 16.7602C5 16.8605 5.6 17.9645 5.6 17.9645C6.7 19.771 8.4 19.2692 9.1 18.9681C9.2 18.1652 9.5 17.6634 9.9 17.3623C7.1 17.0612 4.3 16.0576 4.3 11.4411C4.3 10.1364 4.8 9.03242 5.5 8.22953C5.5 7.82809 5 6.62377 5.7 5.01801C5.7 5.01801 6.7 4.71693 9 6.22233C10 5.92125 11 5.82089 12 5.82089C13 5.82089 14 5.92125 15 6.22233C17.3 4.71693 18.3 5.01801 18.3 5.01801C19 6.72413 18.5 7.92845 18.4 8.22953C19.2 9.03242 19.6 10.1364 19.6 11.4411C19.6 16.0576 16.8 17.0612 14.1 17.3623C14.5 17.7638 14.9 18.4663 14.9 19.5702C14.9 21.176 14.9 22.4807 14.9 22.8821C14.9 23.1832 15.1 23.5846 15.7 23.4843C20.6 21.8785 24 17.3623 24 12.0432C24 5.41945 18.6 0 12 0Z"/>
|
|
14
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 0C5.4 0 0 5.41945 0 12.0432C0 17.3623 3.4 21.8785 8.2 23.4843C8.8 23.5846 9 23.1832 9 22.8821C9 22.581 9 21.8785 9 20.8749C5.7 21.5774 5 19.2692 5 19.2692C4.5 17.8641 3.7 17.4627 3.7 17.4627C2.6 16.7601 3.8 16.7602 3.8 16.7602C5 16.8605 5.6 17.9645 5.6 17.9645C6.7 19.771 8.4 19.2692 9.1 18.9681C9.2 18.1652 9.5 17.6634 9.9 17.3623C7.1 17.0612 4.3 16.0576 4.3 11.4411C4.3 10.1364 4.8 9.03242 5.5 8.22953C5.5 7.82809 5 6.62377 5.7 5.01801C5.7 5.01801 6.7 4.71693 9 6.22233C10 5.92125 11 5.82089 12 5.82089C13 5.82089 14 5.92125 15 6.22233C17.3 4.71693 18.3 5.01801 18.3 5.01801C19 6.72413 18.5 7.92845 18.4 8.22953C19.2 9.03242 19.6 10.1364 19.6 11.4411C19.6 16.0576 16.8 17.0612 14.1 17.3623C14.5 17.7638 14.9 18.4663 14.9 19.5702C14.9 21.176 14.9 22.4807 14.9 22.8821C14.9 23.1832 15.1 23.5846 15.7 23.4843C20.6 21.8785 24 17.3623 24 12.0432C24 5.41945 18.6 0 12 0Z" fill="currentColor"/>
|
|
15
15
|
</symbol><symbol id="sprite-glassdoor" viewBox="0 0 18 24"><title>sprite-glassdoor</title>
|
|
16
16
|
<path d="M14.122 20.5734H0.5C0.5 22.4677 2.0222 24 3.90634 24H14.122C16.0027 24 17.5249 22.4643 17.5249 20.5734V6.49471C17.5249 6.42706 17.4708 6.36617 17.4032 6.36617H14.2438C14.1761 6.36617 14.122 6.42368 14.122 6.49133V20.57V20.5734ZM14.122 0C16.0027 0 17.5249 1.53573 17.5249 3.43002H3.90634V17.5087C3.90634 17.5763 3.84884 17.6338 3.78118 17.6338H0.625159C0.557505 17.6338 0.5 17.5763 0.5 17.5087V3.43002C0.5 1.53573 2.0222 0 3.90634 0H14.122Z"/>
|
|
17
17
|
</symbol><symbol fill="none" id="sprite-google" viewBox="0 0 18 18"><title>sprite-google</title>
|
|
@@ -396,12 +396,12 @@
|
|
|
396
396
|
</symbol><symbol id="sprite-quote" viewBox="0 0 25 19"><title>sprite-quote</title>
|
|
397
397
|
<path d="M8.78125 19H0V12.7188C0 10.1771 0.21875 8.17708 0.65625 6.71875C1.11458 5.23958 1.94792 3.91667 3.15625 2.75C4.36458 1.58333 5.90625 0.666667 7.78125 0L9.5 3.625C7.75 4.20833 6.48958 5.02083 5.71875 6.0625C4.96875 7.10417 4.57292 8.48958 4.53125 10.2188H8.78125V19ZM23.4375 19H14.6562V12.7188C14.6562 10.1562 14.875 8.14583 15.3125 6.6875C15.7708 5.22917 16.6042 3.91667 17.8125 2.75C19.0417 1.58333 20.5833 0.666667 22.4375 0L24.1562 3.625C22.4062 4.20833 21.1458 5.02083 20.375 6.0625C19.625 7.10417 19.2292 8.48958 19.1875 10.2188H23.4375V19Z"/>
|
|
398
398
|
</symbol><symbol fill="none" id="sprite-stackoverflow" viewBox="0 0 24 24"><title>sprite-stackoverflow</title>
|
|
399
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.8833 17.0404L6.44573 14.8304L6.89029 12.7367L17.3279 14.9467L16.8833 17.0404ZM17.4825 14.3457L7.81808 9.82876L8.72653 7.89014L18.391 12.4071L17.4825 14.3457ZM18.7002 11.9031L10.5048 5.05977L11.8771 3.41195L20.0726 10.2552L18.7002 11.9031ZM14.0806 1.27948L15.8009 0L22.1601 8.58804L20.4398 9.86753L14.0806 1.27948ZM16.8833 19.7351H6.25244V17.6026H16.8833V19.7351ZM21.1356 15.4701H19.0094V21.8675H4.12617V15.4701H2V24H21.1356V15.4701Z" fill="
|
|
399
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.8833 17.0404L6.44573 14.8304L6.89029 12.7367L17.3279 14.9467L16.8833 17.0404ZM17.4825 14.3457L7.81808 9.82876L8.72653 7.89014L18.391 12.4071L17.4825 14.3457ZM18.7002 11.9031L10.5048 5.05977L11.8771 3.41195L20.0726 10.2552L18.7002 11.9031ZM14.0806 1.27948L15.8009 0L22.1601 8.58804L20.4398 9.86753L14.0806 1.27948ZM16.8833 19.7351H6.25244V17.6026H16.8833V19.7351ZM21.1356 15.4701H19.0094V21.8675H4.12617V15.4701H2V24H21.1356V15.4701Z" fill="currentColor"/>
|
|
400
400
|
</symbol><symbol id="sprite-twitter" viewBox="0 0 24 20"><title>sprite-twitter</title>
|
|
401
401
|
<path d="M24 2.304C23.1129 2.7 22.1658 2.964 21.1708 3.084C22.1898 2.472 22.969 1.512 23.3287 0.36C22.3816 0.924 21.3267 1.332 20.1998 1.56C19.3007 0.6 18.03 0 16.6034 0C13.8821 0 11.6883 2.208 11.6883 4.92C11.6883 5.304 11.7363 5.676 11.8202 6.048C7.73227 5.844 4.11189 3.888 1.67832 0.9C1.25874 1.632 1.00699 2.472 1.00699 3.372C1.00699 5.076 1.87013 6.588 3.2008 7.476C2.3976 7.452 1.63037 7.224 0.971029 6.864C0.971029 6.888 0.971029 6.9 0.971029 6.924C0.971029 9.312 2.66134 11.304 4.91509 11.748C4.50749 11.856 4.06394 11.916 3.62038 11.916C3.30869 11.916 2.997 11.88 2.6973 11.832C3.32068 13.788 5.14286 15.216 7.28871 15.252C5.61039 16.572 3.48851 17.364 1.17483 17.364C0.779221 17.364 0.383616 17.34 0 17.292C2.18182 18.684 4.75924 19.5 7.54046 19.5C16.5914 19.5 21.5305 12 21.5305 5.496C21.5305 5.28 21.5305 5.076 21.5185 4.86C22.5015 4.164 23.3407 3.3 24 2.304Z"/>
|
|
402
402
|
</symbol><symbol fill="none" id="sprite-youtube" viewBox="0 0 32 22"><title>sprite-youtube</title>
|
|
403
403
|
<g clip-path="url(#clip0_1509_18255)">
|
|
404
|
-
<path d="M30.525 3.44433C30.1655 2.09844 29.113 1.03726 27.778 0.6749C25.3391 0.00195312 15.5834 0.00195312 15.5834 0.00195312C15.5834 0.00195312 5.82773 0.00195312 3.38881 0.649017C2.0795 1.01137 1.00124 2.09844 0.64182 3.44433C0 5.90318 0 11.002 0 11.002C0 11.002 0 16.1268 0.64182 18.5597C1.00124 19.9056 2.05382 20.9668 3.38881 21.3292C5.8534 22.0021 15.5834 22.0021 15.5834 22.0021C15.5834 22.0021 25.3391 22.0021 27.778 21.3551C29.113 20.9927 30.1655 19.9315 30.525 18.5856C31.1668 16.1268 31.1668 11.0279 31.1668 11.0279C31.1668 11.0279 31.1925 5.90318 30.525 3.44433Z" fill="
|
|
404
|
+
<path d="M30.525 3.44433C30.1655 2.09844 29.113 1.03726 27.778 0.6749C25.3391 0.00195312 15.5834 0.00195312 15.5834 0.00195312C15.5834 0.00195312 5.82773 0.00195312 3.38881 0.649017C2.0795 1.01137 1.00124 2.09844 0.64182 3.44433C0 5.90318 0 11.002 0 11.002C0 11.002 0 16.1268 0.64182 18.5597C1.00124 19.9056 2.05382 20.9668 3.38881 21.3292C5.8534 22.0021 15.5834 22.0021 15.5834 22.0021C15.5834 22.0021 25.3391 22.0021 27.778 21.3551C29.113 20.9927 30.1655 19.9315 30.525 18.5856C31.1668 16.1268 31.1668 11.0279 31.1668 11.0279C31.1668 11.0279 31.1925 5.90318 30.525 3.44433Z" fill="currentColor"/>
|
|
405
405
|
<path d="M20.5892 11.0021L12.4766 6.2915V15.7128L20.5892 11.0021Z" fill="white"/>
|
|
406
406
|
</g>
|
|
407
407
|
<defs>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ably/ui",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
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",
|
|
@@ -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;
|
|
@@ -123,13 +139,25 @@ Flash.propTypes = {
|
|
|
123
139
|
};
|
|
124
140
|
|
|
125
141
|
const Flashes = ({ flashes }) => {
|
|
126
|
-
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]);
|
|
151
|
+
|
|
152
|
+
console.log({ flashesWithIds });
|
|
127
153
|
|
|
128
154
|
return (
|
|
129
155
|
<div className="ui-flash" data-id={FLASH_DATA_ID}>
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
|
|
156
|
+
{flashesWithIds
|
|
157
|
+
.filter((item) => !item.removed)
|
|
158
|
+
.map((flash) => (
|
|
159
|
+
<Flash removeFlash={removeFlash} key={flash.id} {...flash} />
|
|
160
|
+
))}
|
|
133
161
|
</div>
|
|
134
162
|
);
|
|
135
163
|
};
|
|
@@ -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
|
|
|
@@ -86,7 +86,7 @@ export default function Meganav({ paths, themeName = "white", notice, loginLink
|
|
|
86
86
|
{notice && <Notice {...notice.props} config={notice.config} />}
|
|
87
87
|
<div className="ui-meganav ui-grid-px">
|
|
88
88
|
<div className="mr-24">
|
|
89
|
-
<Logo dataId="meganav-logo" href={urlBase} />
|
|
89
|
+
<Logo dataId="meganav-logo" href={urlBase} logoUrl={paths.logo} />
|
|
90
90
|
</div>
|
|
91
91
|
|
|
92
92
|
<MeganavItemsDesktop panels={panels} paths={paths} theme={theme} absUrl={absUrl} />
|