@redocly/theme 0.7.4 → 0.7.5
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/lib/Catalog/Catalog.d.ts +8 -0
- package/lib/Catalog/Catalog.js +167 -0
- package/lib/Catalog/CatalogCard.d.ts +5 -0
- package/lib/Catalog/CatalogCard.js +113 -0
- package/lib/Catalog/Filter.d.ts +5 -0
- package/lib/Catalog/Filter.js +88 -0
- package/lib/Catalog/Tags.d.ts +4 -0
- package/lib/Catalog/Tags.js +32 -0
- package/lib/Feedback/ReportDialog.d.ts +3 -0
- package/lib/Feedback/ReportDialog.js +66 -0
- package/lib/Feedback/index.d.ts +2 -0
- package/lib/Feedback/index.js +5 -1
- package/lib/Feedback/types.d.ts +5 -3
- package/lib/Feedback/useReportDialog.d.ts +7 -0
- package/lib/Feedback/useReportDialog.js +28 -0
- package/lib/Markdown/CodeSample/CodeSample.js +5 -38
- package/lib/Sidebar/ArrowBack.js +2 -2
- package/lib/Sidebar/SidebarLayout.d.ts +5 -1
- package/lib/Sidebar/SidebarLayout.js +26 -1
- package/lib/config.js +2 -2
- package/lib/globalStyle.js +12 -10
- package/lib/mocks/hooks/index.d.ts +4 -0
- package/lib/mocks/hooks/index.js +9 -1
- package/lib/ui/Checkbox.d.ts +1 -0
- package/lib/ui/Checkbox.js +70 -0
- package/lib/ui/Highlight.d.ts +5 -0
- package/lib/ui/Highlight.js +63 -0
- package/lib/ui/darkColors.js +4 -2
- package/package.json +4 -2
- package/src/Catalog/Catalog.tsx +198 -0
- package/src/Catalog/CatalogCard.tsx +95 -0
- package/src/Catalog/Filter.tsx +103 -0
- package/src/Catalog/Tags.tsx +36 -0
- package/src/Feedback/ReportDialog.tsx +51 -0
- package/src/Feedback/index.ts +2 -0
- package/src/Feedback/types.ts +5 -3
- package/src/Feedback/useReportDialog.ts +34 -0
- package/src/Markdown/CodeSample/CodeSample.tsx +7 -50
- package/src/Sidebar/ArrowBack.tsx +2 -2
- package/src/Sidebar/SidebarLayout.tsx +38 -1
- package/src/config.ts +2 -2
- package/src/globalStyle.ts +12 -10
- package/src/mocks/hooks/index.ts +10 -1
- package/src/types/portal/src/shared/types/catalog.d.ts +55 -0
- package/src/ui/Checkbox.tsx +64 -0
- package/src/ui/Highlight.tsx +48 -0
- package/src/ui/darkColors.tsx +4 -2
- package/lib/hooks/useReportDialog.d.ts +0 -1
- package/lib/hooks/useReportDialog.js +0 -16
- package/src/hooks/useReportDialog.ts +0 -14
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { findAll } from 'highlight-words-core';
|
|
3
|
+
|
|
4
|
+
export const HighlightContext = React.createContext<string[]>([]);
|
|
5
|
+
|
|
6
|
+
export function Highlight(props: { children: React.ReactChildren | string }): JSX.Element {
|
|
7
|
+
const { children } = props;
|
|
8
|
+
const searchWords = React.useContext(HighlightContext);
|
|
9
|
+
|
|
10
|
+
if (!searchWords.length) {
|
|
11
|
+
return <>children</> || null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function highlight(str: string, childIdx: number = 0) {
|
|
15
|
+
const chunks = findAll({
|
|
16
|
+
searchWords,
|
|
17
|
+
textToHighlight: str,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<React.Fragment key={childIdx}>
|
|
22
|
+
{chunks.map((chunk, idx) => {
|
|
23
|
+
const { end, highlight, start } = chunk;
|
|
24
|
+
const text = str.substr(start, end - start);
|
|
25
|
+
if (highlight) {
|
|
26
|
+
return <mark key={idx}>{text}</mark>;
|
|
27
|
+
} else {
|
|
28
|
+
return text;
|
|
29
|
+
}
|
|
30
|
+
})}
|
|
31
|
+
</React.Fragment>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (typeof children === 'string') {
|
|
36
|
+
return highlight(children);
|
|
37
|
+
} else if (Array.isArray(children)) {
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
{children.map((child, idx) =>
|
|
41
|
+
typeof children === 'string' ? highlight(child, idx) : child || null,
|
|
42
|
+
)}
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
} else {
|
|
46
|
+
return <>children</> || null;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/ui/darkColors.tsx
CHANGED
|
@@ -60,12 +60,14 @@ export const darkMode = css`
|
|
|
60
60
|
--tooltip-text-color: #fff;
|
|
61
61
|
--md-table-head-background-color: var(--color-secondary-300);
|
|
62
62
|
--md-tabs-hover-tab-border-color: var(--color-secondary-500);
|
|
63
|
-
--
|
|
64
|
-
--
|
|
63
|
+
--thin-tile-background-color: #1d242d;
|
|
64
|
+
--wide-tile-background-color: #1d242d;
|
|
65
65
|
--page-404-header-text-color: #fff;
|
|
66
66
|
--page-404-description-text-color: #fff;
|
|
67
67
|
--page-403-header-text-color: #fff;
|
|
68
68
|
--page-403-description-text-color: #fff;
|
|
69
|
+
--checkbox-backround-color: var(--color-secondary-900);
|
|
70
|
+
--checkbox-checked-backround-color: var(--color-primary-400);
|
|
69
71
|
|
|
70
72
|
background-color: var(--background-color);
|
|
71
73
|
color: var(--text-color);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useReportDialog(initialState?: boolean): [boolean, () => void, () => void];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useReportDialog = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useReportDialog(initialState = false) {
|
|
6
|
-
const [isDialogShown, setIsShown] = (0, react_1.useState)(initialState);
|
|
7
|
-
const showDialog = () => {
|
|
8
|
-
setIsShown(true);
|
|
9
|
-
};
|
|
10
|
-
const hideDialog = () => {
|
|
11
|
-
setIsShown(false);
|
|
12
|
-
};
|
|
13
|
-
return [isDialogShown, showDialog, hideDialog];
|
|
14
|
-
}
|
|
15
|
-
exports.useReportDialog = useReportDialog;
|
|
16
|
-
//# sourceMappingURL=useReportDialog.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export function useReportDialog(initialState = false): [boolean, () => void, () => void] {
|
|
4
|
-
const [isDialogShown, setIsShown] = useState(initialState);
|
|
5
|
-
|
|
6
|
-
const showDialog = () => {
|
|
7
|
-
setIsShown(true);
|
|
8
|
-
};
|
|
9
|
-
const hideDialog = () => {
|
|
10
|
-
setIsShown(false);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
return [isDialogShown, showDialog, hideDialog];
|
|
14
|
-
}
|