@redocly/theme 0.23.1 → 0.24.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/components/Feedback/Rating.js +3 -1
- package/lib/components/Feedback/types.d.ts +1 -0
- package/lib/types/portal/src/shared/constants.d.ts +2 -1
- package/lib/types/portal/src/shared/constants.js +1 -0
- package/package.json +1 -1
- package/src/components/Feedback/Rating.tsx +3 -1
- package/src/components/Feedback/types.ts +1 -1
- package/src/types/portal/src/shared/constants.ts +1 -0
|
@@ -41,6 +41,7 @@ const Rating = ({ settings, onSubmit, className }) => {
|
|
|
41
41
|
submitText: 'theme.feedback.settings.submitText',
|
|
42
42
|
label: 'theme.feedback.settings.label',
|
|
43
43
|
};
|
|
44
|
+
const maxRating = max || 5;
|
|
44
45
|
if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
|
|
45
46
|
const { label: reasonsLabel, items, multi } = reasonsSettings;
|
|
46
47
|
const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
|
|
@@ -54,13 +55,14 @@ const Rating = ({ settings, onSubmit, className }) => {
|
|
|
54
55
|
score,
|
|
55
56
|
comment,
|
|
56
57
|
reasons,
|
|
58
|
+
max: maxRating,
|
|
57
59
|
});
|
|
58
60
|
return (React.createElement(Wrapper, null,
|
|
59
61
|
React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
|
|
60
62
|
}
|
|
61
63
|
return (React.createElement(Wrapper, { "data-component-name": "Feedback/Rating", className: className },
|
|
62
64
|
React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'How helpful was this page?')),
|
|
63
|
-
React.createElement(Stars, { max:
|
|
65
|
+
React.createElement(Stars, { max: maxRating, onSubmit: setScore })));
|
|
64
66
|
};
|
|
65
67
|
exports.Rating = Rating;
|
|
66
68
|
const Stars = ({ max, onSubmit }) => {
|
|
@@ -10,6 +10,7 @@ var FEEDBACK_TYPES;
|
|
|
10
10
|
FEEDBACK_TYPES["SENTIMENT"] = "sentiment";
|
|
11
11
|
FEEDBACK_TYPES["COMMENT"] = "comment";
|
|
12
12
|
FEEDBACK_TYPES["MOOD"] = "mood";
|
|
13
|
+
FEEDBACK_TYPES["PROBLEM"] = "problem";
|
|
13
14
|
})(FEEDBACK_TYPES = exports.FEEDBACK_TYPES || (exports.FEEDBACK_TYPES = {}));
|
|
14
15
|
exports.DEV_LOGIN_SLUG = '/login/';
|
|
15
16
|
var ExternalRoutes;
|
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
26
26
|
submitText: 'theme.feedback.settings.submitText',
|
|
27
27
|
label: 'theme.feedback.settings.label',
|
|
28
28
|
};
|
|
29
|
+
const maxRating = max || 5;
|
|
29
30
|
|
|
30
31
|
if (score && reasonsSettings?.enable && !reasons.length) {
|
|
31
32
|
const { label: reasonsLabel, items, multi } = reasonsSettings;
|
|
@@ -52,6 +53,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
52
53
|
score,
|
|
53
54
|
comment,
|
|
54
55
|
reasons,
|
|
56
|
+
max: maxRating,
|
|
55
57
|
});
|
|
56
58
|
return (
|
|
57
59
|
<Wrapper>
|
|
@@ -70,7 +72,7 @@ export const Rating = ({ settings, onSubmit, className }: RatingProps): JSX.Elem
|
|
|
70
72
|
<Label data-translation-key={translationKeys.label}>
|
|
71
73
|
{translate(translationKeys.label, label || 'How helpful was this page?')}
|
|
72
74
|
</Label>
|
|
73
|
-
<Stars max={
|
|
75
|
+
<Stars max={maxRating} onSubmit={setScore} />
|
|
74
76
|
</Wrapper>
|
|
75
77
|
);
|
|
76
78
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SubmitFeedbackParams } from '@theme/types/portal/src/shared/types/feedback';
|
|
2
2
|
|
|
3
3
|
export type RatingProps = {
|
|
4
|
-
onSubmit: (value: { score: number; comment?: string; reasons?: string[] }) => void;
|
|
4
|
+
onSubmit: (value: { score: number; comment?: string; reasons?: string[]; max: number }) => void;
|
|
5
5
|
settings?: {
|
|
6
6
|
label?: string;
|
|
7
7
|
max?: number;
|