@redocly/theme 0.25.1-beta.4 → 0.25.2
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/Catalog/useCatalog.js +3 -4
- package/lib/components/CodeBlock/CodeBlockControls.js +1 -1
- 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/Feedback.js +1 -1
- package/lib/components/Feedback/Mood.js +15 -18
- package/lib/components/Feedback/Rating.js +12 -12
- package/lib/components/Feedback/Reasons.js +4 -9
- package/lib/components/Feedback/ReportDialog.js +16 -3
- package/lib/components/Feedback/Sentiment.js +13 -15
- package/lib/components/Feedback/Thumbs.js +2 -8
- package/lib/components/Feedback/types.d.ts +1 -1
- package/lib/components/Feedback/useReportDialog.js +6 -8
- package/lib/components/Filter/Filter.js +6 -6
- 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/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/Scorecard/Card.d.ts +1 -3
- package/lib/components/Scorecard/Card.js +2 -4
- package/lib/components/Scorecard/Gauge.d.ts +2 -5
- package/lib/components/Scorecard/Gauge.js +2 -6
- package/lib/components/Scorecard/StatusByLevelWidget.d.ts +0 -1
- package/lib/components/Scorecard/StatusByLevelWidget.js +2 -5
- 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/config.d.ts +0 -6
- package/lib/config.js +0 -1
- 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/lib/types/portal/src/shared/types/feedback.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/Catalog/Catalog.tsx +1 -4
- package/src/components/Catalog/useCatalog.ts +3 -6
- package/src/components/CodeBlock/CodeBlockControls.tsx +0 -1
- 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/Feedback.tsx +2 -2
- package/src/components/Feedback/Mood.tsx +25 -20
- package/src/components/Feedback/Rating.tsx +15 -14
- package/src/components/Feedback/Reasons.tsx +6 -11
- package/src/components/Feedback/ReportDialog.tsx +6 -2
- package/src/components/Feedback/Sentiment.tsx +15 -17
- package/src/components/Feedback/Thumbs.tsx +2 -9
- package/src/components/Feedback/types.ts +1 -1
- package/src/components/Feedback/useReportDialog.ts +6 -8
- package/src/components/Filter/Filter.tsx +9 -6
- 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/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/Scorecard/Card.tsx +2 -4
- package/src/components/Scorecard/Gauge.tsx +7 -16
- package/src/components/Scorecard/StatusByLevelWidget.tsx +2 -6
- 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/config.ts +0 -1
- 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
- package/src/types/portal/src/shared/types/feedback.ts +1 -0
|
@@ -12,19 +12,16 @@ export interface LoginLinkProps {
|
|
|
12
12
|
export function LoginLink({ href }: LoginLinkProps): JSX.Element {
|
|
13
13
|
const { userProfile } = useThemeConfig();
|
|
14
14
|
const { translate } = useTranslate();
|
|
15
|
-
const translationKeys = {
|
|
16
|
-
login: 'theme.profile.login',
|
|
17
|
-
};
|
|
18
15
|
|
|
19
16
|
return (
|
|
20
17
|
<StyledLink
|
|
21
18
|
href={href}
|
|
22
|
-
data-translation-key=
|
|
19
|
+
data-translation-key="theme.profile.login"
|
|
23
20
|
onClick={() => {
|
|
24
21
|
telemetry.send('login_button_clicked', {});
|
|
25
22
|
}}
|
|
26
23
|
>
|
|
27
|
-
{translate(
|
|
24
|
+
{translate('theme.profile.login', userProfile?.loginLabel || 'Login')}
|
|
28
25
|
</StyledLink>
|
|
29
26
|
);
|
|
30
27
|
}
|
|
@@ -12,9 +12,6 @@ export function MobileUserProfile() {
|
|
|
12
12
|
const { userProfile } = useThemeConfig();
|
|
13
13
|
const { userData, handleLogout, loginUrl } = useProfileProps();
|
|
14
14
|
const { translate } = useTranslate();
|
|
15
|
-
const translationKeys = {
|
|
16
|
-
login: 'theme.profile.login',
|
|
17
|
-
};
|
|
18
15
|
|
|
19
16
|
if (!userData?.isAuthenticated && !loginUrl) return null;
|
|
20
17
|
|
|
@@ -26,7 +23,7 @@ export function MobileUserProfile() {
|
|
|
26
23
|
data-cy="login-btn"
|
|
27
24
|
onClick={() => telemetry.send('login_button_clicked', {})}
|
|
28
25
|
>
|
|
29
|
-
{translate(
|
|
26
|
+
{translate('theme.profile.login', userProfile?.loginLabel || 'Login')}
|
|
30
27
|
</LoginButton>
|
|
31
28
|
) : (
|
|
32
29
|
<>
|
|
@@ -18,18 +18,15 @@ export function UserProfile({
|
|
|
18
18
|
}: UserProfileProps): JSX.Element {
|
|
19
19
|
const { userProfile } = useThemeConfig();
|
|
20
20
|
const { translate } = useTranslate();
|
|
21
|
-
|
|
22
|
-
myApps: 'theme.profile.myApps',
|
|
23
|
-
logout: 'theme.profile.logout',
|
|
24
|
-
};
|
|
21
|
+
|
|
25
22
|
const [isOpened, setIsOpened] = useState<boolean>(false);
|
|
26
23
|
|
|
27
24
|
const menuItems: JSX.Element[] = [<UserProfileData key={userData.name} userData={userData} />];
|
|
28
25
|
|
|
29
26
|
if (hasDeveloperOnboarding) {
|
|
30
27
|
menuItems.push(
|
|
31
|
-
<Link to="/apps" data-translation-key=
|
|
32
|
-
{translate(
|
|
28
|
+
<Link to="/apps" data-translation-key="theme.profile.myApps">
|
|
29
|
+
{translate('theme.profile.myApps', 'My Apps')}
|
|
33
30
|
</Link>,
|
|
34
31
|
);
|
|
35
32
|
}
|
|
@@ -55,11 +52,11 @@ export function UserProfile({
|
|
|
55
52
|
handleLogout();
|
|
56
53
|
telemetry.send('logout_menu_item_clicked', {});
|
|
57
54
|
}}
|
|
58
|
-
data-translation-key=
|
|
55
|
+
data-translation-key="theme.profile.logout"
|
|
59
56
|
role="link"
|
|
60
57
|
>
|
|
61
58
|
<LogoutIcon />
|
|
62
|
-
{translate(
|
|
59
|
+
{translate('theme.profile.logout', userProfile?.logoutLabel || 'Log out')}
|
|
63
60
|
</Logout>,
|
|
64
61
|
);
|
|
65
62
|
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
|
-
export const ScorecardCard = styled.div
|
|
4
|
-
'data-component-name': 'Scorecard/ScorecardCard',
|
|
5
|
-
})`
|
|
3
|
+
export const ScorecardCard = styled.div`
|
|
6
4
|
color: var(--text-primary);
|
|
7
|
-
background-color: var(--
|
|
5
|
+
background-color: var(--thin-tile-background-color);
|
|
8
6
|
border-radius: 4px;
|
|
9
7
|
|
|
10
8
|
border: 1px solid var(--border-primary);
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export function Gauge({
|
|
5
|
+
chunks,
|
|
6
|
+
}: {
|
|
4
7
|
chunks: {
|
|
5
8
|
share: number;
|
|
6
9
|
color: string;
|
|
7
|
-
title?: string;
|
|
8
10
|
}[];
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function Gauge({ chunks, className }: GaugeProps) {
|
|
13
|
-
const title = chunks
|
|
14
|
-
.map((chunk) => chunk.title)
|
|
15
|
-
.filter(Boolean)
|
|
16
|
-
.join(', ');
|
|
11
|
+
}) {
|
|
17
12
|
return (
|
|
18
|
-
<GaugeWrapper
|
|
19
|
-
data-component-name="Scorecard/StatusByLevelWidget"
|
|
20
|
-
className={className}
|
|
21
|
-
title={title}
|
|
22
|
-
>
|
|
13
|
+
<GaugeWrapper>
|
|
23
14
|
{chunks.map((chunk, i) => (
|
|
24
|
-
<GaugeChunk key={i}
|
|
15
|
+
<GaugeChunk key={i} {...chunk} />
|
|
25
16
|
))}
|
|
26
17
|
</GaugeWrapper>
|
|
27
18
|
);
|
|
@@ -7,13 +7,12 @@ import { ScorecardCard, ScorecardCardTitle } from '@theme/components/Scorecard/C
|
|
|
7
7
|
export interface StatusByLevelWidgetProps {
|
|
8
8
|
title: string;
|
|
9
9
|
levels: { name: string; errors: number; warnings: number; total: number }[];
|
|
10
|
-
className?: string;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export function StatusByLevelWidget(props: StatusByLevelWidgetProps) {
|
|
14
|
-
const { levels, title
|
|
13
|
+
const { levels, title } = props;
|
|
15
14
|
return (
|
|
16
|
-
<ScorecardCard
|
|
15
|
+
<ScorecardCard>
|
|
17
16
|
<ScorecardCardTitle>{title}</ScorecardCardTitle>
|
|
18
17
|
<CardBody>
|
|
19
18
|
{levels.map((level) => {
|
|
@@ -26,17 +25,14 @@ export function StatusByLevelWidget(props: StatusByLevelWidgetProps) {
|
|
|
26
25
|
{
|
|
27
26
|
share: (success / level.total) * 100,
|
|
28
27
|
color: 'var(--scorecard-color-success)',
|
|
29
|
-
title: `${success} passed`,
|
|
30
28
|
},
|
|
31
29
|
{
|
|
32
30
|
share: (level.warnings / level.total) * 100,
|
|
33
31
|
color: 'var(--scorecard-color-warning)',
|
|
34
|
-
title: `${level.warnings} ${level.warnings === 1 ? 'warning' : 'warnings'}`,
|
|
35
32
|
},
|
|
36
33
|
{
|
|
37
34
|
share: (level.errors / level.total) * 100,
|
|
38
35
|
color: 'var(--scorecard-color-error)',
|
|
39
|
-
title: `${level.errors} ${level.errors === 1 ? 'error' : 'errors'}`,
|
|
40
36
|
},
|
|
41
37
|
]}
|
|
42
38
|
/>
|
|
@@ -12,14 +12,11 @@ export function CancelSearch({
|
|
|
12
12
|
className?: string;
|
|
13
13
|
}): JSX.Element {
|
|
14
14
|
const { translate } = useTranslate();
|
|
15
|
-
const translationKeys = {
|
|
16
|
-
cancel: 'theme.search.cancel',
|
|
17
|
-
};
|
|
18
15
|
|
|
19
16
|
return (
|
|
20
17
|
<Wrapper data-component-name="Search/CancelSearch" onClick={onClick} className={className}>
|
|
21
|
-
<Button data-translation-keys=
|
|
22
|
-
{translate(
|
|
18
|
+
<Button data-translation-keys="theme.search.cancel" fullWidth variant="outlined">
|
|
19
|
+
{translate('theme.search.cancel', 'Cancel')}
|
|
23
20
|
</Button>
|
|
24
21
|
</Wrapper>
|
|
25
22
|
);
|
|
@@ -15,9 +15,6 @@ export function RecentSearches({
|
|
|
15
15
|
}) {
|
|
16
16
|
const { items, removeSearchHistoryItem } = useRecentSearches();
|
|
17
17
|
const { translate } = useTranslate();
|
|
18
|
-
const translationKeys = {
|
|
19
|
-
title: 'theme.search.recent',
|
|
20
|
-
};
|
|
21
18
|
|
|
22
19
|
if (!items || !items.length) return null;
|
|
23
20
|
|
|
@@ -34,8 +31,8 @@ export function RecentSearches({
|
|
|
34
31
|
|
|
35
32
|
return (
|
|
36
33
|
<Wrapper data-component-name="Search/RecentSearches" className={className}>
|
|
37
|
-
<Title data-translation-key=
|
|
38
|
-
{translate(
|
|
34
|
+
<Title data-translation-key="theme.search.recent">
|
|
35
|
+
{translate('theme.search.recent', 'Recent searches')}
|
|
39
36
|
</Title>
|
|
40
37
|
<RecentItems>
|
|
41
38
|
{items.map((item) => (
|
|
@@ -39,13 +39,6 @@ export const SearchDialog = ({
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const translationKeys = {
|
|
43
|
-
noResults: 'theme.search.noResults',
|
|
44
|
-
navigate: 'theme.search.keys.navigate',
|
|
45
|
-
select: 'theme.search.keys.select',
|
|
46
|
-
exit: 'theme.search.keys.exit',
|
|
47
|
-
};
|
|
48
|
-
|
|
49
42
|
const mapItem = (item: SearchDocument) => {
|
|
50
43
|
return (
|
|
51
44
|
<SearchItem key={item.id} item={item} product={!product ? item.product?.name : undefined} />
|
|
@@ -74,8 +67,8 @@ export const SearchDialog = ({
|
|
|
74
67
|
items.length ? (
|
|
75
68
|
items.map(mapItem)
|
|
76
69
|
) : (
|
|
77
|
-
<Message data-translation-key=
|
|
78
|
-
{translate(
|
|
70
|
+
<Message data-translation-key="theme.search.noResults">
|
|
71
|
+
{translate('theme.search.noResults', 'No results')}
|
|
79
72
|
</Message>
|
|
80
73
|
)
|
|
81
74
|
) : (
|
|
@@ -88,19 +81,19 @@ export const SearchDialog = ({
|
|
|
88
81
|
<BottomContainer>
|
|
89
82
|
<Shortcuts>
|
|
90
83
|
<Shortcut
|
|
91
|
-
data-translation-key=
|
|
84
|
+
data-translation-key="theme.search.keys.navigate"
|
|
92
85
|
combination="Tab"
|
|
93
|
-
text={translate(
|
|
86
|
+
text={translate('theme.search.keys.navigate', 'to navigate')}
|
|
94
87
|
/>
|
|
95
88
|
<Shortcut
|
|
96
|
-
data-translation-key=
|
|
89
|
+
data-translation-key="theme.search.keys.select"
|
|
97
90
|
combination="↵"
|
|
98
|
-
text={translate(
|
|
91
|
+
text={translate('theme.search.keys.select', 'to select')}
|
|
99
92
|
/>
|
|
100
93
|
<Shortcut
|
|
101
|
-
data-translation-key=
|
|
94
|
+
data-translation-key="theme.search.keys.exit"
|
|
102
95
|
combination="Esc"
|
|
103
|
-
text={translate(
|
|
96
|
+
text={translate('theme.search.keys.exit', 'to exit')}
|
|
104
97
|
/>
|
|
105
98
|
</Shortcuts>
|
|
106
99
|
<CancelSearch onClick={onClose} />
|
|
@@ -15,16 +15,14 @@ export function SearchTrigger({
|
|
|
15
15
|
}): JSX.Element {
|
|
16
16
|
const themeSettings = useThemeConfig();
|
|
17
17
|
const { translate } = useTranslate();
|
|
18
|
-
|
|
19
|
-
label: 'theme.search.navbar.label',
|
|
20
|
-
};
|
|
18
|
+
|
|
21
19
|
const keyShortcuts = themeSettings?.search?.shortcuts ?? ['/'];
|
|
22
20
|
|
|
23
21
|
return (
|
|
24
22
|
<Wrapper data-component-name="Search/SearchTrigger" onClick={onClick} className={className}>
|
|
25
23
|
<SearchIconSmall />
|
|
26
|
-
<Label data-translation-key=
|
|
27
|
-
{translate(
|
|
24
|
+
<Label data-translation-key="theme.search.navbar.label">
|
|
25
|
+
{translate('theme.search.navbar.label', 'Search')}
|
|
28
26
|
</Label>
|
|
29
27
|
<ShortcutKey keyShortcuts={keyShortcuts} />
|
|
30
28
|
</Wrapper>
|
|
@@ -9,16 +9,12 @@ import { useTranslate } from '@portal/hooks';
|
|
|
9
9
|
export function SuggestedPages({ className }: { className?: string }) {
|
|
10
10
|
const pages = useSuggestedPages();
|
|
11
11
|
const { translate } = useTranslate();
|
|
12
|
-
const translationKeys = {
|
|
13
|
-
title: 'theme.search.suggested',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
12
|
if (!pages.length) return null;
|
|
17
13
|
|
|
18
14
|
return (
|
|
19
15
|
<Wrapper data-component-name="Search/SuggestedPages" className={className}>
|
|
20
|
-
<Title data-translation-key=
|
|
21
|
-
{translate(
|
|
16
|
+
<Title data-translation-key="theme.search.suggested">
|
|
17
|
+
{translate('theme.search.suggested', 'Suggested pages')}
|
|
22
18
|
</Title>
|
|
23
19
|
<SuggestedItems>
|
|
24
20
|
{pages.map(
|
|
@@ -15,19 +15,16 @@ export function DrilldownMenu({
|
|
|
15
15
|
className,
|
|
16
16
|
}: React.PropsWithChildren<DrilldownMenuProps>): JSX.Element {
|
|
17
17
|
const { translate } = useTranslate();
|
|
18
|
-
const translationKeys = {
|
|
19
|
-
backLabel: 'theme.sidebar.menu.backLabel',
|
|
20
|
-
};
|
|
21
18
|
const label =
|
|
22
19
|
item.label === prevActiveItem?.label || !prevActiveItem?.label
|
|
23
|
-
? translate(
|
|
20
|
+
? translate('theme.sidebar.menu.backLabel', 'Back')
|
|
24
21
|
: prevActiveItem?.label;
|
|
25
22
|
|
|
26
23
|
return (
|
|
27
24
|
<MenuContainer data-component-name="Sidebar/DrilldownMenu" className={className}>
|
|
28
25
|
<MenuContent>
|
|
29
26
|
<MenuWrapper>
|
|
30
|
-
<BackButton back={back} data-translation-key=
|
|
27
|
+
<BackButton back={back} data-translation-key="theme.sidebar.menu.backLabel">
|
|
31
28
|
{label}
|
|
32
29
|
</BackButton>
|
|
33
30
|
<MenuLinkItem item={item}>
|
|
@@ -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) => {
|
package/src/config.ts
CHANGED
|
@@ -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;
|