@redocly/theme 0.6.5 → 0.7.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/lib/Feedback/Comment.d.ts +3 -0
- package/lib/Feedback/Comment.js +80 -0
- package/lib/Feedback/Rating.js +23 -10
- package/lib/Feedback/Reasons.d.ts +3 -0
- package/lib/Feedback/Reasons.js +85 -0
- package/lib/Feedback/Sentiment.js +28 -4
- package/lib/Feedback/index.d.ts +4 -2
- package/lib/Feedback/index.js +7 -3
- package/lib/Feedback/types.d.ts +48 -3
- package/lib/Markdown/Tabs/Tab.js +11 -5
- package/lib/Markdown/Tabs/Tabs.js +14 -5
- package/lib/Navbar/Navbar.js +3 -1
- package/lib/Pages/Forbidden.d.ts +2 -0
- package/lib/Pages/Forbidden.js +39 -0
- package/lib/Pages/NotFound.d.ts +2 -0
- package/lib/Pages/NotFound.js +39 -0
- package/lib/Pages/index.d.ts +1 -0
- package/lib/Pages/index.js +18 -0
- package/lib/Search/Autocomplete.d.ts +4 -1
- package/lib/Search/Autocomplete.js +19 -3
- package/lib/Search/ClearIcon.js +1 -1
- package/lib/Search/Input.js +1 -1
- package/lib/Search/Search.js +6 -1
- package/lib/Search/SearchIcon.js +1 -1
- package/lib/Search/ShortcutKey.d.ts +7 -0
- package/lib/Search/ShortcutKey.js +35 -0
- package/lib/config.d.ts +8 -0
- package/lib/config.js +1 -0
- package/lib/globalStyle.js +59 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mocks/Link.js +1 -1
- package/lib/mocks/hooks/index.js +5 -1
- package/lib/mocks/search.js +18 -5
- package/lib/ui/darkColors.js +5 -0
- package/package.json +8 -4
- package/src/Feedback/Comment.tsx +64 -0
- package/src/Feedback/Rating.tsx +45 -17
- package/src/Feedback/Reasons.tsx +81 -0
- package/src/Feedback/Sentiment.tsx +44 -5
- package/src/Feedback/index.ts +4 -2
- package/src/Feedback/types.ts +37 -3
- package/src/Markdown/Tabs/Tab.tsx +11 -5
- package/src/Markdown/Tabs/Tabs.tsx +14 -5
- package/src/Navbar/Navbar.tsx +5 -1
- package/src/Pages/Forbidden.tsx +42 -0
- package/src/Pages/NotFound.tsx +42 -0
- package/src/Pages/index.ts +1 -0
- package/src/Search/Autocomplete.tsx +26 -2
- package/src/Search/ClearIcon.tsx +1 -1
- package/src/Search/Input.tsx +1 -1
- package/src/Search/Search.tsx +3 -0
- package/src/Search/SearchIcon.tsx +1 -1
- package/src/Search/ShortcutKey.tsx +35 -0
- package/src/config.ts +4 -0
- package/src/globalStyle.ts +60 -1
- package/src/index.ts +1 -0
- package/src/mocks/Link.tsx +2 -1
- package/src/mocks/hooks/index.ts +5 -1
- package/src/mocks/search.ts +20 -5
- package/src/ui/darkColors.tsx +5 -0
package/src/Feedback/types.ts
CHANGED
|
@@ -1,23 +1,57 @@
|
|
|
1
1
|
export type RatingProps = {
|
|
2
|
-
onSubmit: (value: number) => void;
|
|
2
|
+
onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
|
|
3
3
|
settings?: {
|
|
4
4
|
label?: string;
|
|
5
5
|
max?: number;
|
|
6
6
|
submitText?: string;
|
|
7
|
+
comment?: {
|
|
8
|
+
enable: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
reasons?: {
|
|
12
|
+
enable: boolean;
|
|
13
|
+
label?: string;
|
|
14
|
+
multi?: boolean;
|
|
15
|
+
items: string[];
|
|
16
|
+
};
|
|
7
17
|
};
|
|
8
18
|
};
|
|
9
19
|
|
|
10
20
|
export type SentimentProps = {
|
|
11
|
-
onSubmit: (value:
|
|
21
|
+
onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
|
|
12
22
|
settings?: {
|
|
13
23
|
label?: string;
|
|
24
|
+
submitText?: string;
|
|
25
|
+
comment?: {
|
|
26
|
+
enable: boolean;
|
|
27
|
+
likeLabel?: string;
|
|
28
|
+
dislikeLabel?: string;
|
|
29
|
+
};
|
|
30
|
+
reasons?: {
|
|
31
|
+
enable: boolean;
|
|
32
|
+
label?: string;
|
|
33
|
+
multi?: boolean;
|
|
34
|
+
items: string[];
|
|
35
|
+
};
|
|
14
36
|
};
|
|
15
37
|
};
|
|
16
38
|
|
|
17
39
|
export type CommentProps = {
|
|
18
|
-
onSubmit: (value: string) => void;
|
|
40
|
+
onSubmit: (value: { comment: string }) => void;
|
|
19
41
|
settings?: {
|
|
20
42
|
label?: string;
|
|
43
|
+
submitText?: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type ReasonsProps = {
|
|
48
|
+
onSubmit: (value: { reasons: string[] }) => void;
|
|
49
|
+
settings: {
|
|
50
|
+
label?: string;
|
|
51
|
+
multi?: boolean;
|
|
52
|
+
items: string[];
|
|
53
|
+
submitText?: string;
|
|
54
|
+
buttonText?: string;
|
|
21
55
|
};
|
|
22
56
|
};
|
|
23
57
|
|
|
@@ -23,15 +23,21 @@ export function Tab({ activeTab, label, onClick }: TabProps): JSX.Element {
|
|
|
23
23
|
const TabItem = styled.li<{ active: boolean }>`
|
|
24
24
|
display: inline-block;
|
|
25
25
|
list-style: none;
|
|
26
|
-
margin-bottom: -1px;
|
|
27
26
|
padding: 0.75rem 1rem;
|
|
28
27
|
cursor: pointer;
|
|
29
28
|
|
|
30
29
|
${({ active }) =>
|
|
31
|
-
active
|
|
30
|
+
active
|
|
31
|
+
? `
|
|
32
|
+
background-color: var(--background-color);
|
|
33
|
+
border: solid var(--md-tabs-active-tab-border-color);
|
|
34
|
+
border-width: 0 0 1px 0;
|
|
35
|
+
color: var(--text-color);
|
|
32
36
|
`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
: `
|
|
38
|
+
&:hover {
|
|
39
|
+
border: solid var(--md-tabs-hover-tab-border-color);
|
|
40
|
+
border-width: 0 0 1px 0;
|
|
41
|
+
}
|
|
36
42
|
`}
|
|
37
43
|
`;
|
|
@@ -31,17 +31,26 @@ export function Tabs({ children }: TabsProps): JSX.Element {
|
|
|
31
31
|
|
|
32
32
|
const TabsContainer = styled.div`
|
|
33
33
|
margin: 10px 0;
|
|
34
|
+
|
|
35
|
+
ol[class^='Tabs__TabList'] {
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding: 0;
|
|
38
|
+
}
|
|
34
39
|
`;
|
|
35
40
|
|
|
36
41
|
const TabList = styled.ol`
|
|
37
|
-
|
|
42
|
+
color: var(--md-tabs-tab-text-color);
|
|
38
43
|
padding: 0;
|
|
39
44
|
margin-block-end: 0;
|
|
45
|
+
border: solid var(--color-secondary-400);
|
|
46
|
+
border-width: 0 0 1px 0;
|
|
47
|
+
|
|
48
|
+
li[class^='Tab__TabItem'] {
|
|
49
|
+
margin: 0;
|
|
50
|
+
margin-bottom: -1px;
|
|
51
|
+
}
|
|
40
52
|
`;
|
|
41
53
|
|
|
42
54
|
const TabContent = styled.div`
|
|
43
|
-
padding:
|
|
44
|
-
border: 1px solid #ccc;
|
|
45
|
-
border-top: none;
|
|
46
|
-
padding: 1rem;
|
|
55
|
+
padding: 1rem 0;
|
|
47
56
|
`;
|
package/src/Navbar/Navbar.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { NavbarMenu } from '@theme/Navbar';
|
|
5
5
|
import { useMobileMenu } from '@theme/hooks/useMobileMenu';
|
|
6
|
+
import { isEmptyArray, isPrimitive } from '@theme/utils';
|
|
6
7
|
import { MobileNavbarMenuButton } from '@theme/Navbar/MobileNavbarMenuButton';
|
|
7
8
|
import { MobileNavbarMenu } from '@theme/Navbar/MobileNavbarMenu';
|
|
8
9
|
import { ColorModeSwitcher } from '@theme/ColorModeSwitcher/ColorModeSwitcher';
|
|
@@ -30,9 +31,12 @@ export function Navbar({ menu, logo, search, profile }: NavbarProps): JSX.Elemen
|
|
|
30
31
|
const openMobileMenu = () => setIsOpen(true);
|
|
31
32
|
const closeMobileMenu = () => setIsOpen(false);
|
|
32
33
|
|
|
34
|
+
const menuItemsExist = !isPrimitive(menu) && !isEmptyArray(menu);
|
|
35
|
+
|
|
33
36
|
return (
|
|
34
37
|
<NavbarContainer data-component-name="Navbar/Navbar">
|
|
35
|
-
<MobileNavbarMenuButton onClick={openMobileMenu} />
|
|
38
|
+
{menuItemsExist && <MobileNavbarMenuButton onClick={openMobileMenu} />}
|
|
39
|
+
|
|
36
40
|
{isOpen && (
|
|
37
41
|
<MobileNavbarMenu
|
|
38
42
|
closeMenu={closeMobileMenu}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@theme/Button';
|
|
5
|
+
|
|
6
|
+
export function Forbidden(): JSX.Element {
|
|
7
|
+
return (
|
|
8
|
+
<Wrapper data-component-name="Pages/Forbidden">
|
|
9
|
+
<Header>403</Header>
|
|
10
|
+
<Description>Access forbidden</Description>
|
|
11
|
+
<HomeButton color="primary" size="large" to="/">
|
|
12
|
+
Open Homepage
|
|
13
|
+
</HomeButton>
|
|
14
|
+
</Wrapper>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Wrapper = styled.div`
|
|
19
|
+
margin: 25px auto;
|
|
20
|
+
font-family: var(--page-403-font-family);
|
|
21
|
+
text-align: center;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const Header = styled.div`
|
|
25
|
+
color: var(--page-403-header-text-color);
|
|
26
|
+
margin: var(--page-403-header-margin);
|
|
27
|
+
font-size: var(--page-403-header-font-size);
|
|
28
|
+
line-height: var(--page-403-header-line-height);
|
|
29
|
+
font-weight: var(--page-403-header-font-weight);
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
const Description = styled.div`
|
|
33
|
+
color: var(--page-403-description-text-color);
|
|
34
|
+
margin: var(--page-403-description-margin);
|
|
35
|
+
font-size: var(--page-403-description-font-size);
|
|
36
|
+
line-height: var(--page-403-description-line-height);
|
|
37
|
+
font-weight: var(--page-403-description-font-weight);
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const HomeButton = styled(Button)`
|
|
41
|
+
margin-top: var(--page-403-button-margin);
|
|
42
|
+
`;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { Button } from '@theme/Button';
|
|
5
|
+
|
|
6
|
+
export function NotFound(): JSX.Element {
|
|
7
|
+
return (
|
|
8
|
+
<Wrapper data-component-name="Pages/NotFound">
|
|
9
|
+
<Header>404</Header>
|
|
10
|
+
<Description>It looks like you're lost</Description>
|
|
11
|
+
<HomeButton color="primary" size="large" to="/">
|
|
12
|
+
Open Homepage
|
|
13
|
+
</HomeButton>
|
|
14
|
+
</Wrapper>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Wrapper = styled.div`
|
|
19
|
+
margin: 25px auto;
|
|
20
|
+
font-family: var(--page-404-font-family);
|
|
21
|
+
text-align: center;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const Header = styled.div`
|
|
25
|
+
color: var(--page-404-header-text-color);
|
|
26
|
+
margin: var(--page-404-header-margin);
|
|
27
|
+
font-size: var(--page-404-header-font-size);
|
|
28
|
+
line-height: var(--page-404-header-line-height);
|
|
29
|
+
font-weight: var(--page-404-header-font-weight);
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
const Description = styled.div`
|
|
33
|
+
color: var(--page-404-description-text-color);
|
|
34
|
+
margin: var(--page-404-description-margin);
|
|
35
|
+
font-size: var(--page-404-description-font-size);
|
|
36
|
+
line-height: var(--page-404-description-line-height);
|
|
37
|
+
font-weight: var(--page-404-description-font-weight);
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const HomeButton = styled(Button)`
|
|
41
|
+
margin-top: var(--page-404-button-margin);
|
|
42
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@theme/Pages/NotFound';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useLocation } from 'react-router-dom';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import hotkeys from 'hotkeys-js';
|
|
4
5
|
|
|
5
6
|
import type { ChangeEvent, KeyboardEvent, ReactNode, SyntheticEvent } from 'react';
|
|
6
7
|
|
|
7
8
|
import { FormInput } from '@theme/Search/Input';
|
|
8
9
|
import { Popover } from '@theme/Search/Popover';
|
|
10
|
+
import { ShortcutKey } from '@theme/Search/ShortcutKey';
|
|
9
11
|
import type { ActiveItem } from '@portal/types';
|
|
10
12
|
|
|
11
13
|
interface AutocompleteProps<T> {
|
|
@@ -16,6 +18,8 @@ interface AutocompleteProps<T> {
|
|
|
16
18
|
change(value: string): void;
|
|
17
19
|
select(item: T): void;
|
|
18
20
|
children?(isOpen: boolean, close: () => void): ReactNode;
|
|
21
|
+
inputRef?: React.RefObject<HTMLInputElement>;
|
|
22
|
+
keyShortcuts?: string[];
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
export function Autocomplete<T>({
|
|
@@ -26,12 +30,28 @@ export function Autocomplete<T>({
|
|
|
26
30
|
select,
|
|
27
31
|
renderItem,
|
|
28
32
|
children,
|
|
33
|
+
keyShortcuts,
|
|
29
34
|
}: AutocompleteProps<T>): JSX.Element {
|
|
30
35
|
const location = useLocation();
|
|
31
36
|
const [isOpen, setIsOpen] = useState(false);
|
|
32
37
|
const [activeIdx, setActiveIdx] = useState(-1);
|
|
38
|
+
const refInput = useRef<HTMLInputElement>(null);
|
|
39
|
+
|
|
40
|
+
const hotkeysKeys = keyShortcuts?.join(',');
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (hotkeysKeys) {
|
|
44
|
+
hotkeys(hotkeysKeys, (ev) => {
|
|
45
|
+
refInput.current?.focus();
|
|
46
|
+
ev.preventDefault();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
return () => hotkeys.unbind(hotkeysKeys as string);
|
|
50
|
+
}
|
|
51
|
+
}, [hotkeysKeys]);
|
|
33
52
|
|
|
34
53
|
const open = () => setIsOpen(true);
|
|
54
|
+
|
|
35
55
|
const close = () => {
|
|
36
56
|
setIsOpen(false);
|
|
37
57
|
setActiveIdx(-1);
|
|
@@ -65,6 +85,7 @@ export function Autocomplete<T>({
|
|
|
65
85
|
break;
|
|
66
86
|
case 'Enter':
|
|
67
87
|
if (activeIdx > -1) {
|
|
88
|
+
reset();
|
|
68
89
|
select(items[activeIdx]);
|
|
69
90
|
}
|
|
70
91
|
break;
|
|
@@ -82,15 +103,18 @@ export function Autocomplete<T>({
|
|
|
82
103
|
<Wrapper data-component-name="Search/Autocomplete">
|
|
83
104
|
{isOpen ? <Overlay onClick={close} /> : null}
|
|
84
105
|
<AutocompleteBox onKeyDown={onKeydown}>
|
|
106
|
+
{children?.(isOpen, reset)}
|
|
107
|
+
|
|
85
108
|
<FormInput
|
|
86
109
|
value={value}
|
|
87
110
|
placeholder={placeholder}
|
|
88
111
|
onChange={onChange}
|
|
89
112
|
onFocus={open}
|
|
90
113
|
onClick={stopPropagation}
|
|
114
|
+
ref={refInput}
|
|
91
115
|
/>
|
|
92
116
|
|
|
93
|
-
{
|
|
117
|
+
{!isOpen && <ShortcutKey keyShortcuts={keyShortcuts} />}
|
|
94
118
|
|
|
95
119
|
{isOpen && value ? (
|
|
96
120
|
<Popover>{items.length ? items.map(mapItem) : <Message>No results</Message>}</Popover>
|
package/src/Search/ClearIcon.tsx
CHANGED
package/src/Search/Input.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
export const FormInput = styled.input.attrs(() => ({
|
|
4
4
|
'data-component-name': 'Search/Input',
|
|
5
5
|
}))`
|
|
6
|
-
padding: 1em 2.5em 1em
|
|
6
|
+
padding: 1em 2.5em 1em 2.5em;
|
|
7
7
|
background-color: var(--search-input-background-color);
|
|
8
8
|
border-radius: var(--search-input-border-radius);
|
|
9
9
|
border: var(--search-input-border);
|
package/src/Search/Search.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { Autocomplete } from '@theme/Search/Autocomplete';
|
|
|
7
7
|
import { ClearIcon } from '@theme/Search/ClearIcon';
|
|
8
8
|
import { SearchIcon } from '@theme/Search/SearchIcon';
|
|
9
9
|
import { SearchItem } from '@theme/Search/SearchItem';
|
|
10
|
+
import { useThemeConfig } from '@theme/hooks';
|
|
10
11
|
|
|
11
12
|
interface OperationParameter {
|
|
12
13
|
name: string | string[];
|
|
@@ -29,6 +30,7 @@ interface SearchDocument {
|
|
|
29
30
|
export function Search(): JSX.Element {
|
|
30
31
|
const history = usePreloadHistory();
|
|
31
32
|
const { query, setQuery, items } = useFuseSearch();
|
|
33
|
+
const themeSettings = useThemeConfig();
|
|
32
34
|
|
|
33
35
|
// TODO: ask somebody about typings
|
|
34
36
|
const navigate = (item: SearchDocument) => history.push(item.url);
|
|
@@ -40,6 +42,7 @@ export function Search(): JSX.Element {
|
|
|
40
42
|
change={setQuery}
|
|
41
43
|
select={navigate}
|
|
42
44
|
placeholder="Search the docs"
|
|
45
|
+
keyShortcuts={themeSettings?.search?.shortcuts ?? ['/']}
|
|
43
46
|
renderItem={(item) => <SearchItem key={item.id} item={item} />}
|
|
44
47
|
>
|
|
45
48
|
{(isOpen, reset) => (isOpen ? <ClearIcon onClick={reset} /> : <SearchIcon />)}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
interface ShortcutKeyProps {
|
|
5
|
+
keyShortcuts?: string | string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function ShortcutKey(props: ShortcutKeyProps): JSX.Element {
|
|
9
|
+
let mainShortcutKey: string | null | undefined = null;
|
|
10
|
+
|
|
11
|
+
if (props.keyShortcuts) {
|
|
12
|
+
if (Array.isArray(props.keyShortcuts)) {
|
|
13
|
+
mainShortcutKey = props.keyShortcuts[0];
|
|
14
|
+
} else {
|
|
15
|
+
mainShortcutKey = props.keyShortcuts;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
mainShortcutKey = mainShortcutKey?.toUpperCase();
|
|
20
|
+
|
|
21
|
+
return <Wrapper>{mainShortcutKey}</Wrapper>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const Wrapper = styled.div`
|
|
25
|
+
position: absolute;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
font-size: 0.8em;
|
|
28
|
+
height: 2em;
|
|
29
|
+
line-height: 2em;
|
|
30
|
+
right: 1em;
|
|
31
|
+
fill: var(--search-input-text-color);
|
|
32
|
+
color: var(--search-input-placeholder-color);
|
|
33
|
+
opacity: 0.5;
|
|
34
|
+
z-index: -1;
|
|
35
|
+
`;
|
package/src/config.ts
CHANGED
|
@@ -94,6 +94,7 @@ export const ThemeConfig = z
|
|
|
94
94
|
search: z
|
|
95
95
|
.object({
|
|
96
96
|
placement: z.string().default('navbar').optional(),
|
|
97
|
+
shortcuts: z.array(z.string()).default(['/']).optional(),
|
|
97
98
|
})
|
|
98
99
|
.extend(HideConfig.shape)
|
|
99
100
|
.strict()
|
|
@@ -195,4 +196,7 @@ export type ThemeUIConfig = Omit<ThemeConfig, 'navbar' | 'footer' | 'links' | 's
|
|
|
195
196
|
}[];
|
|
196
197
|
devLogin?: boolean;
|
|
197
198
|
};
|
|
199
|
+
search?: {
|
|
200
|
+
shortcuts?: string[];
|
|
201
|
+
};
|
|
198
202
|
};
|
package/src/globalStyle.ts
CHANGED
|
@@ -1804,6 +1804,16 @@ const markdown = css`
|
|
|
1804
1804
|
--md-numbered-list-number-padding: 0 5px; // @presenter Spacing
|
|
1805
1805
|
|
|
1806
1806
|
// @tokens End
|
|
1807
|
+
|
|
1808
|
+
/**
|
|
1809
|
+
* @tokens Markdown Tabs
|
|
1810
|
+
*/
|
|
1811
|
+
|
|
1812
|
+
--md-tabs-tab-text-color: var(--color-emphasis-600); // @presenter Color
|
|
1813
|
+
--md-tabs-active-tab-border-color: var(--text-color); // @presenter Color
|
|
1814
|
+
--md-tabs-hover-tab-border-color: var(--text-color-secondary); // @presenter Color
|
|
1815
|
+
|
|
1816
|
+
// @tokens End
|
|
1807
1817
|
`;
|
|
1808
1818
|
|
|
1809
1819
|
const search = css`
|
|
@@ -1904,7 +1914,55 @@ const tile = css`
|
|
|
1904
1914
|
`;
|
|
1905
1915
|
|
|
1906
1916
|
const apiLogsTable = css`
|
|
1907
|
-
--api-logs-row-hover-background-color: var(--color-secondary-300)
|
|
1917
|
+
--api-logs-row-hover-background-color: var(--color-secondary-300);
|
|
1918
|
+
`
|
|
1919
|
+
|
|
1920
|
+
const pages = css`
|
|
1921
|
+
/**
|
|
1922
|
+
* @tokens 404 Page
|
|
1923
|
+
* @presenter Color
|
|
1924
|
+
*/
|
|
1925
|
+
|
|
1926
|
+
--page-404-font-family: var(--font-family-base); // @presenter FontFamily
|
|
1927
|
+
|
|
1928
|
+
--page-404-header-text-color: #000;
|
|
1929
|
+
--page-404-header-font-size: 14em; // @presenter FontSize
|
|
1930
|
+
--page-404-header-font-weight: 600; // @presenter FontWeight
|
|
1931
|
+
--page-404-header-line-height: 1.2; // @presenter LineHeight
|
|
1932
|
+
--page-404-header-margin: 0; // @presenter Spacing
|
|
1933
|
+
|
|
1934
|
+
--page-404-description-text-color: #000;
|
|
1935
|
+
--page-404-description-font-size: 2em; // @presenter FontSize
|
|
1936
|
+
--page-404-description-font-weight: 400; // @presenter FontWeight
|
|
1937
|
+
--page-404-description-line-height: 1; // @presenter LineHeight
|
|
1938
|
+
--page-404-description-margin: 0; // @presenter Spacing
|
|
1939
|
+
|
|
1940
|
+
--page-404-button-margin: 4em; // @presenter Spacing
|
|
1941
|
+
|
|
1942
|
+
// @tokens End
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* @tokens 403 Page
|
|
1946
|
+
* @presenter Color
|
|
1947
|
+
*/
|
|
1948
|
+
|
|
1949
|
+
--page-403-font-family: var(--font-family-base); // @presenter FontFamily
|
|
1950
|
+
|
|
1951
|
+
--page-403-header-text-color: #000;
|
|
1952
|
+
--page-403-header-font-size: 14em; // @presenter FontSize
|
|
1953
|
+
--page-403-header-font-weight: 600; // @presenter FontWeight
|
|
1954
|
+
--page-403-header-line-height: 1.2; // @presenter LineHeight
|
|
1955
|
+
--page-403-header-margin: 0; // @presenter Spacing
|
|
1956
|
+
|
|
1957
|
+
--page-403-description-text-color: #000;
|
|
1958
|
+
--page-403-description-font-size: 2em; // @presenter FontSize
|
|
1959
|
+
--page-403-description-font-weight: 400; // @presenter FontWeight
|
|
1960
|
+
--page-403-description-line-height: 1; // @presenter LineHeight
|
|
1961
|
+
--page-403-description-margin: 0; // @presenter Spacing
|
|
1962
|
+
|
|
1963
|
+
--page-403-button-margin: 4em; // @presenter Spacing
|
|
1964
|
+
|
|
1965
|
+
// @tokens End
|
|
1908
1966
|
`
|
|
1909
1967
|
|
|
1910
1968
|
export const styles = css`
|
|
@@ -1936,6 +1994,7 @@ export const styles = css`
|
|
|
1936
1994
|
${tile}
|
|
1937
1995
|
${loadProgressBar}
|
|
1938
1996
|
${apiLogsTable}
|
|
1997
|
+
${pages}
|
|
1939
1998
|
}
|
|
1940
1999
|
|
|
1941
2000
|
:root.dark {
|
package/src/index.ts
CHANGED
package/src/mocks/Link.tsx
CHANGED
|
@@ -11,6 +11,7 @@ export function Link(props: any): JSX.Element {
|
|
|
11
11
|
external: _4,
|
|
12
12
|
...filteredProps
|
|
13
13
|
} = props;
|
|
14
|
+
|
|
14
15
|
// We omit "active" property to avoid "Warning: Received `false` for a non-boolean attribute `active`."
|
|
15
|
-
return <a href={filteredProps.to} {...filteredProps} />;
|
|
16
|
+
return <a href={filteredProps.to} ref={filteredProps.innerRef} {...filteredProps} />;
|
|
16
17
|
}
|
package/src/mocks/hooks/index.ts
CHANGED
|
@@ -8,7 +8,11 @@ interface PageLink {
|
|
|
8
8
|
|
|
9
9
|
export function useThemeConfig<T extends Record<string, unknown>>(): T & ThemeUIConfig {
|
|
10
10
|
return {
|
|
11
|
-
search: {
|
|
11
|
+
search: {
|
|
12
|
+
hide: false,
|
|
13
|
+
placement: 'navbar',
|
|
14
|
+
shortcuts: ['ctrl+f', 'cmd+k', '/'],
|
|
15
|
+
},
|
|
12
16
|
markdown: {
|
|
13
17
|
toc: { depth: 3, header: 'Table of contents', hide: false },
|
|
14
18
|
lastUpdatedBlock: { hide: false, format: 'timeago', locale: 'en-US' },
|
package/src/mocks/search.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
1
3
|
interface OperationParameter {
|
|
2
4
|
name: string | string[];
|
|
3
5
|
description: string | string[];
|
|
@@ -21,11 +23,24 @@ export function useFuseSearch(): {
|
|
|
21
23
|
setQuery: (val: string) => void;
|
|
22
24
|
items: SearchDocument[];
|
|
23
25
|
} {
|
|
26
|
+
const [query, setQuery] = useState('');
|
|
27
|
+
|
|
24
28
|
return {
|
|
25
|
-
query
|
|
26
|
-
setQuery
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
query,
|
|
30
|
+
setQuery,
|
|
31
|
+
items: [
|
|
32
|
+
{
|
|
33
|
+
id: '1',
|
|
34
|
+
url: '#someUrl1',
|
|
35
|
+
title: 'Some Dummy Result Item 1',
|
|
36
|
+
text: 'Some sample search text',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: '2',
|
|
40
|
+
url: '#someUrl2',
|
|
41
|
+
title: 'Some Dummy Result Item 2',
|
|
42
|
+
text: 'Some sample search text 2',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
30
45
|
};
|
|
31
46
|
}
|
package/src/ui/darkColors.tsx
CHANGED
|
@@ -59,8 +59,13 @@ export const darkMode = css`
|
|
|
59
59
|
--copy-button-tooltip-background-color: var(--tooltip-background-color);
|
|
60
60
|
--tooltip-text-color: #fff;
|
|
61
61
|
--md-table-head-background-color: var(--color-secondary-300);
|
|
62
|
+
--md-tabs-hover-tab-border-color: var(--color-secondary-500);
|
|
62
63
|
--wide-tile-background-color: #000000;
|
|
63
64
|
--thin-tile-background-color: #000000;
|
|
65
|
+
--page-404-header-text-color: #fff;
|
|
66
|
+
--page-404-description-text-color: #fff;
|
|
67
|
+
--page-403-header-text-color: #fff;
|
|
68
|
+
--page-403-description-text-color: #fff;
|
|
64
69
|
|
|
65
70
|
background-color: var(--background-color);
|
|
66
71
|
color: var(--text-color);
|