@redocly/theme 0.25.1 → 0.25.3
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/components/Catalog/Catalog.js +1 -4
- package/lib/components/CopyButton/CopyButton.js +2 -7
- package/lib/components/EditPageButton/EditPageButton.js +1 -4
- package/lib/components/Feedback/Comment.js +4 -10
- package/lib/components/Feedback/Mood.js +6 -13
- package/lib/components/Feedback/Rating.js +2 -6
- package/lib/components/Feedback/Reasons.js +4 -9
- package/lib/components/Feedback/Sentiment.js +4 -10
- package/lib/components/Feedback/Thumbs.js +2 -8
- package/lib/components/Feedback/useReportDialog.js +3 -8
- package/lib/components/Filter/Filter.js +1 -5
- package/lib/components/Filter/FilterContent.js +2 -6
- package/lib/components/Filter/FilterPopover.js +2 -6
- package/lib/components/Footer/FooterCopyright.js +2 -5
- package/lib/components/LastUpdated/LastUpdated.js +1 -1
- package/lib/components/Markdown/styledVariables.js +54 -0
- package/lib/components/Menu/hooks/use-mobile-menu-items.js +1 -4
- package/lib/components/Menu/hooks/use-mobile-menu-levels.js +2 -6
- package/lib/components/Menu/utils.d.ts +2 -1
- package/lib/components/Profile/LoginLink.js +2 -5
- package/lib/components/Profile/MobileUserProfile.js +1 -4
- package/lib/components/Profile/UserProfile.js +3 -7
- package/lib/components/Search/CancelSearch.js +1 -4
- package/lib/components/Search/RecentSearches.js +1 -4
- package/lib/components/Search/SearchDialog.js +4 -10
- package/lib/components/Search/SearchTrigger.js +1 -4
- package/lib/components/Search/SuggestedPages.js +1 -4
- package/lib/components/Sidebar/DrilldownMenu.js +2 -5
- package/lib/components/Sidebar/VersionPicker.js +2 -6
- package/lib/components/TableOfContent/TableOfContent.js +1 -4
- package/lib/components/Tabs/Tab.js +30 -6
- package/lib/components/Tabs/Tabs.js +22 -8
- package/lib/layouts/Forbidden.js +2 -6
- package/lib/layouts/NotFound.js +2 -6
- package/lib/layouts/OIDCForbidden.js +1 -4
- package/lib/mocks/hooks/index.d.ts +3 -2
- package/lib/mocks/hooks/index.js +3 -4
- package/package.json +2 -2
- package/src/components/Catalog/Catalog.tsx +1 -4
- package/src/components/CopyButton/CopyButton.tsx +3 -8
- package/src/components/EditPageButton/EditPageButton.tsx +2 -5
- package/src/components/Feedback/Comment.tsx +14 -14
- package/src/components/Feedback/Mood.tsx +14 -15
- package/src/components/Feedback/Rating.tsx +4 -8
- package/src/components/Feedback/Reasons.tsx +6 -11
- package/src/components/Feedback/Sentiment.tsx +6 -12
- package/src/components/Feedback/Thumbs.tsx +2 -9
- package/src/components/Feedback/useReportDialog.ts +3 -8
- package/src/components/Filter/Filter.tsx +3 -5
- package/src/components/Filter/FilterContent.tsx +2 -6
- package/src/components/Filter/FilterPopover.tsx +2 -6
- package/src/components/Footer/FooterCopyright.tsx +2 -5
- package/src/components/LastUpdated/LastUpdated.tsx +1 -1
- package/src/components/Markdown/styledVariables.ts +54 -0
- package/src/components/Menu/hooks/use-mobile-menu-items.ts +1 -5
- package/src/components/Menu/hooks/use-mobile-menu-levels.ts +2 -7
- package/src/components/Menu/utils.ts +2 -1
- package/src/components/Profile/LoginLink.tsx +2 -5
- package/src/components/Profile/MobileUserProfile.tsx +1 -4
- package/src/components/Profile/UserProfile.tsx +5 -8
- package/src/components/Search/CancelSearch.tsx +2 -5
- package/src/components/Search/RecentSearches.tsx +2 -5
- package/src/components/Search/SearchDialog.tsx +8 -15
- package/src/components/Search/SearchTrigger.tsx +3 -5
- package/src/components/Search/SuggestedPages.tsx +2 -6
- package/src/components/Sidebar/DrilldownMenu.tsx +2 -5
- package/src/components/Sidebar/VersionPicker.tsx +3 -7
- package/src/components/TableOfContent/TableOfContent.tsx +2 -5
- package/src/components/Tabs/Tab.tsx +30 -6
- package/src/components/Tabs/Tabs.tsx +22 -8
- package/src/layouts/Forbidden.tsx +4 -13
- package/src/layouts/NotFound.tsx +4 -13
- package/src/layouts/OIDCForbidden.tsx +2 -6
- package/src/mocks/hooks/index.ts +7 -6
|
@@ -16,10 +16,6 @@ export function VersionPicker(props: { versions?: Version[]; onChange: (v: Versi
|
|
|
16
16
|
const { versionPicker } = themeConfig;
|
|
17
17
|
|
|
18
18
|
const { translate } = useTranslate();
|
|
19
|
-
const translationKeys = {
|
|
20
|
-
label: 'theme.versionPicker.label',
|
|
21
|
-
unversioned: 'theme.versionPicker.unversioned',
|
|
22
|
-
};
|
|
23
19
|
|
|
24
20
|
const { versions = [], onChange } = props;
|
|
25
21
|
const options = versions.map((version) => {
|
|
@@ -40,11 +36,11 @@ export function VersionPicker(props: { versions?: Version[]; onChange: (v: Versi
|
|
|
40
36
|
|
|
41
37
|
return (
|
|
42
38
|
<VersionsPickerWrapper>
|
|
43
|
-
<VersionPickerLabel data-translation-key=
|
|
44
|
-
{translate(
|
|
39
|
+
<VersionPickerLabel data-translation-key="theme.versionPicker.label">
|
|
40
|
+
{translate('theme.versionPicker.label', 'Version:')}
|
|
45
41
|
</VersionPickerLabel>
|
|
46
42
|
<VersionPickerSelect
|
|
47
|
-
placeholder={translate(
|
|
43
|
+
placeholder={translate('theme.versionPicker.unversioned', 'All versions')}
|
|
48
44
|
disabled={!options.length}
|
|
49
45
|
options={options}
|
|
50
46
|
value={value}
|
|
@@ -35,9 +35,6 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const { translate } = useTranslate();
|
|
38
|
-
const translationKeys = {
|
|
39
|
-
header: 'theme.toc.header',
|
|
40
|
-
};
|
|
41
38
|
|
|
42
39
|
if (toc?.hide) {
|
|
43
40
|
return null;
|
|
@@ -48,8 +45,8 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
|
48
45
|
<TableOfContentMenu data-component-name="TableOfContent/TableOfContent" className={className}>
|
|
49
46
|
<TableOfContentItems ref={sidebar}>
|
|
50
47
|
{displayedHeadings.length ? (
|
|
51
|
-
<TocHeader data-translation-key=
|
|
52
|
-
{translate(
|
|
48
|
+
<TocHeader data-translation-key="theme.toc.header">
|
|
49
|
+
{translate('theme.toc.header', toc.header || 'On this page')}
|
|
53
50
|
</TocHeader>
|
|
54
51
|
) : null}
|
|
55
52
|
{displayedHeadings.map((heading: MdHeading | null, idx: number) => {
|
|
@@ -25,21 +25,45 @@ export function Tab({ activeTab, label, onClick, className }: TabProps): JSX.Ele
|
|
|
25
25
|
const TabItem = styled.li<{ active: boolean }>`
|
|
26
26
|
display: inline-block;
|
|
27
27
|
list-style: none;
|
|
28
|
-
padding: 0.75rem 1rem;
|
|
29
28
|
cursor: pointer;
|
|
30
29
|
|
|
30
|
+
color: var(--md-tabs-tab-text-color);
|
|
31
|
+
font-size: var(--md-tabs-tab-font-size);
|
|
32
|
+
font-family: var(--md-tabs-tab-font-family);
|
|
33
|
+
font-style: var(--md-tabs-tab-font-style);
|
|
34
|
+
font-weight: var(--md-tabs-tab-font-weight);
|
|
35
|
+
background-color: var(--md-tabs-tab-background-color);
|
|
36
|
+
border-radius: var(--md-tabs-tab-border-radius);
|
|
37
|
+
padding: var(--md-tabs-tab-padding);
|
|
38
|
+
border: var(--md-tabs-tab-border);
|
|
39
|
+
border-width: var(--md-tabs-tab-border-width);
|
|
40
|
+
|
|
31
41
|
${({ active }) =>
|
|
32
42
|
active
|
|
33
|
-
? `
|
|
34
|
-
|
|
43
|
+
? `
|
|
44
|
+
color: var(--md-tabs-active-tab-text-color);
|
|
45
|
+
font-size: var(--md-tabs-active-tab-font-size);
|
|
46
|
+
font-family: var(--md-tabs-active-tab-font-family);
|
|
47
|
+
font-style: var(--md-tabs-active-tab-font-style);
|
|
48
|
+
font-weight: var(--md-tabs-active-tab-font-weight);
|
|
49
|
+
background-color: var(--md-tabs-active-tab-background-color);
|
|
50
|
+
border-radius: var(--md-tabs-active-tab-border-radius);
|
|
51
|
+
padding: var(--md-tabs-active-tab-padding);
|
|
35
52
|
border: solid var(--md-tabs-active-tab-border-color);
|
|
36
|
-
border-width:
|
|
37
|
-
color: var(--text-primary);
|
|
53
|
+
border-width: var(--md-tabs-active-tab-border-width);
|
|
38
54
|
`
|
|
39
55
|
: `
|
|
40
56
|
&:hover {
|
|
57
|
+
color: var(--md-tabs-hover-tab-text-color);
|
|
58
|
+
font-size: var(--md-tabs-hover-tab-font-size);
|
|
59
|
+
font-family: var(--md-tabs-hover-tab-font-family);
|
|
60
|
+
font-style: var(--md-tabs-hover-tab-font-style);
|
|
61
|
+
font-weight: var(--md-tabs-hover-tab-font-weight);
|
|
62
|
+
background-color: var(--md-tabs-hover-tab-background-color);
|
|
63
|
+
border-radius: var(--md-tabs-hover-tab-border-radius);
|
|
64
|
+
padding: var(--md-tabs-hover-tab-padding);
|
|
41
65
|
border: solid var(--md-tabs-hover-tab-border-color);
|
|
42
|
-
border-width:
|
|
66
|
+
border-width: var(--md-tabs-hover-tab-border-width);
|
|
43
67
|
}
|
|
44
68
|
`}
|
|
45
69
|
`;
|
|
@@ -39,7 +39,15 @@ export function Tabs(props: TabsProps): JSX.Element {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const TabsContainer = styled.div`
|
|
42
|
-
|
|
42
|
+
color: var(--md-tabs-container-text-color);
|
|
43
|
+
font-size: var(--md-tabs-container-font-size);
|
|
44
|
+
font-family: var(--md-tabs-container-font-family);
|
|
45
|
+
font-style: var(--md-tabs-container-font-style);
|
|
46
|
+
font-weight: var(--md-tabs-container-font-weight);
|
|
47
|
+
background-color: var(--md-tabs-container-background-color);
|
|
48
|
+
margin: var(--md-tabs-container-margin);
|
|
49
|
+
padding: var(--md-tabs-container-padding);
|
|
50
|
+
border: var(--md-tabs-container-border);
|
|
43
51
|
|
|
44
52
|
ol[class^='Tabs__TabList'] {
|
|
45
53
|
margin: 0;
|
|
@@ -48,18 +56,24 @@ const TabsContainer = styled.div`
|
|
|
48
56
|
`;
|
|
49
57
|
|
|
50
58
|
const TabList = styled.ol`
|
|
51
|
-
|
|
52
|
-
padding: 0;
|
|
59
|
+
padding: var(--md-tabs-padding);
|
|
53
60
|
margin-block-end: 0;
|
|
54
|
-
border:
|
|
55
|
-
border-width:
|
|
61
|
+
border: var(--md-tabs-border);
|
|
62
|
+
border-width: var(--md-tabs-border-width);
|
|
56
63
|
|
|
57
64
|
li[class^='Tab__TabItem'] {
|
|
58
|
-
margin:
|
|
59
|
-
margin-bottom: -1px;
|
|
65
|
+
margin: var(--md-tabs-tab-margin);
|
|
60
66
|
}
|
|
61
67
|
`;
|
|
62
68
|
|
|
63
69
|
const TabContent = styled.div`
|
|
64
|
-
|
|
70
|
+
color: var(--md-tabs-content-text-color);
|
|
71
|
+
font-size: var(--md-tabs-content-font-size);
|
|
72
|
+
font-family: var(--md-tabs-content-font-family);
|
|
73
|
+
font-style: var(--md-tabs-content-font-style);
|
|
74
|
+
font-weight: var(--md-tabs-content-font-weight);
|
|
75
|
+
background-color: var(--md-tabs-content-background-color);
|
|
76
|
+
margin: var(--md-tabs-content-margin);
|
|
77
|
+
padding: var(--md-tabs-content-padding);
|
|
78
|
+
border: var(--md-tabs-content-border);
|
|
65
79
|
`;
|
|
@@ -6,24 +6,15 @@ import { useTranslate } from '@portal/hooks';
|
|
|
6
6
|
|
|
7
7
|
export function Forbidden(): JSX.Element {
|
|
8
8
|
const { translate } = useTranslate();
|
|
9
|
-
const translationKeys = {
|
|
10
|
-
title: 'theme.page.forbidden.title',
|
|
11
|
-
homeButton: 'theme.page.homeButton',
|
|
12
|
-
};
|
|
13
9
|
|
|
14
10
|
return (
|
|
15
11
|
<Wrapper data-component-name="Pages/Forbidden">
|
|
16
12
|
<Header>403</Header>
|
|
17
|
-
<Description data-translation-key=
|
|
18
|
-
{translate(
|
|
13
|
+
<Description data-translation-key="theme.page.forbidden.title">
|
|
14
|
+
{translate('theme.page.forbidden.title', 'Access forbidden')}
|
|
19
15
|
</Description>
|
|
20
|
-
<HomeButton
|
|
21
|
-
|
|
22
|
-
size="large"
|
|
23
|
-
to="/"
|
|
24
|
-
data-translation-key={translationKeys.homeButton}
|
|
25
|
-
>
|
|
26
|
-
{translate(translationKeys.homeButton, 'Open Homepage')}
|
|
16
|
+
<HomeButton color="primary" size="large" to="/" data-translation-key="theme.page.homeButton">
|
|
17
|
+
{translate('theme.page.homeButton', 'Open Homepage')}
|
|
27
18
|
</HomeButton>
|
|
28
19
|
</Wrapper>
|
|
29
20
|
);
|
package/src/layouts/NotFound.tsx
CHANGED
|
@@ -6,24 +6,15 @@ import { useTranslate } from '@portal/hooks';
|
|
|
6
6
|
|
|
7
7
|
export function NotFound(): JSX.Element {
|
|
8
8
|
const { translate } = useTranslate();
|
|
9
|
-
const translationKeys = {
|
|
10
|
-
title: 'theme.page.notFound.title',
|
|
11
|
-
homeButton: 'theme.page.homeButton',
|
|
12
|
-
};
|
|
13
9
|
|
|
14
10
|
return (
|
|
15
11
|
<Wrapper data-component-name="Pages/NotFound">
|
|
16
12
|
<Header>404</Header>
|
|
17
|
-
<Description data-translation-key=
|
|
18
|
-
{translate(
|
|
13
|
+
<Description data-translation-key="theme.page.notFound.title">
|
|
14
|
+
{translate('theme.page.notFound.title', "It looks like you're lost")}
|
|
19
15
|
</Description>
|
|
20
|
-
<HomeButton
|
|
21
|
-
|
|
22
|
-
size="large"
|
|
23
|
-
to="/"
|
|
24
|
-
data-translation-key={translationKeys.homeButton}
|
|
25
|
-
>
|
|
26
|
-
{translate(translationKeys.homeButton, 'Open Homepage')}
|
|
16
|
+
<HomeButton color="primary" size="large" to="/" data-translation-key="theme.page.homeButton">
|
|
17
|
+
{translate('theme.page.homeButton', 'Open Homepage')}
|
|
27
18
|
</HomeButton>
|
|
28
19
|
</Wrapper>
|
|
29
20
|
);
|
|
@@ -9,10 +9,6 @@ export function OIDCForbidden(): JSX.Element {
|
|
|
9
9
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
10
10
|
const [errorDescription, setErrorDescription] = useState<string>('');
|
|
11
11
|
|
|
12
|
-
const translationKeys = {
|
|
13
|
-
title: 'theme.page.forbidden.title',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
12
|
// use whatever you want here
|
|
17
13
|
const URL_REGEX =
|
|
18
14
|
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
|
@@ -38,8 +34,8 @@ export function OIDCForbidden(): JSX.Element {
|
|
|
38
34
|
return (
|
|
39
35
|
<Wrapper data-component-name="Pages/OIDCForbidden">
|
|
40
36
|
<Header>403</Header>
|
|
41
|
-
<Description data-translation-key=
|
|
42
|
-
{translate(
|
|
37
|
+
<Description data-translation-key="theme.page.forbidden.title">
|
|
38
|
+
{translate('theme.page.forbidden.title', 'Access forbidden')}
|
|
43
39
|
</Description>
|
|
44
40
|
{errorDescription && <ErrorDescription>{renderText(errorDescription)}</ErrorDescription>}
|
|
45
41
|
</Wrapper>
|
package/src/mocks/hooks/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { TFunction } from '@redocly/portal-types';
|
|
2
|
+
|
|
1
3
|
import type { CatalogConfig, ProductUiConfig, ThemeUIConfig } from '@theme/config';
|
|
2
|
-
import type { ResolvedNavItem,
|
|
4
|
+
import type { ResolvedNavItem, Version } from '@theme/types/portal';
|
|
3
5
|
import type { FilteredCatalog } from '@theme/types/portal/src/shared/types/catalog';
|
|
4
6
|
interface PageLink {
|
|
5
7
|
label: string;
|
|
@@ -76,11 +78,10 @@ export function useCatalog(_items: ResolvedNavItem[], _config: CatalogConfig): F
|
|
|
76
78
|
throw new Error('Mock not implemented yet.');
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
export
|
|
80
|
-
|
|
81
|
-
(typeof options === 'string' ? options : options?.defaultValue) || value || ''
|
|
82
|
-
|
|
83
|
-
}
|
|
81
|
+
export const useTranslate = (): { translate: TFunction } => ({
|
|
82
|
+
translate: (value?: string, options?: { defaultValue: string } | string) =>
|
|
83
|
+
(typeof options === 'string' ? options : options?.defaultValue) || value || '',
|
|
84
|
+
});
|
|
84
85
|
|
|
85
86
|
export function useI18n() {
|
|
86
87
|
const changeLanguage = (...args: any) => args.value as string;
|