@redocly/theme 0.26.1 → 0.27.1
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/Feedback/Mood.js +13 -1
- package/lib/components/Feedback/types.d.ts +1 -1
- package/lib/components/Markdown/MarkdownWrapper.js +1 -1
- package/lib/components/PageNavigation/NextButton.js +1 -1
- package/lib/components/PageNavigation/PreviousButton.js +1 -1
- package/lib/config.d.ts +2 -2
- package/lib/config.js +2 -2
- package/package.json +1 -1
- package/src/components/Feedback/Mood.tsx +14 -1
- package/src/components/Feedback/types.ts +1 -1
- package/src/components/Markdown/MarkdownWrapper.tsx +1 -1
- package/src/components/PageNavigation/NextButton.tsx +2 -2
- package/src/components/PageNavigation/PreviousButton.tsx +2 -2
- package/src/config.ts +2 -2
|
@@ -68,7 +68,7 @@ const Mood = ({ settings, onSubmit, className }) => {
|
|
|
68
68
|
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
69
69
|
const onSubmitMoodForm = () => {
|
|
70
70
|
onSubmit({
|
|
71
|
-
score,
|
|
71
|
+
score: remapScore(score),
|
|
72
72
|
comment,
|
|
73
73
|
reasons,
|
|
74
74
|
});
|
|
@@ -114,6 +114,18 @@ const Mood = ({ settings, onSubmit, className }) => {
|
|
|
114
114
|
React.createElement(SubmitButton, { onClick: onSubmitMoodForm }, "Submit"))))));
|
|
115
115
|
};
|
|
116
116
|
exports.Mood = Mood;
|
|
117
|
+
const remapScore = (score) => {
|
|
118
|
+
switch (score) {
|
|
119
|
+
case MOOD_STATES.SATISFIED:
|
|
120
|
+
return 1;
|
|
121
|
+
case MOOD_STATES.NEUTRAL:
|
|
122
|
+
return 0;
|
|
123
|
+
case MOOD_STATES.DISSATISFIED:
|
|
124
|
+
return -1;
|
|
125
|
+
default:
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
117
129
|
const Wrapper = styled_components_1.default.div `
|
|
118
130
|
font-family: var(--font-family-base);
|
|
119
131
|
display: flex;
|
|
@@ -40,7 +40,7 @@ function NextButton({ nextPage, className }) {
|
|
|
40
40
|
return React.createElement("div", null, "\u00A0");
|
|
41
41
|
}
|
|
42
42
|
const nextPageText = nextPage.label || nextPage.routeSlug || '';
|
|
43
|
-
const defaultText = (((_b = navigation === null || navigation === void 0 ? void 0 : navigation.nextButton) === null || _b === void 0 ? void 0 : _b.text) || 'Next to {label}').replace('{label}', nextPageText);
|
|
43
|
+
const defaultText = (((_b = navigation === null || navigation === void 0 ? void 0 : navigation.nextButton) === null || _b === void 0 ? void 0 : _b.text) || 'Next to {{label}}').replace('{{label}}', nextPageText);
|
|
44
44
|
const translationKey = 'theme.page.nextButton';
|
|
45
45
|
const text = translate(translationKey, { label: nextPageText, defaultValue: defaultText });
|
|
46
46
|
return (React.createElement(StyledButton, { size: "large", to: nextPage.link, "data-component-name": "PageNavigation/NextPageLink", "data-translation-key": translationKey, extraClass: className }, text));
|
|
@@ -17,7 +17,7 @@ function PreviousButton({ prevPage, className }) {
|
|
|
17
17
|
return react_1.default.createElement("div", null, "\u00A0");
|
|
18
18
|
}
|
|
19
19
|
const prevPageText = prevPage.label || prevPage.routeSlug || '';
|
|
20
|
-
const defaultText = (((_b = navigation === null || navigation === void 0 ? void 0 : navigation.previousButton) === null || _b === void 0 ? void 0 : _b.text) || 'Back to {label}').replace('{label}', prevPageText);
|
|
20
|
+
const defaultText = (((_b = navigation === null || navigation === void 0 ? void 0 : navigation.previousButton) === null || _b === void 0 ? void 0 : _b.text) || 'Back to {{label}}').replace('{{label}}', prevPageText);
|
|
21
21
|
const translationKey = 'theme.page.previousButton';
|
|
22
22
|
const text = translate(translationKey, {
|
|
23
23
|
label: prevPageText,
|
package/lib/config.d.ts
CHANGED
|
@@ -1196,7 +1196,7 @@ export declare const themeConfigSchema: {
|
|
|
1196
1196
|
};
|
|
1197
1197
|
readonly text: {
|
|
1198
1198
|
readonly type: "string";
|
|
1199
|
-
readonly default: "Next to {label}";
|
|
1199
|
+
readonly default: "Next to {{label}}";
|
|
1200
1200
|
};
|
|
1201
1201
|
};
|
|
1202
1202
|
readonly additionalProperties: false;
|
|
@@ -1210,7 +1210,7 @@ export declare const themeConfigSchema: {
|
|
|
1210
1210
|
};
|
|
1211
1211
|
readonly text: {
|
|
1212
1212
|
readonly type: "string";
|
|
1213
|
-
readonly default: "Back to {label}";
|
|
1213
|
+
readonly default: "Back to {{label}}";
|
|
1214
1214
|
};
|
|
1215
1215
|
};
|
|
1216
1216
|
readonly additionalProperties: false;
|
package/lib/config.js
CHANGED
|
@@ -465,13 +465,13 @@ exports.themeConfigSchema = {
|
|
|
465
465
|
properties: {
|
|
466
466
|
nextButton: {
|
|
467
467
|
type: 'object',
|
|
468
|
-
properties: Object.assign({ text: { type: 'string', default: 'Next to {label}' } }, hideConfigSchema.properties),
|
|
468
|
+
properties: Object.assign({ text: { type: 'string', default: 'Next to {{label}}' } }, hideConfigSchema.properties),
|
|
469
469
|
additionalProperties: false,
|
|
470
470
|
default: {},
|
|
471
471
|
},
|
|
472
472
|
previousButton: {
|
|
473
473
|
type: 'object',
|
|
474
|
-
properties: Object.assign({ text: { type: 'string', default: 'Back to {label}' } }, hideConfigSchema.properties),
|
|
474
|
+
properties: Object.assign({ text: { type: 'string', default: 'Back to {{label}}' } }, hideConfigSchema.properties),
|
|
475
475
|
additionalProperties: false,
|
|
476
476
|
default: {},
|
|
477
477
|
},
|
package/package.json
CHANGED
|
@@ -54,7 +54,7 @@ export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
54
54
|
|
|
55
55
|
const onSubmitMoodForm = () => {
|
|
56
56
|
onSubmit({
|
|
57
|
-
score,
|
|
57
|
+
score: remapScore(score),
|
|
58
58
|
comment,
|
|
59
59
|
reasons,
|
|
60
60
|
});
|
|
@@ -148,6 +148,19 @@ export const Mood = ({ settings, onSubmit, className }: MoodProps): JSX.Element
|
|
|
148
148
|
);
|
|
149
149
|
};
|
|
150
150
|
|
|
151
|
+
const remapScore = (score: string): number => {
|
|
152
|
+
switch (score) {
|
|
153
|
+
case MOOD_STATES.SATISFIED:
|
|
154
|
+
return 1;
|
|
155
|
+
case MOOD_STATES.NEUTRAL:
|
|
156
|
+
return 0;
|
|
157
|
+
case MOOD_STATES.DISSATISFIED:
|
|
158
|
+
return -1;
|
|
159
|
+
default:
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
151
164
|
const Wrapper = styled.div`
|
|
152
165
|
font-family: var(--font-family-base);
|
|
153
166
|
display: flex;
|
|
@@ -41,7 +41,7 @@ export type ScaleProps = {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
export type MoodProps = {
|
|
44
|
-
onSubmit: (value: { score:
|
|
44
|
+
onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
|
|
45
45
|
settings?: {
|
|
46
46
|
label?: string;
|
|
47
47
|
submitText?: string;
|
|
@@ -20,8 +20,8 @@ export function NextButton({ nextPage, className }: NextPageType): JSX.Element {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const nextPageText = nextPage.label || nextPage.routeSlug || '';
|
|
23
|
-
const defaultText = (navigation?.nextButton?.text || 'Next to {label}').replace(
|
|
24
|
-
'{label}',
|
|
23
|
+
const defaultText = (navigation?.nextButton?.text || 'Next to {{label}}').replace(
|
|
24
|
+
'{{label}}',
|
|
25
25
|
nextPageText,
|
|
26
26
|
);
|
|
27
27
|
const translationKey = 'theme.page.nextButton';
|
|
@@ -20,8 +20,8 @@ export function PreviousButton({ prevPage, className }: PreviousPageType): JSX.E
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const prevPageText = prevPage.label || prevPage.routeSlug || '';
|
|
23
|
-
const defaultText = (navigation?.previousButton?.text || 'Back to {label}').replace(
|
|
24
|
-
'{label}',
|
|
23
|
+
const defaultText = (navigation?.previousButton?.text || 'Back to {{label}}').replace(
|
|
24
|
+
'{{label}}',
|
|
25
25
|
prevPageText,
|
|
26
26
|
);
|
|
27
27
|
const translationKey = 'theme.page.previousButton';
|
package/src/config.ts
CHANGED
|
@@ -534,7 +534,7 @@ export const themeConfigSchema = {
|
|
|
534
534
|
nextButton: {
|
|
535
535
|
type: 'object',
|
|
536
536
|
properties: {
|
|
537
|
-
text: { type: 'string', default: 'Next to {label}' },
|
|
537
|
+
text: { type: 'string', default: 'Next to {{label}}' },
|
|
538
538
|
...hideConfigSchema.properties,
|
|
539
539
|
},
|
|
540
540
|
additionalProperties: false,
|
|
@@ -543,7 +543,7 @@ export const themeConfigSchema = {
|
|
|
543
543
|
previousButton: {
|
|
544
544
|
type: 'object',
|
|
545
545
|
properties: {
|
|
546
|
-
text: { type: 'string', default: 'Back to {label}' },
|
|
546
|
+
text: { type: 'string', default: 'Back to {{label}}' },
|
|
547
547
|
...hideConfigSchema.properties,
|
|
548
548
|
},
|
|
549
549
|
additionalProperties: false,
|