@redocly/theme 0.25.2 → 0.26.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/Comment.d.ts +1 -1
- package/lib/components/Feedback/Comment.js +28 -9
- package/lib/components/Feedback/Emotions.js +8 -25
- package/lib/components/Feedback/Feedback.js +6 -0
- package/lib/components/Feedback/Mood.js +115 -47
- package/lib/components/Feedback/Rating.d.ts +1 -0
- package/lib/components/Feedback/Rating.js +81 -42
- package/lib/components/Feedback/Reasons.d.ts +1 -1
- package/lib/components/Feedback/Reasons.js +4 -16
- package/lib/components/Feedback/Scale.d.ts +4 -0
- package/lib/components/Feedback/Scale.js +178 -0
- package/lib/components/Feedback/Sentiment.js +105 -35
- package/lib/components/Feedback/Stars.d.ts +8 -0
- package/lib/components/Feedback/Stars.js +54 -0
- package/lib/components/Feedback/Thumbs.d.ts +2 -6
- package/lib/components/Feedback/Thumbs.js +9 -46
- package/lib/components/Feedback/index.d.ts +1 -0
- package/lib/components/Feedback/index.js +3 -1
- package/lib/components/Feedback/types.d.ts +26 -5
- package/lib/components/Feedback/useReportDialog.js +3 -1
- package/lib/components/Markdown/MarkdownLayout.js +1 -0
- package/lib/components/Markdown/styledVariables.js +54 -0
- package/lib/components/Tabs/Tab.js +30 -6
- package/lib/components/Tabs/Tabs.js +22 -8
- package/lib/config.d.ts +7 -4
- package/lib/config.js +3 -2
- package/lib/icons/CheckboxIcon/CheckboxIcon.js +3 -3
- package/lib/icons/ColorModeIcon/ColorModeIcon.js +4 -4
- package/lib/icons/DissatisfiedIcon/DissatisfiedIcon.js +5 -5
- package/lib/icons/NeutralIcon/NeutralIcon.js +5 -5
- package/lib/icons/RadioCheckButtonIcon/RadioCheckButtonIcon.d.ts +4 -0
- package/lib/icons/RadioCheckButtonIcon/RadioCheckButtonIcon.js +16 -0
- package/lib/icons/RadioCheckButtonIcon/index.d.ts +1 -0
- package/lib/icons/RadioCheckButtonIcon/index.js +18 -0
- package/lib/icons/SatisfiedIcon/SatisfiedIcon.js +5 -5
- package/lib/icons/ThumbDownIcon/ThumbDownIcon.d.ts +4 -0
- package/lib/icons/ThumbDownIcon/ThumbDownIcon.js +14 -0
- package/lib/icons/ThumbDownIcon/index.d.ts +1 -0
- package/lib/icons/ThumbDownIcon/index.js +18 -0
- package/lib/icons/ThumbUpIcon/ThumbUpIcon.d.ts +4 -0
- package/lib/icons/ThumbUpIcon/ThumbUpIcon.js +14 -0
- package/lib/icons/ThumbUpIcon/index.d.ts +1 -0
- package/lib/icons/ThumbUpIcon/index.js +18 -0
- package/lib/types/portal/src/shared/constants.d.ts +2 -1
- package/lib/types/portal/src/shared/constants.js +1 -0
- package/lib/types/portal/src/shared/types/feedback.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/Feedback/Comment.tsx +53 -20
- package/src/components/Feedback/Emotions.tsx +11 -32
- package/src/components/Feedback/Feedback.tsx +13 -1
- package/src/components/Feedback/Mood.tsx +164 -80
- package/src/components/Feedback/Rating.tsx +106 -79
- package/src/components/Feedback/Reasons.tsx +3 -19
- package/src/components/Feedback/Scale.tsx +229 -0
- package/src/components/Feedback/Sentiment.tsx +150 -56
- package/src/components/Feedback/Stars.tsx +51 -0
- package/src/components/Feedback/Thumbs.tsx +9 -106
- package/src/components/Feedback/index.ts +1 -0
- package/src/components/Feedback/types.ts +23 -4
- package/src/components/Feedback/useReportDialog.ts +3 -1
- package/src/components/Markdown/MarkdownLayout.tsx +1 -0
- package/src/components/Markdown/styledVariables.ts +54 -0
- package/src/components/Tabs/Tab.tsx +30 -6
- package/src/components/Tabs/Tabs.tsx +22 -8
- package/src/config.ts +3 -2
- package/src/icons/CheckboxIcon/CheckboxIcon.tsx +4 -4
- package/src/icons/ColorModeIcon/ColorModeIcon.tsx +4 -4
- package/src/icons/DissatisfiedIcon/DissatisfiedIcon.tsx +5 -15
- package/src/icons/NeutralIcon/NeutralIcon.tsx +5 -14
- package/src/icons/RadioCheckButtonIcon/RadioCheckButtonIcon.tsx +19 -0
- package/src/icons/RadioCheckButtonIcon/index.ts +1 -0
- package/src/icons/SatisfiedIcon/SatisfiedIcon.tsx +5 -9
- package/src/icons/ThumbDownIcon/ThumbDownIcon.tsx +15 -0
- package/src/icons/ThumbDownIcon/index.ts +1 -0
- package/src/icons/ThumbUpIcon/ThumbUpIcon.tsx +15 -0
- package/src/icons/ThumbUpIcon/index.ts +1 -0
- package/src/types/portal/src/shared/constants.ts +1 -0
- package/src/types/portal/src/shared/types/feedback.ts +2 -2
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
4
|
|
|
4
5
|
import type { SentimentProps, ReasonsProps } from '@theme/components/Feedback';
|
|
5
6
|
import { Comment, Reasons } from '@theme/components/Feedback';
|
|
6
7
|
import { ThumbUp, ThumbDown } from '@theme/components/Feedback/Thumbs';
|
|
7
8
|
import { useTranslate } from '@portal/hooks';
|
|
9
|
+
import { Button } from '@theme/components';
|
|
10
|
+
import { RadioCheckButtonIcon } from '@theme/icons/RadioCheckButtonIcon';
|
|
11
|
+
import { breakpoints } from '@portal/media-css';
|
|
8
12
|
|
|
9
13
|
export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JSX.Element => {
|
|
10
14
|
const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
|
|
@@ -14,42 +18,38 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
14
18
|
const [reasons, setReasons] = React.useState([] as ReasonsProps['settings']['items']);
|
|
15
19
|
const { translate } = useTranslate();
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Reasons
|
|
22
|
-
onSubmit={({ reasons }) => setReasons(reasons)}
|
|
23
|
-
settings={{ label: reasonsLabel, items, multi, buttonText }}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
21
|
+
const displayReasons = !!score && reasonsSettings?.enable;
|
|
22
|
+
const displayComment = !!score && commentSettings?.enable;
|
|
23
|
+
const displaySubmitBnt = !!score && (displayReasons || displayComment);
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
const commentLabel =
|
|
26
|
+
score === 1
|
|
27
|
+
? translate(
|
|
28
|
+
'theme.feedback.settings.comment.likeLabel',
|
|
29
|
+
(commentSettings && commentSettings.likeLabel) || 'What was most helpful?',
|
|
30
|
+
)
|
|
31
|
+
: translate(
|
|
32
|
+
'theme.feedback.settings.comment.dislikeLabel',
|
|
33
|
+
(commentSettings && commentSettings.dislikeLabel) || 'What can we improve?',
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const onSubmitSentimentForm = () => {
|
|
37
|
+
onSubmit({
|
|
38
|
+
score,
|
|
39
|
+
comment,
|
|
40
|
+
reasons,
|
|
41
|
+
});
|
|
42
|
+
setIsSubmitted(true);
|
|
43
|
+
};
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
if (!
|
|
46
|
-
|
|
47
|
-
score,
|
|
48
|
-
comment,
|
|
49
|
-
reasons,
|
|
50
|
-
});
|
|
51
|
-
setIsSubmitted(true);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (score && !displayComment && !displayReasons) {
|
|
47
|
+
onSubmitSentimentForm();
|
|
52
48
|
}
|
|
49
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
+
}, [score, displayComment, displayReasons]);
|
|
51
|
+
|
|
52
|
+
if (isSubmitted) {
|
|
53
53
|
return (
|
|
54
54
|
<Wrapper>
|
|
55
55
|
<Label data-translation-key="theme.feedback.settings.submitText">
|
|
@@ -58,29 +58,66 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
58
58
|
submitText || 'Thank you for helping improve our documentation!',
|
|
59
59
|
)}
|
|
60
60
|
</Label>
|
|
61
|
+
<RadioCheckButtonIcon />
|
|
61
62
|
</Wrapper>
|
|
62
63
|
);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
return (
|
|
66
67
|
<Wrapper data-component-name="Feedback/Sentiment" className={className}>
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
<StyledForm>
|
|
69
|
+
<StyledFormMandatoryFields>
|
|
70
|
+
<Label data-translation-key="theme.feedback.settings.label">
|
|
71
|
+
{translate('theme.feedback.settings.label', label || 'Was this page helpful?')}
|
|
72
|
+
</Label>
|
|
73
|
+
|
|
74
|
+
<StyledMandatoryFieldContainer>
|
|
75
|
+
<>
|
|
76
|
+
<Vote
|
|
77
|
+
className={`${score === 1 ? 'active' : ''}`}
|
|
78
|
+
onClick={() => {
|
|
79
|
+
setScore(1);
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<ThumbUp />
|
|
83
|
+
</Vote>
|
|
84
|
+
<Vote
|
|
85
|
+
className={`${score === -1 ? 'active' : ''}`}
|
|
86
|
+
onClick={() => {
|
|
87
|
+
setScore(-1);
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<ThumbDown />
|
|
91
|
+
</Vote>
|
|
92
|
+
</>
|
|
93
|
+
</StyledMandatoryFieldContainer>
|
|
94
|
+
</StyledFormMandatoryFields>
|
|
95
|
+
<StyledFormOptionalFields>
|
|
96
|
+
{displayReasons && (
|
|
97
|
+
<Reasons
|
|
98
|
+
settings={{
|
|
99
|
+
label: reasonsSettings?.label,
|
|
100
|
+
items: reasonsSettings?.items || [],
|
|
101
|
+
multi: reasonsSettings?.multi,
|
|
102
|
+
}}
|
|
103
|
+
onChange={setReasons}
|
|
104
|
+
/>
|
|
105
|
+
)}
|
|
106
|
+
|
|
107
|
+
{displayComment && (
|
|
108
|
+
<Comment
|
|
109
|
+
standAlone={false}
|
|
110
|
+
onSubmit={({ comment }) => setComment(comment)}
|
|
111
|
+
settings={{ label: commentLabel }}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
114
|
+
</StyledFormOptionalFields>
|
|
115
|
+
{displaySubmitBnt && (
|
|
116
|
+
<ButtonsContainer>
|
|
117
|
+
<SubmitButton onClick={onSubmitSentimentForm}>Submit</SubmitButton>
|
|
118
|
+
</ButtonsContainer>
|
|
119
|
+
)}
|
|
120
|
+
</StyledForm>
|
|
84
121
|
</Wrapper>
|
|
85
122
|
);
|
|
86
123
|
};
|
|
@@ -88,19 +125,76 @@ export const Sentiment = ({ settings, onSubmit, className }: SentimentProps): JS
|
|
|
88
125
|
const Wrapper = styled.div`
|
|
89
126
|
font-family: var(--font-family-base);
|
|
90
127
|
display: flex;
|
|
128
|
+
justify-content: space-between;
|
|
91
129
|
align-items: center;
|
|
130
|
+
padding: 16px 24px;
|
|
131
|
+
width: 424px;
|
|
132
|
+
border-radius: 8px;
|
|
133
|
+
background: var(--bg-raised);
|
|
134
|
+
|
|
135
|
+
@media screen and (max-width: ${breakpoints.small}) {
|
|
136
|
+
width: 100%;
|
|
137
|
+
}
|
|
92
138
|
`;
|
|
93
139
|
|
|
94
140
|
const Label = styled.h3`
|
|
95
|
-
font-family: var(--h3-font-family);
|
|
96
|
-
font-weight: var(--h3-font-weight);
|
|
97
|
-
font-size: var(--h3-font-size);
|
|
98
|
-
line-height: var(--h3-line-height);
|
|
99
|
-
color: var(--h3-text-color);
|
|
100
141
|
margin-right: 15px;
|
|
142
|
+
font-family: var(--h4-font-family);
|
|
143
|
+
font-weight: var(--h4-font-weight);
|
|
144
|
+
font-size: var(--h4-font-size);
|
|
145
|
+
line-height: var(--h4-line-height);
|
|
146
|
+
color: var(--h3-text-color);
|
|
101
147
|
`;
|
|
102
148
|
|
|
103
149
|
const Vote = styled.div`
|
|
150
|
+
height: 32px;
|
|
151
|
+
width: 32px;
|
|
104
152
|
cursor: pointer;
|
|
105
|
-
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
flex-flow: row-reverse;
|
|
156
|
+
color: var(--text-description);
|
|
157
|
+
&.active {
|
|
158
|
+
color: var(--text-primary);
|
|
159
|
+
}
|
|
160
|
+
&:hover {
|
|
161
|
+
color: var(--text-primary);
|
|
162
|
+
svg {
|
|
163
|
+
> g {
|
|
164
|
+
fill: var(--text-primary);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
const StyledForm = styled.form`
|
|
171
|
+
width: 100%;
|
|
172
|
+
`;
|
|
173
|
+
|
|
174
|
+
const StyledFormOptionalFields = styled.div`
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-flow: column;
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
const StyledFormMandatoryFields = styled.div`
|
|
180
|
+
display: flex;
|
|
181
|
+
justify-content: space-between;
|
|
182
|
+
`;
|
|
183
|
+
|
|
184
|
+
const StyledMandatoryFieldContainer = styled.div`
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
`;
|
|
188
|
+
|
|
189
|
+
const SubmitButton = styled(Button).attrs(() => ({
|
|
190
|
+
color: 'primary',
|
|
191
|
+
}))`
|
|
192
|
+
width: 100px;
|
|
193
|
+
margin-left: 0;
|
|
194
|
+
margin-right: 0;
|
|
195
|
+
`;
|
|
196
|
+
|
|
197
|
+
const ButtonsContainer = styled.div`
|
|
198
|
+
display: flex;
|
|
199
|
+
justify-content: end;
|
|
106
200
|
`;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export type StarsProps = {
|
|
5
|
+
max?: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: number;
|
|
8
|
+
onChange: (value: number) => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Stars = ({ max = 5, onChange, value }: StarsProps): JSX.Element => {
|
|
12
|
+
const [hovered, setHovered] = React.useState(value || 0);
|
|
13
|
+
const stars: JSX.Element[] = [];
|
|
14
|
+
|
|
15
|
+
for (let index = 1; index <= max; index++) {
|
|
16
|
+
stars.push(
|
|
17
|
+
<Star
|
|
18
|
+
key={index}
|
|
19
|
+
onClick={() => onChange(index)}
|
|
20
|
+
onMouseOver={() => setHovered(index)}
|
|
21
|
+
onMouseLeave={() => !value && setHovered(0)}
|
|
22
|
+
>
|
|
23
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
24
|
+
{hovered < index ? (
|
|
25
|
+
<g fill="#e8c002">
|
|
26
|
+
<path d="M20 7h-7L10 .5 7 7H0l5.46 5.47-1.64 7 6.18-3.7 6.18 3.73-1.63-7zm-10 6.9-3.76 2.27 1-4.28L3.5 8.5h4.61L10 4.6l1.9 3.9h4.6l-3.73 3.4 1 4.28z" />
|
|
27
|
+
</g>
|
|
28
|
+
) : (
|
|
29
|
+
<g fill="#e8c002">
|
|
30
|
+
<path d="M20 7h-7L10 .5 7 7H0l5.46 5.47-1.64 7 6.18-3.7 6.18 3.73-1.63-7z" />
|
|
31
|
+
</g>
|
|
32
|
+
)}
|
|
33
|
+
</svg>
|
|
34
|
+
</Star>,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return <StarsWrapper>{stars}</StarsWrapper>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const StarsWrapper = styled.div`
|
|
42
|
+
display: flex;
|
|
43
|
+
gap: 8px;
|
|
44
|
+
flex-direction: row;
|
|
45
|
+
align-items: center;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const Star = styled.span`
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
`;
|
|
@@ -1,99 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ThumbDownIcon } from '@theme/icons/ThumbDownIcon';
|
|
5
|
+
import { ThumbUpIcon } from '@theme/icons/ThumbUpIcon';
|
|
5
6
|
|
|
6
|
-
export const ThumbUp = (
|
|
7
|
-
const { translate } = useTranslate();
|
|
7
|
+
export const ThumbUp = () => {
|
|
8
8
|
return (
|
|
9
|
-
<Wrapper
|
|
10
|
-
<
|
|
11
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 512 512">
|
|
12
|
-
<g>
|
|
13
|
-
<g>
|
|
14
|
-
<g>
|
|
15
|
-
<path
|
|
16
|
-
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
|
|
17
|
-
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
|
|
18
|
-
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
|
|
19
|
-
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
|
|
20
|
-
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
|
|
21
|
-
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
|
|
22
|
-
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
|
|
23
|
-
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
|
|
24
|
-
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
|
|
25
|
-
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
|
|
26
|
-
C512,310.699,505.634,298.59,495.736,290.773z"
|
|
27
|
-
/>
|
|
28
|
-
<path
|
|
29
|
-
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
|
|
30
|
-
S67.388,443.733,76.8,443.733z"
|
|
31
|
-
/>
|
|
32
|
-
<path
|
|
33
|
-
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
|
|
34
|
-
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
|
|
35
|
-
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
|
|
36
|
-
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
|
|
37
|
-
S174.481,247.467,179.2,247.467z"
|
|
38
|
-
/>
|
|
39
|
-
<path
|
|
40
|
-
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
|
|
41
|
-
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
|
|
42
|
-
V469.333z"
|
|
43
|
-
/>
|
|
44
|
-
</g>
|
|
45
|
-
</g>
|
|
46
|
-
</g>
|
|
47
|
-
</svg>
|
|
48
|
-
</Icon>
|
|
49
|
-
<span>{translate('theme.feedback.sentiment.thumbUp', text || 'Yes')}</span>
|
|
9
|
+
<Wrapper>
|
|
10
|
+
<ThumbUpIcon />
|
|
50
11
|
</Wrapper>
|
|
51
12
|
);
|
|
52
13
|
};
|
|
53
14
|
|
|
54
|
-
export const ThumbDown = (
|
|
55
|
-
const { translate } = useTranslate();
|
|
15
|
+
export const ThumbDown = () => {
|
|
56
16
|
return (
|
|
57
|
-
<Wrapper
|
|
58
|
-
<
|
|
59
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 512 512">
|
|
60
|
-
<g>
|
|
61
|
-
<g>
|
|
62
|
-
<g>
|
|
63
|
-
<path
|
|
64
|
-
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
|
|
65
|
-
c-9.412,0-17.067,7.654-17.067,17.067C59.733,239.812,67.388,247.467,76.8,247.467z"
|
|
66
|
-
/>
|
|
67
|
-
<path
|
|
68
|
-
d="M495.736,221.227C505.634,213.41,512,201.301,512,187.733c0-18.295-11.58-33.946-27.802-39.996
|
|
69
|
-
c6.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
|
|
70
|
-
c0-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
|
|
71
|
-
c-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
|
|
72
|
-
c14.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
|
|
73
|
-
c-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
|
|
74
|
-
c-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
|
|
75
|
-
s-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
|
|
76
|
-
c26.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
|
|
77
|
-
c0,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
|
|
78
|
-
c24.414,0,42.667-25.054,42.667-47.471C512,242.603,509.397,229.683,495.736,221.227z"
|
|
79
|
-
/>
|
|
80
|
-
<path
|
|
81
|
-
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
|
|
82
|
-
c-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
|
|
83
|
-
c-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
|
|
84
|
-
c31.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
|
|
85
|
-
C358.4,319.556,354.586,315.733,349.867,315.733z"
|
|
86
|
-
/>
|
|
87
|
-
<path
|
|
88
|
-
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
|
|
89
|
-
c4.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"
|
|
90
|
-
/>
|
|
91
|
-
</g>
|
|
92
|
-
</g>
|
|
93
|
-
</g>
|
|
94
|
-
</svg>
|
|
95
|
-
</Icon>
|
|
96
|
-
<span>{translate('theme.feedback.sentiment.thumbDown', text || 'No')}</span>
|
|
17
|
+
<Wrapper>
|
|
18
|
+
<ThumbDownIcon />
|
|
97
19
|
</Wrapper>
|
|
98
20
|
);
|
|
99
21
|
};
|
|
@@ -101,24 +23,5 @@ export const ThumbDown = ({ text }: { text?: string }) => {
|
|
|
101
23
|
const Wrapper = styled.div`
|
|
102
24
|
font-family: var(--font-family-base);
|
|
103
25
|
display: flex;
|
|
104
|
-
|
|
105
|
-
&:hover {
|
|
106
|
-
color: var(--color-info-text-active);
|
|
107
|
-
svg {
|
|
108
|
-
> g {
|
|
109
|
-
fill: var(--color-info-text-active);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
`;
|
|
114
|
-
|
|
115
|
-
const Icon = styled.div`
|
|
116
|
-
width: 18px;
|
|
117
|
-
height: 18px;
|
|
118
|
-
margin-right: 5px;
|
|
119
|
-
> svg {
|
|
120
|
-
> g {
|
|
121
|
-
fill: var(--color-info-text);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
26
|
+
align-items: center;
|
|
124
27
|
`;
|
|
@@ -2,6 +2,7 @@ export { Feedback } from '@theme/components/Feedback/Feedback';
|
|
|
2
2
|
export { Rating } from '@theme/components/Feedback/Rating';
|
|
3
3
|
export { Sentiment } from '@theme/components/Feedback/Sentiment';
|
|
4
4
|
export { Mood } from '@theme/components/Feedback/Mood';
|
|
5
|
+
export { Scale } from '@theme/components/Feedback/Scale';
|
|
5
6
|
export { Comment } from '@theme/components/Feedback/Comment';
|
|
6
7
|
export { Reasons } from '@theme/components/Feedback/Reasons';
|
|
7
8
|
export { ReportDialog } from '@theme/components/Feedback/ReportDialog';
|
|
@@ -4,7 +4,6 @@ export type RatingProps = {
|
|
|
4
4
|
onSubmit: (value: { score: number; comment?: string; reasons?: string[]; max: number }) => void;
|
|
5
5
|
settings?: {
|
|
6
6
|
label?: string;
|
|
7
|
-
max?: number;
|
|
8
7
|
submitText?: string;
|
|
9
8
|
comment?: {
|
|
10
9
|
enable: boolean;
|
|
@@ -20,6 +19,27 @@ export type RatingProps = {
|
|
|
20
19
|
className?: string;
|
|
21
20
|
};
|
|
22
21
|
|
|
22
|
+
export type ScaleProps = {
|
|
23
|
+
onSubmit: (value: { score: number; comment?: string; reasons?: string[]; max?: number }) => void;
|
|
24
|
+
settings?: {
|
|
25
|
+
label?: string;
|
|
26
|
+
submitText?: string;
|
|
27
|
+
leftScaleLabel?: string;
|
|
28
|
+
rightScaleLabel?: string;
|
|
29
|
+
comment?: {
|
|
30
|
+
enable: boolean;
|
|
31
|
+
label?: string;
|
|
32
|
+
};
|
|
33
|
+
reasons?: {
|
|
34
|
+
enable: boolean;
|
|
35
|
+
label?: string;
|
|
36
|
+
multi?: boolean;
|
|
37
|
+
items: string[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
className?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
23
43
|
export type MoodProps = {
|
|
24
44
|
onSubmit: (value: { score: string; comment?: string; reasons?: string[] }) => void;
|
|
25
45
|
settings?: {
|
|
@@ -68,17 +88,16 @@ export type CommentProps = {
|
|
|
68
88
|
label?: string;
|
|
69
89
|
submitText?: string;
|
|
70
90
|
};
|
|
91
|
+
standAlone?: boolean;
|
|
71
92
|
className?: string;
|
|
72
93
|
};
|
|
73
94
|
|
|
74
95
|
export type ReasonsProps = {
|
|
75
|
-
|
|
96
|
+
onChange: (value: string[]) => void;
|
|
76
97
|
settings: {
|
|
77
98
|
label?: string;
|
|
78
99
|
multi?: boolean;
|
|
79
100
|
items: string[];
|
|
80
|
-
submitText?: string;
|
|
81
|
-
buttonText?: string;
|
|
82
101
|
};
|
|
83
102
|
className?: string;
|
|
84
103
|
};
|
|
@@ -27,7 +27,9 @@ export function useReportDialog(): Record<string, ReportComponentsProps> {
|
|
|
27
27
|
setIsReportDialogShown(true);
|
|
28
28
|
};
|
|
29
29
|
const hideReportDialog = () => {
|
|
30
|
-
|
|
30
|
+
setTimeout(function () {
|
|
31
|
+
setIsReportDialogShown(false);
|
|
32
|
+
}, 1000);
|
|
31
33
|
};
|
|
32
34
|
const reportButtonProps: ReportButtonProps = {
|
|
33
35
|
onClick: showReportDialog,
|
|
@@ -210,10 +210,64 @@ export const markdown = css`
|
|
|
210
210
|
/**
|
|
211
211
|
* @tokens Markdown Tabs
|
|
212
212
|
*/
|
|
213
|
+
|
|
214
|
+
--md-tabs-container-text-color: inherit; // @presenter Color
|
|
215
|
+
--md-tabs-container-font-size: var(--font-size-base); // @presenter FontSize
|
|
216
|
+
--md-tabs-container-font-family: var(--font-size-base); // @presenter FontFamily
|
|
217
|
+
--md-tabs-container-font-style: normal; // @presenter FontStyle
|
|
218
|
+
--md-tabs-container-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
219
|
+
--md-tabs-container-background-color: inherit; // @presenter Color
|
|
220
|
+
--md-tabs-container-margin: 10px 0; // @presenter Spacing
|
|
221
|
+
--md-tabs-container-padding: 0; // @presenter Spacing
|
|
222
|
+
--md-tabs-container-border: none; // @presenter Border
|
|
223
|
+
|
|
224
|
+
--md-tabs-border: solid var(--border-primary); // @presenter Color
|
|
225
|
+
--md-tabs-border-width: 0 0 1px 0; // @presenter Spacing
|
|
226
|
+
--md-tabs-padding: 0; // @presenter Spacing
|
|
227
|
+
|
|
228
|
+
--md-tabs-content-text-color: inherit; // @presenter Color
|
|
229
|
+
--md-tabs-content-font-size: var(--font-size-base); // @presenter FontSize
|
|
230
|
+
--md-tabs-content-font-family: var(--font-size-base); // @presenter FontFamily
|
|
231
|
+
--md-tabs-content-font-style: normal; // @presenter FontStyle
|
|
232
|
+
--md-tabs-content-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
233
|
+
--md-tabs-content-background-color: inherit; // @presenter Color
|
|
234
|
+
--md-tabs-content-margin: 0; // @presenter Spacing
|
|
235
|
+
--md-tabs-content-padding: var(--spacing-base) 0; // @presenter Spacing
|
|
236
|
+
--md-tabs-content-border: none; // @presenter Border
|
|
213
237
|
|
|
214
238
|
--md-tabs-tab-text-color: var(--text-secondary); // @presenter Color
|
|
239
|
+
--md-tabs-tab-font-size: var(--font-size-base); // @presenter FontSize
|
|
240
|
+
--md-tabs-tab-font-family: var(--font-size-base); // @presenter FontFamily
|
|
241
|
+
--md-tabs-tab-font-style: normal; // @presenter FontStyle
|
|
242
|
+
--md-tabs-tab-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
243
|
+
--md-tabs-tab-background-color: none; // @presenter Color
|
|
244
|
+
--md-tabs-tab-margin: 0 0 -1px 0; // @presenter Spacing
|
|
245
|
+
--md-tabs-tab-padding: var(--spacing-sm) var(--spacing-base); // @presenter Spacing
|
|
246
|
+
--md-tabs-tab-border: none; // @presenter Color
|
|
247
|
+
--md-tabs-tab-border-width: 0; // @presenter Spacing
|
|
248
|
+
--md-tabs-tab-border-radius: 0; // @presenter BorderRadius
|
|
249
|
+
|
|
250
|
+
--md-tabs-active-tab-text-color: var(--text-primary); // @presenter Color
|
|
251
|
+
--md-tabs-active-tab-font-size: var(--md-tabs-tab-font-size); // @presenter FontSize
|
|
252
|
+
--md-tabs-active-tab-font-family: var(--md-tabs-tab-font-family); // @presenter FontFamily
|
|
253
|
+
--md-tabs-active-tab-font-style: normal; // @presenter FontStyle
|
|
254
|
+
--md-tabs-active-tab-font-weight: var(--md-tabs-tab-font-weight); // @presenter FontWeight
|
|
255
|
+
--md-tabs-active-tab-background-color: var(--background-color); // @presenter Color
|
|
256
|
+
--md-tabs-active-tab-padding: var(--md-tabs-tab-padding); // @presenter Spacing
|
|
215
257
|
--md-tabs-active-tab-border-color: var(--border-primary); // @presenter Color
|
|
258
|
+
--md-tabs-active-tab-border-width: 0 0 1px 0; // @presenter Spacing
|
|
259
|
+
--md-tabs-active-tab-border-radius: var(--md-tabs-tab-border-radius); // @presenter BorderRadius
|
|
260
|
+
|
|
261
|
+
--md-tabs-hover-tab-text-color: var(--md-tabs-tab-text-color); // @presenter Color
|
|
262
|
+
--md-tabs-hover-tab-font-size: var(--md-tabs-tab-font-size); // @presenter FontSize
|
|
263
|
+
--md-tabs-hover-tab-font-family: var(--md-tabs-tab-font-family); // @presenter FontFamily
|
|
264
|
+
--md-tabs-hover-tab-font-style: normal; // @presenter FontStyle
|
|
265
|
+
--md-tabs-hover-tab-font-weight: var(--md-tabs-tab-font-weight); // @presenter FontWeight
|
|
266
|
+
--md-tabs-hover-tab-background-color: var(--md-tabs-tab-background-color); // @presenter Color
|
|
267
|
+
--md-tabs-hover-tab-padding: var(--md-tabs-tab-padding); // @presenter Spacing
|
|
216
268
|
--md-tabs-hover-tab-border-color: var(--border-secondary); // @presenter Color
|
|
269
|
+
--md-tabs-hover-tab-border-width: 0 0 1px 0; // @presenter Spacing
|
|
270
|
+
--md-tabs-hover-tab-border-radius: var(--md-tabs-tab-border-radius); // @presenter BorderRadius
|
|
217
271
|
|
|
218
272
|
// @tokens End
|
|
219
273
|
`;
|
|
@@ -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
|
`;
|