@redocly/theme 0.11.5 → 0.12.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/I18n/LanguagePicker.d.ts +4 -0
- package/lib/I18n/LanguagePicker.js +111 -0
- package/lib/I18n/index.d.ts +1 -0
- package/lib/I18n/index.js +6 -0
- package/lib/components/Cards/Card.js +3 -1
- package/lib/components/Catalog/Catalog.js +14 -9
- package/lib/components/Catalog/CatalogCard.js +6 -1
- package/lib/components/Catalog/useCatalog.js +4 -1
- package/lib/components/CodeSample/CodeSample.js +11 -3
- package/lib/components/Feedback/Comment.js +12 -4
- package/lib/components/Feedback/Rating.js +8 -2
- package/lib/components/Feedback/Reasons.js +11 -4
- package/lib/components/Feedback/Sentiment.js +12 -4
- package/lib/components/Feedback/Thumbs.js +31 -18
- package/lib/components/Feedback/useReportDialog.js +8 -2
- package/lib/components/Filter/Filter.js +15 -8
- package/lib/components/Footer/FooterColumn.js +4 -2
- package/lib/components/Footer/FooterCopyright.d.ts +1 -2
- package/lib/components/Footer/FooterCopyright.js +6 -1
- package/lib/components/LastUpdated/LastUpdated.js +8 -4
- package/lib/components/Markdown/MarkdownLayout.js +6 -1
- package/lib/components/Menu/MenuGroup.js +3 -1
- package/lib/components/Menu/MenuItem.js +3 -1
- package/lib/components/Navbar/MobileNavbarItem.js +6 -2
- package/lib/components/Navbar/Navbar.d.ts +1 -0
- package/lib/components/Navbar/Navbar.js +6 -1
- package/lib/components/Navbar/NavbarDropdown.js +3 -1
- package/lib/components/Navbar/NavbarItem.js +9 -4
- package/lib/components/PageNavigation/NextButton.js +7 -2
- package/lib/components/PageNavigation/PreviousButton.js +10 -2
- package/lib/components/Profile/LoginLink.js +6 -1
- package/lib/components/Profile/UserProfileMenu.js +10 -4
- package/lib/components/Search/Autocomplete.d.ts +3 -3
- package/lib/components/Search/Autocomplete.js +21 -11
- package/lib/components/Search/ClearIcon.js +1 -1
- package/lib/components/Search/Search.js +6 -4
- package/lib/components/Separator/Separator.js +3 -1
- package/lib/components/Sidebar/DrilldownMenu.js +6 -1
- package/lib/components/Sidebar/DrilldownMenuItem.js +4 -2
- package/lib/components/Sidebar/types.d.ts +2 -0
- package/lib/components/TableOfContent/TableOfContent.js +6 -1
- package/lib/icons/SpinnerIcon/SpinnerIcon.d.ts +8 -0
- package/lib/icons/SpinnerIcon/SpinnerIcon.js +32 -0
- package/lib/icons/SpinnerIcon/index.d.ts +1 -0
- package/lib/icons/SpinnerIcon/index.js +6 -0
- package/lib/icons/index.d.ts +1 -0
- package/lib/icons/index.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/layouts/Forbidden.js +8 -2
- package/lib/layouts/NotFound.js +8 -2
- package/lib/mocks/hooks/index.d.ts +15 -1
- package/lib/mocks/hooks/index.js +19 -1
- package/lib/mocks/search.d.ts +1 -0
- package/lib/mocks/search.js +1 -0
- package/lib/mocks/utils.d.ts +5 -0
- package/lib/mocks/utils.js +9 -1
- package/lib/types/portal/index.d.ts +1 -0
- package/lib/types/portal/index.js +1 -0
- package/lib/types/portal/src/shared/types/catalog.d.ts +4 -0
- package/lib/types/portal/src/shared/types/nav.d.ts +7 -0
- package/package.json +1 -1
- package/src/I18n/LanguagePicker.tsx +113 -0
- package/src/I18n/index.ts +1 -0
- package/src/components/Cards/Card.tsx +5 -1
- package/src/components/Catalog/Catalog.tsx +23 -6
- package/src/components/Catalog/CatalogCard.tsx +8 -1
- package/src/components/Catalog/useCatalog.ts +4 -2
- package/src/components/CodeSample/CodeSample.tsx +22 -4
- package/src/components/Feedback/Comment.tsx +25 -4
- package/src/components/Feedback/Rating.tsx +15 -2
- package/src/components/Feedback/Reasons.tsx +23 -5
- package/src/components/Feedback/Sentiment.tsx +25 -4
- package/src/components/Feedback/Thumbs.tsx +61 -46
- package/src/components/Feedback/useReportDialog.ts +11 -2
- package/src/components/Filter/Filter.tsx +17 -9
- package/src/components/Footer/CustomFooter.tsx +1 -1
- package/src/components/Footer/FooterColumn.tsx +5 -3
- package/src/components/Footer/FooterCopyright.tsx +12 -3
- package/src/components/LastUpdated/LastUpdated.tsx +10 -2
- package/src/components/Markdown/MarkdownLayout.tsx +11 -1
- package/src/components/Menu/MenuGroup.tsx +4 -1
- package/src/components/Menu/MenuItem.tsx +3 -1
- package/src/components/Navbar/MobileNavbarItem.tsx +7 -1
- package/src/components/Navbar/Navbar.tsx +8 -0
- package/src/components/Navbar/NavbarDropdown.tsx +3 -1
- package/src/components/Navbar/NavbarItem.tsx +9 -3
- package/src/components/PageNavigation/NextButton.tsx +8 -2
- package/src/components/PageNavigation/PreviousButton.tsx +11 -2
- package/src/components/Profile/LoginLink.tsx +11 -1
- package/src/components/Profile/UserProfileMenu.tsx +13 -3
- package/src/components/Search/Autocomplete.tsx +31 -17
- package/src/components/Search/ClearIcon.tsx +1 -1
- package/src/components/Search/Search.tsx +8 -7
- package/src/components/Separator/Separator.tsx +4 -1
- package/src/components/Sidebar/DrilldownMenu.tsx +8 -1
- package/src/components/Sidebar/DrilldownMenuItem.tsx +7 -2
- package/src/components/Sidebar/types.ts +2 -0
- package/src/components/TableOfContent/TableOfContent.tsx +11 -1
- package/src/icons/SpinnerIcon/SpinnerIcon.tsx +42 -0
- package/src/icons/SpinnerIcon/index.ts +1 -0
- package/src/icons/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/layouts/Forbidden.tsx +18 -3
- package/src/layouts/NotFound.tsx +17 -3
- package/src/mocks/hooks/index.ts +20 -1
- package/src/mocks/search.ts +2 -0
- package/src/mocks/utils.ts +13 -0
- package/src/types/portal/index.ts +1 -0
- package/src/types/portal/src/shared/types/catalog.ts +4 -0
- package/src/types/portal/src/shared/types/i18n.d.ts +3 -0
- package/src/types/portal/src/shared/types/nav.ts +7 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.LanguagePicker = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
32
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
33
|
+
const utils_1 = require("../mocks/utils");
|
|
34
|
+
const usePreloadHistory_1 = require("../mocks/usePreloadHistory");
|
|
35
|
+
const hooks_1 = require("../mocks/hooks");
|
|
36
|
+
const hooks_2 = require("../hooks");
|
|
37
|
+
const LanguagePicker = (props) => {
|
|
38
|
+
const { currentLocale, locales, defaultLocale } = (0, hooks_1.useI18nConfig)();
|
|
39
|
+
const dropdownRef = (0, react_1.useRef)(null);
|
|
40
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
41
|
+
(0, hooks_2.useOutsideClick)(dropdownRef, () => setIsOpen(false));
|
|
42
|
+
const location = (0, react_router_dom_1.useLocation)();
|
|
43
|
+
const history = (0, usePreloadHistory_1.usePreloadHistory)();
|
|
44
|
+
if (locales.length < 2) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return (react_1.default.createElement(Dropdown, { "data-component-name": "I18n/LanguagePicker", ref: dropdownRef, isOpen: isOpen, onClick: () => setIsOpen(!isOpen), onBlur: () => setIsOpen(false) },
|
|
48
|
+
react_1.default.createElement(DropdownValue, null, currentLocale.toUpperCase()),
|
|
49
|
+
react_1.default.createElement(DropdownMenu, null, locales.map((locale) => (react_1.default.createElement(MenuItem, { onClick: () => {
|
|
50
|
+
const newLangPathname = (0, utils_1.withPathPrefix)((0, utils_1.getPathnameForLocale)(location.pathname, defaultLocale, locale.code, locales));
|
|
51
|
+
const newUrlWithLanguage = `${newLangPathname}${location.search}${location.hash}`;
|
|
52
|
+
history.push(newUrlWithLanguage);
|
|
53
|
+
props.onChangeLanguage(locale.code);
|
|
54
|
+
}, key: locale.code }, locale.name || locale.code || ''))))));
|
|
55
|
+
};
|
|
56
|
+
exports.LanguagePicker = LanguagePicker;
|
|
57
|
+
const Dropdown = styled_components_1.default.div `
|
|
58
|
+
font-size: var(--profile-menu-item-font-size);
|
|
59
|
+
font-family: var(--profile-menu-item-font-family);
|
|
60
|
+
font-weight: var(--profile-menu-item-font-weight);
|
|
61
|
+
line-height: var(--profile-menu-item-line-height);
|
|
62
|
+
|
|
63
|
+
${(props) => props.isOpen
|
|
64
|
+
? `
|
|
65
|
+
${DropdownMenu} {
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
`
|
|
69
|
+
: ``}
|
|
70
|
+
`;
|
|
71
|
+
const DropdownValue = styled_components_1.default.div `
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
display: block;
|
|
74
|
+
|
|
75
|
+
color: var(--navbar-text-color);
|
|
76
|
+
padding: var(--navbar-item-paddin-vertical) var(--navbar-item-padding-horizontal);
|
|
77
|
+
border-radius: var(--navbar-item-border-radius);
|
|
78
|
+
|
|
79
|
+
&:hover {
|
|
80
|
+
color: var(--navbar-item-hover-text-color);
|
|
81
|
+
text-decoration: var(--navbar-item-hover-text-decoration);
|
|
82
|
+
background: var(--navbar-item-hover-background-color);
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
const DropdownMenu = styled_components_1.default.ul `
|
|
86
|
+
position: absolute;
|
|
87
|
+
color: var(--profile-menu-item-text-color);
|
|
88
|
+
background-color: var(--profile-menu-background-color);
|
|
89
|
+
top: var(--navbar-height);
|
|
90
|
+
margin: 0;
|
|
91
|
+
box-shadow: 0 1px 2px rgb(204, 204, 204);
|
|
92
|
+
border-radius: 0 1px 2px 2px;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
display: none;
|
|
95
|
+
overflow-y: auto;
|
|
96
|
+
z-index: 9;
|
|
97
|
+
padding: 0;
|
|
98
|
+
list-style: none;
|
|
99
|
+
`;
|
|
100
|
+
const MenuItem = styled_components_1.default.li `
|
|
101
|
+
padding: 10px;
|
|
102
|
+
transition: all 0.2s ease-in-out;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
|
|
105
|
+
&:hover {
|
|
106
|
+
color: var(--profile-menu-item-hover-text-color);
|
|
107
|
+
text-decoration: var(--profile-menu-item-hover-text-decoration);
|
|
108
|
+
background: var(--profile-menu-item-hover-background-color);
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
//# sourceMappingURL=LanguagePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LanguagePicker } from '../I18n/LanguagePicker';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LanguagePicker = void 0;
|
|
4
|
+
var LanguagePicker_1 = require("../I18n/LanguagePicker");
|
|
5
|
+
Object.defineProperty(exports, "LanguagePicker", { enumerable: true, get: function () { return LanguagePicker_1.LanguagePicker; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -8,12 +8,14 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Link_1 = require("../../mocks/Link");
|
|
10
10
|
const H3_1 = require("../../components/Typography/H3");
|
|
11
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
11
12
|
function Card(props) {
|
|
13
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
12
14
|
return (react_1.default.createElement(CardWrapper, { "data-component-name": "Cards/Card" },
|
|
13
15
|
props.icon && react_1.default.createElement("img", { src: props === null || props === void 0 ? void 0 : props.icon, alt: props === null || props === void 0 ? void 0 : props.title }),
|
|
14
16
|
props.title && react_1.default.createElement(H3_1.H3, null, props.title),
|
|
15
17
|
props.links.items && (react_1.default.createElement(CardLinksList, null, props.links.items.map((item) => (react_1.default.createElement("li", { key: item.label },
|
|
16
|
-
react_1.default.createElement(Link_1.Link, { to: item.link }, item.label))))))));
|
|
18
|
+
react_1.default.createElement(Link_1.Link, { to: item.link }, translate(item.labelTranslationKey, item.label)))))))));
|
|
17
19
|
}
|
|
18
20
|
exports.Card = Card;
|
|
19
21
|
const CardWrapper = styled_components_1.default.div `
|
|
@@ -18,22 +18,27 @@ function Catalog(props) {
|
|
|
18
18
|
const items = (0, index_1.usePageSharedData)('catalog');
|
|
19
19
|
const { filterTerm, setFilterTerm, groups, filters } = (0, useCatalog_1.useCatalog)(items, catalogConfig);
|
|
20
20
|
const [isFilterPanelFocused, setIsFilterPanelFocused] = react_1.default.useState(false);
|
|
21
|
+
const { translate } = (0, index_1.useTranslate)();
|
|
22
|
+
const translationKeys = {
|
|
23
|
+
placeholder: 'theme.catalog.filters.placeholder',
|
|
24
|
+
applyFilter: 'theme.catalog.filters.apply',
|
|
25
|
+
};
|
|
21
26
|
return (react_1.default.createElement(Highlight_1.HighlightContext.Provider, { value: [filterTerm] },
|
|
22
27
|
react_1.default.createElement(CatalogPageWrapper, null,
|
|
23
28
|
react_1.default.createElement(CatalogPageSidebar, { isActiveInMobileMode: isFilterPanelFocused },
|
|
24
|
-
react_1.default.createElement(StyledInput, { placeholder:
|
|
29
|
+
react_1.default.createElement(StyledInput, { placeholder: translate(translationKeys.placeholder, 'Filter...'), value: filterTerm, onFocus: () => setIsFilterPanelFocused(true), onChange: (e) => setFilterTerm(e.target.value) }),
|
|
25
30
|
filters.map((filter, idx) => (react_1.default.createElement(Filter_1.Filter, { filter: filter, key: filter.property + '-' + idx }))),
|
|
26
31
|
react_1.default.createElement(MobileStickyApplyFilters, null,
|
|
27
|
-
react_1.default.createElement(Button_1.Button, { color: "secondary", onClick: () => setIsFilterPanelFocused(false) },
|
|
32
|
+
react_1.default.createElement(Button_1.Button, { "data-translation-key": translationKeys.applyFilter, color: "secondary", onClick: () => setIsFilterPanelFocused(false) }, translate(translationKeys.applyFilter, 'Apply filters')))),
|
|
28
33
|
react_1.default.createElement(CatalogPageContent, null,
|
|
29
|
-
catalogConfig.title ? react_1.default.createElement(CatalogTitle, null,
|
|
30
|
-
|
|
31
|
-
catalogConfig.title,
|
|
32
|
-
|
|
34
|
+
catalogConfig.title ? (react_1.default.createElement(CatalogTitle, null,
|
|
35
|
+
' ',
|
|
36
|
+
translate(catalogConfig.titleTranslationKey, catalogConfig.title),
|
|
37
|
+
' ')) : null,
|
|
33
38
|
catalogConfig.description ? (react_1.default.createElement(CatalogDescription, null,
|
|
34
|
-
|
|
35
|
-
catalogConfig.description,
|
|
36
|
-
|
|
39
|
+
' ',
|
|
40
|
+
translate(catalogConfig.descriptionTranslationKey, catalogConfig.description),
|
|
41
|
+
' ')) : null,
|
|
37
42
|
groups.map((group) => (react_1.default.createElement(react_1.default.Fragment, { key: group.title },
|
|
38
43
|
react_1.default.createElement(H3_1.H3, null,
|
|
39
44
|
group.title,
|
|
@@ -32,8 +32,13 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
32
32
|
const Link_1 = require("../../mocks/Link");
|
|
33
33
|
const Highlight_1 = require("../../ui/Highlight");
|
|
34
34
|
const Tags_1 = require("../../components/Tags");
|
|
35
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
35
36
|
function CatalogCard({ item }) {
|
|
36
37
|
var _a;
|
|
38
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
39
|
+
const translationKeys = {
|
|
40
|
+
footer: 'theme.catalog.card.footer',
|
|
41
|
+
};
|
|
37
42
|
return (React.createElement(Link_1.Link, { key: item.docsLink || item.link, to: item.docsLink || item.link },
|
|
38
43
|
React.createElement(StyledCard, null,
|
|
39
44
|
React.createElement(CardTitle, null,
|
|
@@ -42,7 +47,7 @@ function CatalogCard({ item }) {
|
|
|
42
47
|
React.createElement(Highlight_1.Highlight, null, (_a = item.description) !== null && _a !== void 0 ? _a : '')),
|
|
43
48
|
item.tags ? React.createElement(Tags_1.Tags, { tags: item.tags }) : null,
|
|
44
49
|
React.createElement("hr", null),
|
|
45
|
-
React.createElement(CardFooter,
|
|
50
|
+
React.createElement(CardFooter, { "data-translation-key": translationKeys.footer }, translate(translationKeys.footer, 'View documentation')))));
|
|
46
51
|
}
|
|
47
52
|
exports.CatalogCard = CatalogCard;
|
|
48
53
|
const StyledCard = styled_components_1.default.div `
|
|
@@ -221,7 +221,10 @@ function collectFilterOptions(items, filters) {
|
|
|
221
221
|
.map(([value, count]) => ({ value, count }))
|
|
222
222
|
.sort((a, b) => b.value.localeCompare(a.value));
|
|
223
223
|
if (othersCount) {
|
|
224
|
-
options.push({
|
|
224
|
+
options.push({
|
|
225
|
+
value: filter.missingCategoryNameTranslationKey || filter.missingCategoryName || 'Others',
|
|
226
|
+
count: othersCount,
|
|
227
|
+
});
|
|
225
228
|
}
|
|
226
229
|
return Object.assign(Object.assign({}, filter), { options });
|
|
227
230
|
});
|
|
@@ -29,11 +29,19 @@ const styled_components_1 = __importStar(require("styled-components"));
|
|
|
29
29
|
const ClipboardService_1 = require("../../utils/ClipboardService");
|
|
30
30
|
const useThemeConfig_1 = require("../../hooks/useThemeConfig");
|
|
31
31
|
const Feedback_1 = require("../../components/Feedback");
|
|
32
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
32
33
|
function CodeSample({ rawContent, highlighted, language, 'data-source': dataSource, 'data-hash': dataHash, }) {
|
|
33
34
|
const langClassName = language ? `language-${language}` : '';
|
|
34
35
|
const { codeSnippet: { copy = {}, report = {} } = {} } = (0, useThemeConfig_1.useThemeConfig)();
|
|
35
36
|
const [isCopied, setIsCopied] = (0, react_1.useState)(false);
|
|
36
37
|
const { isReportDialogShown, isReportButtonShown, reportButtonProps, reportDialogProps } = (0, Feedback_1.useReportDialog)(report);
|
|
38
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
39
|
+
const translationKeys = {
|
|
40
|
+
buttonText: 'theme.codeSnippet.copy.buttonText',
|
|
41
|
+
tooltipText: 'theme.codeSnippet.copy.tooltipText',
|
|
42
|
+
toasterText: 'theme.codeSnippet.copy.toasterText',
|
|
43
|
+
reportTitle: 'theme.codeSnippet.report.title',
|
|
44
|
+
};
|
|
37
45
|
const copyCode = (code) => {
|
|
38
46
|
ClipboardService_1.ClipboardService.copyCustom(code);
|
|
39
47
|
setIsCopied(true);
|
|
@@ -42,9 +50,9 @@ function CodeSample({ rawContent, highlighted, language, 'data-source': dataSour
|
|
|
42
50
|
return (react_1.default.createElement(Wrapper, { className: "code-sample", "data-component-name": "Markdown/CodeSample/CodeSample", "data-source": dataSource, "data-hash": dataHash },
|
|
43
51
|
react_1.default.createElement(CodeSampleButtonContainer, null,
|
|
44
52
|
!copy.hide && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
45
|
-
!isCopied && (react_1.default.createElement(Button, { onClick: () => copyCode(rawContent), title: copy.tooltipText || 'Copy to clipboard' }, copy.buttonText || 'Copy')),
|
|
46
|
-
isCopied && react_1.default.createElement(DoneIndicator, null, copy.toasterText || 'Copied!'))),
|
|
47
|
-
isReportButtonShown && react_1.default.createElement(Button, Object.assign({}, reportButtonProps),
|
|
53
|
+
!isCopied && (react_1.default.createElement(Button, { onClick: () => copyCode(rawContent), title: translate(translationKeys.tooltipText, copy.tooltipText || 'Copy to clipboard') }, translate(translationKeys.buttonText, copy.buttonText || 'Copy'))),
|
|
54
|
+
isCopied && (react_1.default.createElement(DoneIndicator, null, translate(translationKeys.toasterText, copy.toasterText || 'Copied!'))))),
|
|
55
|
+
isReportButtonShown && (react_1.default.createElement(Button, Object.assign({}, reportButtonProps), translate(translationKeys.reportTitle, 'Report'))),
|
|
48
56
|
isReportDialogShown && react_1.default.createElement(Feedback_1.ReportDialog, Object.assign({}, reportDialogProps, { location: rawContent }))),
|
|
49
57
|
react_1.default.createElement("pre", { className: langClassName },
|
|
50
58
|
react_1.default.createElement("code", { className: langClassName, dangerouslySetInnerHTML: { __html: highlighted } }))));
|
|
@@ -30,10 +30,18 @@ exports.Comment = void 0;
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Button_1 = require("../../components/Button/Button");
|
|
33
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
33
34
|
const Comment = ({ settings, onSubmit, onCancel }) => {
|
|
34
35
|
const { label, submitText } = settings || {};
|
|
35
36
|
const [text, setText] = React.useState('');
|
|
36
37
|
const [submitValue, setSubmitValue] = React.useState('');
|
|
38
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
39
|
+
const translationKeys = {
|
|
40
|
+
submitText: 'theme.feedback.settings.comment.submitText',
|
|
41
|
+
label: 'theme.feedback.settings.comment.label',
|
|
42
|
+
send: 'theme.feedback.settings.comment.send',
|
|
43
|
+
cancel: 'theme.feedback.settings.comment.cancel',
|
|
44
|
+
};
|
|
37
45
|
const send = () => {
|
|
38
46
|
if (!text)
|
|
39
47
|
return;
|
|
@@ -45,14 +53,14 @@ const Comment = ({ settings, onSubmit, onCancel }) => {
|
|
|
45
53
|
};
|
|
46
54
|
if (submitValue) {
|
|
47
55
|
return (React.createElement(Wrapper, null,
|
|
48
|
-
React.createElement(Label,
|
|
56
|
+
React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
|
|
49
57
|
}
|
|
50
58
|
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Comment" },
|
|
51
|
-
React.createElement(Label,
|
|
59
|
+
React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'Please share your feedback with us.')),
|
|
52
60
|
React.createElement(TextArea, { rows: 3, onChange: handleTextAreaChange }),
|
|
53
61
|
React.createElement(ButtonsContainer, null,
|
|
54
|
-
React.createElement(SendButton, { onClick: send },
|
|
55
|
-
onCancel && React.createElement(CancelButton, { onClick: onCancel },
|
|
62
|
+
React.createElement(SendButton, { "data-translation-key": translationKeys.send, onClick: send }, translate(translationKeys.send, 'Send')),
|
|
63
|
+
onCancel && (React.createElement(CancelButton, { "data-translation-key": translationKeys.cancel, onClick: onCancel }, translate(translationKeys.cancel, 'Cancel'))))));
|
|
56
64
|
};
|
|
57
65
|
exports.Comment = Comment;
|
|
58
66
|
const Wrapper = styled_components_1.default.div `
|
|
@@ -30,11 +30,17 @@ exports.Rating = void 0;
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Feedback_1 = require("../../components/Feedback");
|
|
33
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
33
34
|
const Rating = ({ settings, onSubmit }) => {
|
|
34
35
|
const { label, max, submitText, comment: commentSettings, reasons: reasonsSettings, } = settings || {};
|
|
35
36
|
const [score, setScore] = React.useState(0);
|
|
36
37
|
const [comment, setComment] = React.useState('');
|
|
37
38
|
const [reasons, setReasons] = React.useState([]);
|
|
39
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
40
|
+
const translationKeys = {
|
|
41
|
+
submitText: 'theme.feedback.settings.submitText',
|
|
42
|
+
label: 'theme.feedback.settings.label',
|
|
43
|
+
};
|
|
38
44
|
if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
|
|
39
45
|
const { label: reasonsLabel, items, multi } = reasonsSettings;
|
|
40
46
|
const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
|
|
@@ -50,10 +56,10 @@ const Rating = ({ settings, onSubmit }) => {
|
|
|
50
56
|
reasons,
|
|
51
57
|
});
|
|
52
58
|
return (React.createElement(Wrapper, null,
|
|
53
|
-
React.createElement(Label,
|
|
59
|
+
React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
|
|
54
60
|
}
|
|
55
61
|
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Rating" },
|
|
56
|
-
React.createElement(Label,
|
|
62
|
+
React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'How helpful was this page?')),
|
|
57
63
|
React.createElement(Stars, { max: max || 5, onSubmit: setScore })));
|
|
58
64
|
};
|
|
59
65
|
exports.Rating = Rating;
|
|
@@ -30,9 +30,16 @@ exports.Reasons = void 0;
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Button_1 = require("../../components/Button/Button");
|
|
33
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
33
34
|
const Reasons = ({ settings, onSubmit }) => {
|
|
34
35
|
const { label, multi, buttonText, items = [] } = settings;
|
|
35
36
|
const [checkedState, setCheckedState] = React.useState(new Array(items.length).fill(false));
|
|
37
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
38
|
+
const translationKeys = {
|
|
39
|
+
label: 'theme.feedback.settings.reasons.label',
|
|
40
|
+
items: 'theme.feedback.settings.reasons.items',
|
|
41
|
+
send: 'theme.feedback.settings.reasons.send',
|
|
42
|
+
};
|
|
36
43
|
if (!items.length) {
|
|
37
44
|
return React.createElement(React.Fragment, null);
|
|
38
45
|
}
|
|
@@ -46,12 +53,12 @@ const Reasons = ({ settings, onSubmit }) => {
|
|
|
46
53
|
const submitForm = () => {
|
|
47
54
|
onSubmit({ reasons: items.filter((_, index) => !!checkedState[index]) });
|
|
48
55
|
};
|
|
49
|
-
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Reasons" },
|
|
50
|
-
React.createElement(Label, null, label || 'Which statement describes your thoughts about this page?'),
|
|
56
|
+
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Reasons", "data-translation-key": translationKeys.label },
|
|
57
|
+
React.createElement(Label, null, translate(translationKeys.label, label || 'Which statement describes your thoughts about this page?')),
|
|
51
58
|
items.map((reason, idx) => (React.createElement(OptionWrapper, { key: reason },
|
|
52
59
|
React.createElement("input", { type: input_type, value: reason, checked: checkedState[idx], name: "reasons", onChange: () => handleOptionChange(idx) }),
|
|
53
|
-
React.createElement("label", { id: reason, onClick: () => handleOptionChange(idx) }, reason)))),
|
|
54
|
-
React.createElement(SendButton, { onClick: submitForm }, buttonText || 'Send')));
|
|
60
|
+
React.createElement("label", { "data-translation-key": `${translationKeys.items}.${idx + 1}`, id: reason, onClick: () => handleOptionChange(idx) }, translate(`${translationKeys.items}.${idx + 1}`, reason))))),
|
|
61
|
+
React.createElement(SendButton, { "data-translation-key": translationKeys.send, onClick: submitForm }, translate(translationKeys.send, buttonText || 'Send'))));
|
|
55
62
|
};
|
|
56
63
|
exports.Reasons = Reasons;
|
|
57
64
|
const Wrapper = styled_components_1.default.div `
|
|
@@ -31,11 +31,19 @@ const React = __importStar(require("react"));
|
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
32
|
const Feedback_1 = require("../../components/Feedback");
|
|
33
33
|
const Thumbs_1 = require("../../components/Feedback/Thumbs");
|
|
34
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
34
35
|
const Sentiment = ({ settings, onSubmit }) => {
|
|
35
36
|
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
36
37
|
const [score, setScore] = React.useState(0);
|
|
37
38
|
const [comment, setComment] = React.useState('');
|
|
38
39
|
const [reasons, setReasons] = React.useState([]);
|
|
40
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
41
|
+
const translationKeys = {
|
|
42
|
+
submitText: 'theme.feedback.settings.submitText',
|
|
43
|
+
label: 'theme.feedback.settings.label',
|
|
44
|
+
likeLabel: 'theme.feedback.settings.comment.likeLabel',
|
|
45
|
+
dislikeLabel: 'theme.feedback.settings.comment.dislikeLabel',
|
|
46
|
+
};
|
|
39
47
|
if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
|
|
40
48
|
const { label: reasonsLabel, items, multi } = reasonsSettings;
|
|
41
49
|
const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
|
|
@@ -43,8 +51,8 @@ const Sentiment = ({ settings, onSubmit }) => {
|
|
|
43
51
|
}
|
|
44
52
|
if (score && (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) && !comment) {
|
|
45
53
|
const commentLabel = score === 1
|
|
46
|
-
? commentSettings.likeLabel || 'What was most helpful?'
|
|
47
|
-
: commentSettings.dislikeLabel || 'What can we improve?';
|
|
54
|
+
? translate(translationKeys.likeLabel, commentSettings.likeLabel || 'What was most helpful?')
|
|
55
|
+
: translate(translationKeys.dislikeLabel, commentSettings.dislikeLabel || 'What can we improve?');
|
|
48
56
|
return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: commentLabel } }));
|
|
49
57
|
}
|
|
50
58
|
if (score) {
|
|
@@ -54,10 +62,10 @@ const Sentiment = ({ settings, onSubmit }) => {
|
|
|
54
62
|
reasons,
|
|
55
63
|
});
|
|
56
64
|
return (React.createElement(Wrapper, null,
|
|
57
|
-
React.createElement(Label,
|
|
65
|
+
React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
|
|
58
66
|
}
|
|
59
67
|
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Sentiment" },
|
|
60
|
-
React.createElement(Label,
|
|
68
|
+
React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'Was this page helpful?')),
|
|
61
69
|
React.createElement(Vote, { onClick: () => setScore(1) },
|
|
62
70
|
React.createElement(Thumbs_1.ThumbUp, { text: "Yes" })),
|
|
63
71
|
React.createElement(Vote, { onClick: () => setScore(-1) },
|
|
@@ -29,29 +29,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.ThumbDown = exports.ThumbUp = void 0;
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
33
|
+
const ThumbUp = ({ text }) => {
|
|
34
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
35
|
+
const translationKeys = {
|
|
36
|
+
thumbUp: 'theme.feedback.sentiment.thumbUp',
|
|
37
|
+
};
|
|
38
|
+
return (React.createElement(Wrapper, { style: { alignItems: 'normal' } },
|
|
39
|
+
React.createElement(Icon, null,
|
|
40
|
+
React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 512 512" },
|
|
36
41
|
React.createElement("g", null,
|
|
37
42
|
React.createElement("g", null,
|
|
38
|
-
React.createElement("
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
React.createElement("g", null,
|
|
44
|
+
React.createElement("path", { d: "M495.736,290.773C509.397,282.317,512,269.397,512,260.796c0-22.4-18.253-47.462-42.667-47.462H349.918\n c-4.284-0.051-25.651-1.51-25.651-25.6c0-4.71-3.814-8.533-8.533-8.533s-8.533,3.823-8.533,8.533\n c0,33.749,27.913,42.667,42.667,42.667h119.467c14.182,0,25.6,16.631,25.6,30.396c0,4.437,0,17.946-26.53,20.855\n c-4.506,0.495-7.834,4.42-7.586,8.951c0.239,4.523,3.985,8.064,8.516,8.064c14.114,0,25.6,11.486,25.6,25.6\n s-11.486,25.6-25.6,25.6h-17.067c-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c14.114,0,25.6,11.486,25.6,25.6\n s-11.486,25.6-25.6,25.6h-25.6c-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c8.934,0,17.067,8.132,17.067,17.067\n c0,8.61-8.448,17.067-17.067,17.067h-128c-35.627,0-48.444-7.074-63.292-15.258c-12.553-6.921-26.786-14.763-54.963-18.79\n c-4.668-0.674-8.994,2.577-9.66,7.236c-0.666,4.668,2.569,8.994,7.236,9.66c25.105,3.584,37.325,10.325,49.152,16.845\n c15.497,8.542,31.505,17.374,71.526,17.374h128c17.869,0,34.133-16.273,34.133-34.133c0-6.229-1.775-12.134-4.83-17.229\n c21.794-1.877,38.963-20.224,38.963-42.505c0-10.829-4.062-20.736-10.735-28.271C500.42,358.212,512,342.571,512,324.267\n C512,310.699,505.634,298.59,495.736,290.773z" }),
|
|
45
|
+
React.createElement("path", { d: "M76.8,443.733c9.412,0,17.067-7.654,17.067-17.067S86.212,409.6,76.8,409.6c-9.412,0-17.067,7.654-17.067,17.067\n S67.388,443.733,76.8,443.733z" }),
|
|
46
|
+
React.createElement("path", { d: "M179.2,247.467c25.353,0,57.429-28.297,74.3-45.167c36.634-36.634,36.634-82.167,36.634-151.1\n c0-5.342,3.191-8.533,8.533-8.533c29.508,0,42.667,13.158,42.667,42.667v102.4c0,4.71,3.814,8.533,8.533,8.533\n s8.533-3.823,8.533-8.533v-102.4c0-39.083-20.659-59.733-59.733-59.733c-14.831,0-25.6,10.769-25.6,25.6\n c0,66.978,0,107.401-31.633,139.034C216.661,215.006,192.811,230.4,179.2,230.4c-4.719,0-8.533,3.823-8.533,8.533\n S174.481,247.467,179.2,247.467z" }),
|
|
47
|
+
React.createElement("path", { d: "M145.067,213.333H8.533c-4.719,0-8.533,3.823-8.533,8.533v256c0,4.71,3.814,8.533,8.533,8.533h136.533\n c4.719,0,8.533-3.823,8.533-8.533v-256C153.6,217.156,149.786,213.333,145.067,213.333z M136.533,469.333H17.067V230.4h119.467\n V469.333z" })))))),
|
|
48
|
+
React.createElement("span", null, translate(translationKeys.thumbUp, text || 'Yes'))));
|
|
49
|
+
};
|
|
43
50
|
exports.ThumbUp = ThumbUp;
|
|
44
|
-
const ThumbDown = ({ text }) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
const ThumbDown = ({ text }) => {
|
|
52
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
53
|
+
const translationKeys = {
|
|
54
|
+
thumbDown: 'theme.feedback.sentiment.thumbDown',
|
|
55
|
+
};
|
|
56
|
+
return (React.createElement(Wrapper, { style: { alignItems: 'end' } },
|
|
57
|
+
React.createElement(Icon, null,
|
|
58
|
+
React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 512 512" },
|
|
48
59
|
React.createElement("g", null,
|
|
49
60
|
React.createElement("g", null,
|
|
50
|
-
React.createElement("
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
React.createElement("g", null,
|
|
62
|
+
React.createElement("path", { d: "M76.8,247.467c9.412,0,17.067-7.654,17.067-17.067c0-9.412-7.654-17.067-17.067-17.067\n\t\t\t\tc-9.412,0-17.067,7.654-17.067,17.067C59.733,239.812,67.388,247.467,76.8,247.467z" }),
|
|
63
|
+
React.createElement("path", { d: "M495.736,221.227C505.634,213.41,512,201.301,512,187.733c0-18.295-11.58-33.946-27.802-39.996\n\t\t\t\tc6.673-7.535,10.735-17.434,10.735-28.271c0-22.281-17.169-40.627-38.963-42.505c3.055-5.094,4.83-10.999,4.83-17.229\n\t\t\t\tc0-17.86-16.265-34.133-34.133-34.133h-128c-40.021,0-56.03,8.832-71.526,17.374c-11.827,6.519-24.047,13.261-49.152,16.845\n\t\t\t\tc-4.668,0.666-7.902,4.992-7.236,9.66c0.666,4.659,4.949,7.885,9.66,7.236c28.177-4.028,42.411-11.87,54.963-18.79\n\t\t\t\tc14.848-8.183,27.665-15.258,63.292-15.258h128c8.619,0,17.067,8.456,17.067,17.067c0,8.934-8.132,17.067-17.067,17.067\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533h25.6c14.114,0,25.6,11.486,25.6,25.6s-11.486,25.6-25.6,25.6\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533c0,4.71,3.814,8.533,8.533,8.533h17.067c14.114,0,25.6,11.486,25.6,25.6\n\t\t\t\ts-11.486,25.6-25.6,25.6c-4.531,0-8.277,3.541-8.516,8.064c-0.247,4.531,3.081,8.457,7.586,8.951\n\t\t\t\tc26.53,2.91,26.53,16.418,26.53,20.847c0,13.773-11.418,30.404-25.6,30.404H349.867c-14.763,0-42.667,8.917-42.667,42.667\n\t\t\t\tc0,4.71,3.814,8.533,8.533,8.533s8.533-3.823,8.533-8.533c0-24.09,21.367-25.549,25.6-25.6h119.467\n\t\t\t\tc24.414,0,42.667-25.054,42.667-47.471C512,242.603,509.397,229.683,495.736,221.227z" }),
|
|
64
|
+
React.createElement("path", { d: "M349.867,315.733c-4.719,0-8.533,3.823-8.533,8.533v102.4c0,29.508-13.158,42.667-42.667,42.667\n\t\t\t\tc-5.342,0-8.533-3.192-8.533-8.533c0-68.932,0-114.466-36.634-151.1c-16.87-16.87-48.947-45.167-74.3-45.167\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c13.611,0,37.461,15.394,62.234,40.166\n\t\t\t\tc31.633,31.633,31.633,72.055,31.633,139.034c0,14.831,10.769,25.6,25.6,25.6c39.074,0,59.733-20.651,59.733-59.733v-102.4\n\t\t\t\tC358.4,319.556,354.586,315.733,349.867,315.733z" }),
|
|
65
|
+
React.createElement("path", { d: "M145.067,25.6H8.533C3.814,25.6,0,29.423,0,34.133v256c0,4.71,3.814,8.533,8.533,8.533h136.533\n\t\t\t\tc4.719,0,8.533-3.823,8.533-8.533v-256C153.6,29.423,149.786,25.6,145.067,25.6z M136.533,281.6H17.067V42.667h119.467V281.6z" })))))),
|
|
66
|
+
React.createElement("span", null, translate(translationKeys.thumbDown, text || 'No'))));
|
|
67
|
+
};
|
|
55
68
|
exports.ThumbDown = ThumbDown;
|
|
56
69
|
const Wrapper = styled_components_1.default.div `
|
|
57
70
|
font-family: var(--font-family-base);
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useReportDialog = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
5
6
|
function useReportDialog(reportSettings) {
|
|
6
7
|
const [isReportDialogShown, setIsReportDialogShown] = (0, react_1.useState)(false);
|
|
7
8
|
const isReportButtonShown = reportSettings.hide === false; // TODO: report temporary disabled by default
|
|
9
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
10
|
+
const translationKeys = {
|
|
11
|
+
tooltipText: 'theme.codeSnippet.report.tooltipText',
|
|
12
|
+
label: 'theme.codeSnippet.report.label',
|
|
13
|
+
};
|
|
8
14
|
const showReportDialog = () => {
|
|
9
15
|
setIsReportDialogShown(true);
|
|
10
16
|
};
|
|
@@ -13,11 +19,11 @@ function useReportDialog(reportSettings) {
|
|
|
13
19
|
};
|
|
14
20
|
const reportButtonProps = {
|
|
15
21
|
onClick: showReportDialog,
|
|
16
|
-
title: reportSettings.tooltipText || 'Report a problem',
|
|
22
|
+
title: translate(translationKeys.tooltipText, reportSettings.tooltipText || 'Report a problem'),
|
|
17
23
|
};
|
|
18
24
|
const reportDialogProps = {
|
|
19
25
|
settings: {
|
|
20
|
-
label: reportSettings.label || 'What is wrong with
|
|
26
|
+
label: translate(translationKeys.label, reportSettings.label || 'What is wrong with this code?'),
|
|
21
27
|
},
|
|
22
28
|
onSubmit: hideReportDialog,
|
|
23
29
|
onCancel: hideReportDialog,
|
|
@@ -7,24 +7,31 @@ exports.Filter = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Checkbox_1 = require("../../ui/Checkbox");
|
|
10
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
10
11
|
function Filter({ filter }) {
|
|
11
12
|
var _a;
|
|
13
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
14
|
+
const translationKeys = {
|
|
15
|
+
selectAll: 'theme.catalog.filters.select.all',
|
|
16
|
+
};
|
|
12
17
|
if (!filter.parentUsed)
|
|
13
18
|
return null;
|
|
14
19
|
return (react_1.default.createElement(FilterGroup, { key: filter.property + filter.title },
|
|
15
|
-
react_1.default.createElement(FilterTitle, null, filter.title),
|
|
20
|
+
react_1.default.createElement(FilterTitle, null, translate(filter.titleTranslationKey, filter.title)),
|
|
16
21
|
filter.type === 'select' ? (react_1.default.createElement(StyledSelect, { onChange: (e) => filter.selectOption(e.target.value), value: ((_a = filter.selectedOptions.values().next()) === null || _a === void 0 ? void 0 : _a.value) || '' },
|
|
17
|
-
react_1.default.createElement("option", { key: "none", value: "" },
|
|
18
|
-
filter.filteredOptions.map((value) =>
|
|
19
|
-
value.value,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
react_1.default.createElement("option", { key: "none", value: "", "data-translation-key": translationKeys.selectAll }, translate(translationKeys.selectAll, 'All')),
|
|
23
|
+
filter.filteredOptions.map((value) => {
|
|
24
|
+
return (react_1.default.createElement("option", { key: value.value, value: value.value },
|
|
25
|
+
translate(value.value),
|
|
26
|
+
" (",
|
|
27
|
+
value.count,
|
|
28
|
+
")"));
|
|
29
|
+
}))) : (filter.filteredOptions.map((value) => {
|
|
23
30
|
const id = 'filter--' + filter.property + '--' + slug(value.value);
|
|
24
31
|
return (react_1.default.createElement(FilterValue, { key: id },
|
|
25
32
|
react_1.default.createElement(Checkbox_1.Checkbox, { type: "checkbox", id: id, checked: filter.selectedOptions.has(value.value), onChange: () => filter.toggleOption(value.value) }),
|
|
26
33
|
react_1.default.createElement("label", { htmlFor: id },
|
|
27
|
-
value.value,
|
|
34
|
+
translate(value.value),
|
|
28
35
|
" (",
|
|
29
36
|
value.count,
|
|
30
37
|
")")));
|
|
@@ -7,15 +7,17 @@ exports.FooterColumn = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Link_1 = require("../../mocks/Link");
|
|
10
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
10
11
|
function FooterColumn({ column }) {
|
|
11
12
|
var _a;
|
|
13
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
12
14
|
return (react_1.default.createElement(FooterColumnContainer, { "data-component-name": "Footer/FooterColumn" },
|
|
13
|
-
react_1.default.createElement(FooterColumnTitle, null, column.label), (_a = column === null || column === void 0 ? void 0 : column.items) === null || _a === void 0 ? void 0 :
|
|
15
|
+
react_1.default.createElement(FooterColumnTitle, null, translate(column.labelTranslationKey, column.label)), (_a = column === null || column === void 0 ? void 0 : column.items) === null || _a === void 0 ? void 0 :
|
|
14
16
|
_a.map((columnItem, columnItemIndex) => {
|
|
15
17
|
if (columnItem.type === 'error') {
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
|
-
return columnItem.type === 'separator' ? (react_1.default.createElement(FooterSeparator, { key: columnItem.label + '_' + columnItemIndex }, columnItem.label)) : (react_1.default.createElement(FooterLink, { key: columnItemIndex, to: columnItem.link, external: columnItem.external, target: columnItem.target, "data-cy": columnItem.label }, columnItem.label));
|
|
20
|
+
return columnItem.type === 'separator' ? (react_1.default.createElement(FooterSeparator, { key: columnItem.label + '_' + columnItemIndex }, translate(columnItem.labelTranslationKey, columnItem.label))) : (react_1.default.createElement(FooterLink, { key: columnItemIndex, to: columnItem.link, external: columnItem.external, target: columnItem.target, "data-cy": columnItem.label }, translate(columnItem.labelTranslationKey, columnItem.label)));
|
|
19
21
|
})));
|
|
20
22
|
}
|
|
21
23
|
exports.FooterColumn = FooterColumn;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { NavGroup } from '../../types/portal';
|
|
3
2
|
interface FooterCopyrightProps {
|
|
4
|
-
copyrightText:
|
|
3
|
+
copyrightText: string;
|
|
5
4
|
}
|
|
6
5
|
export declare function FooterCopyright({ copyrightText }: FooterCopyrightProps): JSX.Element | null;
|
|
7
6
|
export {};
|
|
@@ -6,8 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.FooterCopyright = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const hooks_1 = require("../../mocks/hooks");
|
|
9
10
|
function FooterCopyright({ copyrightText = '' }) {
|
|
10
|
-
|
|
11
|
+
const { translate } = (0, hooks_1.useTranslate)();
|
|
12
|
+
const translationKeys = {
|
|
13
|
+
copyrightText: 'theme.footer.copyrightText',
|
|
14
|
+
};
|
|
15
|
+
return copyrightText ? (react_1.default.createElement(Wrapper, { "data-component-name": "Footer/FooterCopyright", "data-translation-key": translationKeys.copyrightText }, translate(translationKeys.copyrightText, copyrightText))) : null;
|
|
11
16
|
}
|
|
12
17
|
exports.FooterCopyright = FooterCopyright;
|
|
13
18
|
const Wrapper = styled_components_1.default.section `
|