@cloud-ru/uikit-product-site-csat 0.1.17 → 0.2.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/CHANGELOG.md +22 -0
- package/dist/cjs/components/SiteCsat/SiteCsat.d.ts +15 -2
- package/dist/cjs/components/SiteCsat/SiteCsat.js +2 -2
- package/dist/cjs/components/SiteCsat/styles.module.css +6 -0
- package/dist/cjs/components/SiteCsatPopover/SiteCsatPopover.d.ts +17 -2
- package/dist/cjs/components/SiteCsatPopover/SiteCsatPopover.js +5 -3
- package/dist/cjs/components/SiteCsatPopover/styles.module.css +5 -0
- package/dist/cjs/helperComponents/LikeDislikeBlock/LikeDislikeBlock.d.ts +3 -1
- package/dist/cjs/helperComponents/LikeDislikeBlock/LikeDislikeBlock.js +5 -3
- package/dist/cjs/helperComponents/PopoverReport/PopoverReportContent.js +1 -1
- package/dist/esm/components/SiteCsat/SiteCsat.d.ts +15 -2
- package/dist/esm/components/SiteCsat/SiteCsat.js +2 -2
- package/dist/esm/components/SiteCsat/styles.module.css +6 -0
- package/dist/esm/components/SiteCsatPopover/SiteCsatPopover.d.ts +17 -2
- package/dist/esm/components/SiteCsatPopover/SiteCsatPopover.js +5 -3
- package/dist/esm/components/SiteCsatPopover/styles.module.css +5 -0
- package/dist/esm/helperComponents/LikeDislikeBlock/LikeDislikeBlock.d.ts +3 -1
- package/dist/esm/helperComponents/LikeDislikeBlock/LikeDislikeBlock.js +6 -4
- package/dist/esm/helperComponents/PopoverReport/PopoverReportContent.js +1 -1
- package/package.json +5 -6
- package/src/components/SiteCsat/SiteCsat.tsx +31 -3
- package/src/components/SiteCsat/styles.module.scss +6 -0
- package/src/components/SiteCsatPopover/SiteCsatPopover.tsx +27 -1
- package/src/components/SiteCsatPopover/styles.module.scss +5 -0
- package/src/helperComponents/LikeDislikeBlock/LikeDislikeBlock.tsx +42 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 0.2.0 (2025-11-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **SITE-10171:** update component Site-csat for a/b test ([8061656](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/8061656f79946d2987b7fe407aa98b6c6e033263))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 0.1.18 (2025-11-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **PD-3377:** removed contributors ([121640f](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/121640f7b88b20a728a6ad2c39de8841532bb308))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## 0.1.17 (2025-11-13)
|
|
7
29
|
|
|
8
30
|
### Only dependencies have been changed
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
import { WithLayoutType } from '@
|
|
1
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
2
2
|
import { onSubmitVariables } from '../../types';
|
|
3
3
|
export type SiteCsatProps = WithLayoutType<{
|
|
4
|
+
/** Отображение Spinner */
|
|
4
5
|
isLoading?: boolean;
|
|
6
|
+
/** Состояние отображение лайка: лайк, дизлайк или ничего не выбрано */
|
|
5
7
|
like?: boolean;
|
|
8
|
+
/** Обработчик нажатия на лайк или дизлайк */
|
|
6
9
|
onSetLike: (flag: boolean) => void;
|
|
10
|
+
/** Текст рядом с кнопками */
|
|
7
11
|
label: string;
|
|
12
|
+
/** Выбор версии компонента, сделано для a/b тестирования, после тестирования этот prop удалится */
|
|
13
|
+
showNewAppearance?: boolean;
|
|
14
|
+
/** Данные для заполнения формы фидбэка */
|
|
8
15
|
dislikeCommentForm?: {
|
|
16
|
+
/** Открыта или закрыт форма */
|
|
9
17
|
open: boolean;
|
|
18
|
+
/** Доступно ли нажатие на дизлайк */
|
|
10
19
|
dislikeEnabled?: boolean;
|
|
20
|
+
/** Состояние загрузки кнопки отправки */
|
|
11
21
|
loadingButton?: boolean;
|
|
22
|
+
/** Обработчик нажатия на форму */
|
|
12
23
|
onClickForm(): void;
|
|
24
|
+
/** Обработчик onSubmit формы */
|
|
13
25
|
onSubmit({ textComment, selectedChips }: onSubmitVariables): void;
|
|
26
|
+
/** Обработчик нажатия на chips */
|
|
14
27
|
onCheckChips?(titleChip: string): void;
|
|
15
28
|
};
|
|
16
29
|
}>;
|
|
17
|
-
export declare function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm }: SiteCsatProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm, showNewAppearance, }: SiteCsatProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,6 +10,6 @@ const loaders_1 = require("@snack-uikit/loaders");
|
|
|
10
10
|
const typography_1 = require("@snack-uikit/typography");
|
|
11
11
|
const helperComponents_1 = require("../../helperComponents");
|
|
12
12
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
13
|
-
function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm }) {
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.siteCsatBlock, "data-layout-type": layoutType, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.csatFormBlock, children: [like === undefined || isLoading ? ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleM, { children: label })) : ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.reportSendBlock, children: [(0, jsx_runtime_1.jsx)(icons_1.CheckFilledSVG, { className: styles_module_scss_1.default.checkIcon }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleM, { children: "\u0421\u043F\u0430\u0441\u0438\u0431\u043E \u0437\u0430 \u043E\u0442\u0437\u044B\u0432" })] })), isLoading ? ((0, jsx_runtime_1.jsx)(loaders_1.Spinner, {})) : ((0, jsx_runtime_1.jsx)(helperComponents_1.LikeDislikeBlock, { dislikeEnabled: dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled, like: like, onSetLike: onSetLike })), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { className: styles_module_scss_1.default.textSupport, children: "\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u0435\u0441\u044C, \u0447\u0442\u043E \u0438\u043C\u0435\u043D\u043D\u043E \u043D\u0435 \u0442\u0430\u043A?" }))] }), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && ((0, jsx_runtime_1.jsx)(helperComponents_1.ContentDislikeCsat, { classNameContentContainer: styles_module_scss_1.default.classNameContentContainer, classNameChipsContainer: styles_module_scss_1.default.classNameChipsContainer, onCheckChips: dislikeCommentForm.onCheckChips, onClickForm: dislikeCommentForm.onClickForm, loadingButton: dislikeCommentForm.loadingButton, onSubmit: dislikeCommentForm.onSubmit }))] }));
|
|
13
|
+
function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm, showNewAppearance, }) {
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.siteCsatBlock, "data-layout-type": layoutType, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.csatFormBlock, children: [like === undefined || isLoading ? ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleM, { children: label })) : ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.reportSendBlock, children: [(0, jsx_runtime_1.jsx)(icons_1.CheckFilledSVG, { className: styles_module_scss_1.default.checkIcon }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleM, { children: "\u0421\u043F\u0430\u0441\u0438\u0431\u043E \u0437\u0430 \u043E\u0442\u0437\u044B\u0432" })] })), isLoading ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.spinnerContainer, children: (0, jsx_runtime_1.jsx)(loaders_1.Spinner, {}) })) : ((0, jsx_runtime_1.jsx)(helperComponents_1.LikeDislikeBlock, { showNewAppearance: showNewAppearance, dislikeEnabled: dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled, like: like, onSetLike: onSetLike })), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { className: styles_module_scss_1.default.textSupport, children: "\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u0435\u0441\u044C, \u0447\u0442\u043E \u0438\u043C\u0435\u043D\u043D\u043E \u043D\u0435 \u0442\u0430\u043A?" }))] }), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && ((0, jsx_runtime_1.jsx)(helperComponents_1.ContentDislikeCsat, { classNameContentContainer: styles_module_scss_1.default.classNameContentContainer, classNameChipsContainer: styles_module_scss_1.default.classNameChipsContainer, onCheckChips: dislikeCommentForm.onCheckChips, onClickForm: dislikeCommentForm.onClickForm, loadingButton: dislikeCommentForm.loadingButton, onSubmit: dislikeCommentForm.onSubmit }))] }));
|
|
15
15
|
}
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import { WithLayoutType } from '@
|
|
1
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
2
2
|
import { onSubmitVariables } from '../../types';
|
|
3
3
|
export type SiteCsatPopoverProps = WithLayoutType<{
|
|
4
|
+
/** Отображение Spinner */
|
|
4
5
|
loading?: boolean;
|
|
6
|
+
/** Состояние отображение лайка: лайк, дизлайк или ничего не выбрано */
|
|
5
7
|
like?: boolean;
|
|
8
|
+
/** Обработчик нажатия на лайк или дизлайк */
|
|
6
9
|
onSetLike: (flag: boolean) => void;
|
|
10
|
+
/** Текст рядом с кнопками */
|
|
7
11
|
label: string;
|
|
12
|
+
/** Данные поповера */
|
|
8
13
|
negativeFeedbackForm: {
|
|
14
|
+
/** Флаг открытости поповера */
|
|
9
15
|
open: boolean;
|
|
16
|
+
/** Обработчик открытия или закрытия поповера */
|
|
10
17
|
onSetOpen: (flag: boolean) => void;
|
|
11
18
|
};
|
|
19
|
+
/** Выбор версии компонента, сделано для a/b тестирования, после тестирования этот prop удалится */
|
|
20
|
+
showNewAppearance?: boolean;
|
|
21
|
+
/** Данные для заполнения формы фидбэка */
|
|
12
22
|
dislikeCommentForm?: {
|
|
23
|
+
/** Доступно ли нажатие на дизлайк */
|
|
13
24
|
dislikeEnabled: boolean;
|
|
25
|
+
/** Состояние загрузки кнопки отправки */
|
|
14
26
|
loadingButton?: boolean;
|
|
27
|
+
/** Обработчик нажатия на форму */
|
|
15
28
|
onClickForm(): void;
|
|
29
|
+
/** Обработчик нажатия на chips */
|
|
16
30
|
onCheckChips?(titleChip: string): void;
|
|
31
|
+
/** Обработчик onSubmit формы */
|
|
17
32
|
onSubmit({ textComment, selectedChips }: onSubmitVariables): void;
|
|
18
33
|
};
|
|
19
34
|
}>;
|
|
20
|
-
export declare function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, }: SiteCsatPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, showNewAppearance, }: SiteCsatPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SiteCsatPopover = SiteCsatPopover;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
|
-
const uikit_product_mobile_modal_1 = require("@
|
|
9
|
+
const uikit_product_mobile_modal_1 = require("@cloud-ru/uikit-product-mobile-modal");
|
|
10
10
|
const loaders_1 = require("@snack-uikit/loaders");
|
|
11
11
|
const popover_1 = require("@snack-uikit/popover");
|
|
12
12
|
const typography_1 = require("@snack-uikit/typography");
|
|
13
13
|
const helperComponents_1 = require("../../helperComponents");
|
|
14
14
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
15
|
-
function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, }) {
|
|
15
|
+
function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, showNewAppearance = false, }) {
|
|
16
16
|
const isMobile = layoutType === 'mobile';
|
|
17
17
|
const triggerRef = (0, react_1.useRef)(null);
|
|
18
18
|
const handleOpenClosePopover = () => {
|
|
@@ -23,5 +23,7 @@ function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbac
|
|
|
23
23
|
size: 'm',
|
|
24
24
|
fullWidth: true,
|
|
25
25
|
} }) })] }));
|
|
26
|
-
|
|
26
|
+
const title = like === true || (like !== undefined && !(dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled)) ? 'Спасибо за отзыв!' : label;
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.siteCsatPopoverBlock, children: [!isMobile &&
|
|
28
|
+
(showNewAppearance ? ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleM, { className: styles_module_scss_1.default.labelNewAppearance, children: title })) : ((0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyM, { className: styles_module_scss_1.default.label, children: label }))), loading ? ((0, jsx_runtime_1.jsx)(loaders_1.Spinner, { className: styles_module_scss_1.default.spinner })) : ((0, jsx_runtime_1.jsx)(helperComponents_1.LikeDislikeBlock, { showNewAppearance: showNewAppearance, dislikeEnabled: dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled, className: styles_module_scss_1.default.likeDislikeBlock, onOpenClosePopover: handleOpenClosePopover, triggerRef: triggerRef, like: like, onSetLike: onSetLike, hideTextLabel: isMobile }))] }), isMobile ? mobileModal : popover] }));
|
|
27
29
|
}
|
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
flex-direction:row;
|
|
5
5
|
align-items:center;
|
|
6
6
|
gap:12px;
|
|
7
|
+
height:32px;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
.label{
|
|
10
11
|
color:var(--sys-neutral-text-support, #6d707f);
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
.labelNewAppearance{
|
|
15
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
.likeDislikeBlock{
|
|
14
19
|
display:flex;
|
|
15
20
|
flex-direction:row;
|
|
@@ -6,6 +6,8 @@ type LikeDislikeBlockProps = {
|
|
|
6
6
|
triggerRef?: MutableRefObject<HTMLButtonElement | null>;
|
|
7
7
|
onOpenClosePopover?: () => void;
|
|
8
8
|
onSetLike: (flag: boolean) => void;
|
|
9
|
+
showNewAppearance?: boolean;
|
|
10
|
+
hideTextLabel?: boolean;
|
|
9
11
|
};
|
|
10
|
-
export declare function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, }: LikeDislikeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, showNewAppearance, hideTextLabel, }: LikeDislikeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -6,15 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.LikeDislikeBlock = LikeDislikeBlock;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const classnames_1 = __importDefault(require("classnames"));
|
|
9
|
-
const uikit_product_icons_1 = require("@
|
|
9
|
+
const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
|
|
10
10
|
const button_1 = require("@snack-uikit/button");
|
|
11
11
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
12
|
-
function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, }) {
|
|
12
|
+
function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, showNewAppearance, hideTextLabel, }) {
|
|
13
13
|
const handleLike = () => {
|
|
14
14
|
onSetLike(true);
|
|
15
15
|
};
|
|
16
16
|
const handleDislike = () => {
|
|
17
17
|
onSetLike(false);
|
|
18
18
|
};
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: className || styles_module_scss_1.default.likeDislikeBlock, children: like === undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(button_1.
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className || styles_module_scss_1.default.likeDislikeBlock, children: like === undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showNewAppearance ? ((0, jsx_runtime_1.jsx)(button_1.ButtonTonal, Object.assign({ onClick: handleLike, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.LikeOutlineSVG, {}) }, (hideTextLabel ? {} : { label: 'Да' })))) : ((0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { onClick: handleLike, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.LikeOutlineSVG, {}) })), showNewAppearance ? ((0, jsx_runtime_1.jsx)(button_1.ButtonTonal, Object.assign({ onClick: handleDislike, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.DislikeOutlineSVG, {}) }, (hideTextLabel ? {} : { label: 'Нет' })))) : ((0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { onClick: handleDislike, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.DislikeOutlineSVG, {}) }))] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [like &&
|
|
20
|
+
(showNewAppearance ? ((0, jsx_runtime_1.jsx)(button_1.ButtonTonal, Object.assign({ disabled: true, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.LikeFilledSVG, {}) }, (hideTextLabel ? {} : { label: 'Да' })))) : ((0, jsx_runtime_1.jsx)(uikit_product_icons_1.LikeFilledSVG, { className: (0, classnames_1.default)(styles_module_scss_1.default.icon, styles_module_scss_1.default.iconDisabled) }))), !like &&
|
|
21
|
+
(showNewAppearance ? ((0, jsx_runtime_1.jsx)(button_1.ButtonTonal, Object.assign({ disabled: !dislikeEnabled, onClick: onOpenClosePopover, ref: triggerRef, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.DislikeFilledSVG, {}) }, (hideTextLabel ? {} : { label: 'Нет' })))) : ((0, jsx_runtime_1.jsx)(button_1.ButtonFunction, { onClick: onOpenClosePopover, disabled: !dislikeEnabled, ref: triggerRef, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.DislikeFilledSVG, {}) })))] })) }));
|
|
20
22
|
}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PopoverReportContent = PopoverReportContent;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const uikit_product_icons_1 = require("@
|
|
8
|
+
const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
|
|
9
9
|
const typography_1 = require("@snack-uikit/typography");
|
|
10
10
|
const ContentDislikeCsat_1 = require("../ContentDislikeCsat");
|
|
11
11
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
import { WithLayoutType } from '@
|
|
1
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
2
2
|
import { onSubmitVariables } from '../../types';
|
|
3
3
|
export type SiteCsatProps = WithLayoutType<{
|
|
4
|
+
/** Отображение Spinner */
|
|
4
5
|
isLoading?: boolean;
|
|
6
|
+
/** Состояние отображение лайка: лайк, дизлайк или ничего не выбрано */
|
|
5
7
|
like?: boolean;
|
|
8
|
+
/** Обработчик нажатия на лайк или дизлайк */
|
|
6
9
|
onSetLike: (flag: boolean) => void;
|
|
10
|
+
/** Текст рядом с кнопками */
|
|
7
11
|
label: string;
|
|
12
|
+
/** Выбор версии компонента, сделано для a/b тестирования, после тестирования этот prop удалится */
|
|
13
|
+
showNewAppearance?: boolean;
|
|
14
|
+
/** Данные для заполнения формы фидбэка */
|
|
8
15
|
dislikeCommentForm?: {
|
|
16
|
+
/** Открыта или закрыт форма */
|
|
9
17
|
open: boolean;
|
|
18
|
+
/** Доступно ли нажатие на дизлайк */
|
|
10
19
|
dislikeEnabled?: boolean;
|
|
20
|
+
/** Состояние загрузки кнопки отправки */
|
|
11
21
|
loadingButton?: boolean;
|
|
22
|
+
/** Обработчик нажатия на форму */
|
|
12
23
|
onClickForm(): void;
|
|
24
|
+
/** Обработчик onSubmit формы */
|
|
13
25
|
onSubmit({ textComment, selectedChips }: onSubmitVariables): void;
|
|
26
|
+
/** Обработчик нажатия на chips */
|
|
14
27
|
onCheckChips?(titleChip: string): void;
|
|
15
28
|
};
|
|
16
29
|
}>;
|
|
17
|
-
export declare function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm }: SiteCsatProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm, showNewAppearance, }: SiteCsatProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,6 +4,6 @@ import { Spinner } from '@snack-uikit/loaders';
|
|
|
4
4
|
import { Typography } from '@snack-uikit/typography';
|
|
5
5
|
import { ContentDislikeCsat, LikeDislikeBlock } from '../../helperComponents';
|
|
6
6
|
import styles from './styles.module.css';
|
|
7
|
-
export function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm }) {
|
|
8
|
-
return (_jsxs("div", { className: styles.siteCsatBlock, "data-layout-type": layoutType, children: [_jsxs("div", { className: styles.csatFormBlock, children: [like === undefined || isLoading ? (_jsx(Typography.SansTitleM, { children: label })) : (_jsxs("div", { className: styles.reportSendBlock, children: [_jsx(CheckFilledSVG, { className: styles.checkIcon }), _jsx(Typography.SansTitleM, { children: "\u0421\u043F\u0430\u0441\u0438\u0431\u043E \u0437\u0430 \u043E\u0442\u0437\u044B\u0432" })] })), isLoading ? (_jsx(Spinner, {})) : (_jsx(LikeDislikeBlock, { dislikeEnabled: dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled, like: like, onSetLike: onSetLike })), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && (_jsx(Typography.SansBodyM, { className: styles.textSupport, children: "\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u0435\u0441\u044C, \u0447\u0442\u043E \u0438\u043C\u0435\u043D\u043D\u043E \u043D\u0435 \u0442\u0430\u043A?" }))] }), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && (_jsx(ContentDislikeCsat, { classNameContentContainer: styles.classNameContentContainer, classNameChipsContainer: styles.classNameChipsContainer, onCheckChips: dislikeCommentForm.onCheckChips, onClickForm: dislikeCommentForm.onClickForm, loadingButton: dislikeCommentForm.loadingButton, onSubmit: dislikeCommentForm.onSubmit }))] }));
|
|
7
|
+
export function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislikeCommentForm, showNewAppearance, }) {
|
|
8
|
+
return (_jsxs("div", { className: styles.siteCsatBlock, "data-layout-type": layoutType, children: [_jsxs("div", { className: styles.csatFormBlock, children: [like === undefined || isLoading ? (_jsx(Typography.SansTitleM, { children: label })) : (_jsxs("div", { className: styles.reportSendBlock, children: [_jsx(CheckFilledSVG, { className: styles.checkIcon }), _jsx(Typography.SansTitleM, { children: "\u0421\u043F\u0430\u0441\u0438\u0431\u043E \u0437\u0430 \u043E\u0442\u0437\u044B\u0432" })] })), isLoading ? (_jsx("div", { className: styles.spinnerContainer, children: _jsx(Spinner, {}) })) : (_jsx(LikeDislikeBlock, { showNewAppearance: showNewAppearance, dislikeEnabled: dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled, like: like, onSetLike: onSetLike })), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && (_jsx(Typography.SansBodyM, { className: styles.textSupport, children: "\u041F\u043E\u0434\u0435\u043B\u0438\u0442\u0435\u0441\u044C, \u0447\u0442\u043E \u0438\u043C\u0435\u043D\u043D\u043E \u043D\u0435 \u0442\u0430\u043A?" }))] }), like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && (_jsx(ContentDislikeCsat, { classNameContentContainer: styles.classNameContentContainer, classNameChipsContainer: styles.classNameChipsContainer, onCheckChips: dislikeCommentForm.onCheckChips, onClickForm: dislikeCommentForm.onClickForm, loadingButton: dislikeCommentForm.loadingButton, onSubmit: dislikeCommentForm.onSubmit }))] }));
|
|
9
9
|
}
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import { WithLayoutType } from '@
|
|
1
|
+
import { WithLayoutType } from '@cloud-ru/uikit-product-utils';
|
|
2
2
|
import { onSubmitVariables } from '../../types';
|
|
3
3
|
export type SiteCsatPopoverProps = WithLayoutType<{
|
|
4
|
+
/** Отображение Spinner */
|
|
4
5
|
loading?: boolean;
|
|
6
|
+
/** Состояние отображение лайка: лайк, дизлайк или ничего не выбрано */
|
|
5
7
|
like?: boolean;
|
|
8
|
+
/** Обработчик нажатия на лайк или дизлайк */
|
|
6
9
|
onSetLike: (flag: boolean) => void;
|
|
10
|
+
/** Текст рядом с кнопками */
|
|
7
11
|
label: string;
|
|
12
|
+
/** Данные поповера */
|
|
8
13
|
negativeFeedbackForm: {
|
|
14
|
+
/** Флаг открытости поповера */
|
|
9
15
|
open: boolean;
|
|
16
|
+
/** Обработчик открытия или закрытия поповера */
|
|
10
17
|
onSetOpen: (flag: boolean) => void;
|
|
11
18
|
};
|
|
19
|
+
/** Выбор версии компонента, сделано для a/b тестирования, после тестирования этот prop удалится */
|
|
20
|
+
showNewAppearance?: boolean;
|
|
21
|
+
/** Данные для заполнения формы фидбэка */
|
|
12
22
|
dislikeCommentForm?: {
|
|
23
|
+
/** Доступно ли нажатие на дизлайк */
|
|
13
24
|
dislikeEnabled: boolean;
|
|
25
|
+
/** Состояние загрузки кнопки отправки */
|
|
14
26
|
loadingButton?: boolean;
|
|
27
|
+
/** Обработчик нажатия на форму */
|
|
15
28
|
onClickForm(): void;
|
|
29
|
+
/** Обработчик нажатия на chips */
|
|
16
30
|
onCheckChips?(titleChip: string): void;
|
|
31
|
+
/** Обработчик onSubmit формы */
|
|
17
32
|
onSubmit({ textComment, selectedChips }: onSubmitVariables): void;
|
|
18
33
|
};
|
|
19
34
|
}>;
|
|
20
|
-
export declare function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, }: SiteCsatPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, showNewAppearance, }: SiteCsatPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from 'react';
|
|
3
|
-
import { MobileModalCustom } from '@
|
|
3
|
+
import { MobileModalCustom } from '@cloud-ru/uikit-product-mobile-modal';
|
|
4
4
|
import { Spinner } from '@snack-uikit/loaders';
|
|
5
5
|
import { Popover } from '@snack-uikit/popover';
|
|
6
6
|
import { Typography } from '@snack-uikit/typography';
|
|
7
7
|
import { ContentDislikeCsat, LikeDislikeBlock, PopoverReportContent } from '../../helperComponents';
|
|
8
8
|
import styles from './styles.module.css';
|
|
9
|
-
export function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, }) {
|
|
9
|
+
export function SiteCsatPopover({ loading, like, onSetLike, layoutType, negativeFeedbackForm, label, dislikeCommentForm, showNewAppearance = false, }) {
|
|
10
10
|
const isMobile = layoutType === 'mobile';
|
|
11
11
|
const triggerRef = useRef(null);
|
|
12
12
|
const handleOpenClosePopover = () => {
|
|
@@ -17,5 +17,7 @@ export function SiteCsatPopover({ loading, like, onSetLike, layoutType, negative
|
|
|
17
17
|
size: 'm',
|
|
18
18
|
fullWidth: true,
|
|
19
19
|
} }) })] }));
|
|
20
|
-
|
|
20
|
+
const title = like === true || (like !== undefined && !(dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled)) ? 'Спасибо за отзыв!' : label;
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: styles.siteCsatPopoverBlock, children: [!isMobile &&
|
|
22
|
+
(showNewAppearance ? (_jsx(Typography.SansTitleM, { className: styles.labelNewAppearance, children: title })) : (_jsx(Typography.SansBodyM, { className: styles.label, children: label }))), loading ? (_jsx(Spinner, { className: styles.spinner })) : (_jsx(LikeDislikeBlock, { showNewAppearance: showNewAppearance, dislikeEnabled: dislikeCommentForm === null || dislikeCommentForm === void 0 ? void 0 : dislikeCommentForm.dislikeEnabled, className: styles.likeDislikeBlock, onOpenClosePopover: handleOpenClosePopover, triggerRef: triggerRef, like: like, onSetLike: onSetLike, hideTextLabel: isMobile }))] }), isMobile ? mobileModal : popover] }));
|
|
21
23
|
}
|
|
@@ -4,12 +4,17 @@
|
|
|
4
4
|
flex-direction:row;
|
|
5
5
|
align-items:center;
|
|
6
6
|
gap:12px;
|
|
7
|
+
height:32px;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
.label{
|
|
10
11
|
color:var(--sys-neutral-text-support, #6d707f);
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
.labelNewAppearance{
|
|
15
|
+
color:var(--sys-neutral-text-main, #41424e);
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
.likeDislikeBlock{
|
|
14
19
|
display:flex;
|
|
15
20
|
flex-direction:row;
|
|
@@ -6,6 +6,8 @@ type LikeDislikeBlockProps = {
|
|
|
6
6
|
triggerRef?: MutableRefObject<HTMLButtonElement | null>;
|
|
7
7
|
onOpenClosePopover?: () => void;
|
|
8
8
|
onSetLike: (flag: boolean) => void;
|
|
9
|
+
showNewAppearance?: boolean;
|
|
10
|
+
hideTextLabel?: boolean;
|
|
9
11
|
};
|
|
10
|
-
export declare function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, }: LikeDislikeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, showNewAppearance, hideTextLabel, }: LikeDislikeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
-
import { DislikeFilledSVG, DislikeOutlineSVG, LikeFilledSVG, LikeOutlineSVG } from '@
|
|
4
|
-
import { ButtonFunction } from '@snack-uikit/button';
|
|
3
|
+
import { DislikeFilledSVG, DislikeOutlineSVG, LikeFilledSVG, LikeOutlineSVG } from '@cloud-ru/uikit-product-icons';
|
|
4
|
+
import { ButtonFunction, ButtonTonal } from '@snack-uikit/button';
|
|
5
5
|
import styles from './styles.module.css';
|
|
6
|
-
export function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, }) {
|
|
6
|
+
export function LikeDislikeBlock({ like, onSetLike, triggerRef, onOpenClosePopover, className, dislikeEnabled, showNewAppearance, hideTextLabel, }) {
|
|
7
7
|
const handleLike = () => {
|
|
8
8
|
onSetLike(true);
|
|
9
9
|
};
|
|
10
10
|
const handleDislike = () => {
|
|
11
11
|
onSetLike(false);
|
|
12
12
|
};
|
|
13
|
-
return (_jsx("div", { className: className || styles.likeDislikeBlock, children: like === undefined ? (_jsxs(_Fragment, { children: [_jsx(
|
|
13
|
+
return (_jsx("div", { className: className || styles.likeDislikeBlock, children: like === undefined ? (_jsxs(_Fragment, { children: [showNewAppearance ? (_jsx(ButtonTonal, Object.assign({ onClick: handleLike, icon: _jsx(LikeOutlineSVG, {}) }, (hideTextLabel ? {} : { label: 'Да' })))) : (_jsx(ButtonFunction, { onClick: handleLike, icon: _jsx(LikeOutlineSVG, {}) })), showNewAppearance ? (_jsx(ButtonTonal, Object.assign({ onClick: handleDislike, icon: _jsx(DislikeOutlineSVG, {}) }, (hideTextLabel ? {} : { label: 'Нет' })))) : (_jsx(ButtonFunction, { onClick: handleDislike, icon: _jsx(DislikeOutlineSVG, {}) }))] })) : (_jsxs(_Fragment, { children: [like &&
|
|
14
|
+
(showNewAppearance ? (_jsx(ButtonTonal, Object.assign({ disabled: true, icon: _jsx(LikeFilledSVG, {}) }, (hideTextLabel ? {} : { label: 'Да' })))) : (_jsx(LikeFilledSVG, { className: cn(styles.icon, styles.iconDisabled) }))), !like &&
|
|
15
|
+
(showNewAppearance ? (_jsx(ButtonTonal, Object.assign({ disabled: !dislikeEnabled, onClick: onOpenClosePopover, ref: triggerRef, icon: _jsx(DislikeFilledSVG, {}) }, (hideTextLabel ? {} : { label: 'Нет' })))) : (_jsx(ButtonFunction, { onClick: onOpenClosePopover, disabled: !dislikeEnabled, ref: triggerRef, icon: _jsx(DislikeFilledSVG, {}) })))] })) }));
|
|
14
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CloseInterfaceSVG } from '@
|
|
2
|
+
import { CloseInterfaceSVG } from '@cloud-ru/uikit-product-icons';
|
|
3
3
|
import { Typography } from '@snack-uikit/typography';
|
|
4
4
|
import { ContentDislikeCsat } from '../ContentDislikeCsat';
|
|
5
5
|
import styles from './styles.module.css';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/uikit-product-site-csat",
|
|
3
3
|
"title": "Site Csat",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
7
7
|
"*.woff",
|
|
@@ -30,16 +30,15 @@
|
|
|
30
30
|
"name": "Akhremenko Grigorii",
|
|
31
31
|
"url": "https://github.com/AGrigorii"
|
|
32
32
|
},
|
|
33
|
-
"contributors": [],
|
|
34
33
|
"license": "Apache-2.0",
|
|
35
34
|
"publishConfig": {
|
|
36
35
|
"access": "public"
|
|
37
36
|
},
|
|
38
37
|
"scripts": {},
|
|
39
38
|
"dependencies": {
|
|
40
|
-
"@cloud-ru/uikit-product-icons": "15.1.
|
|
41
|
-
"@cloud-ru/uikit-product-mobile-modal": "0.9.
|
|
42
|
-
"@cloud-ru/uikit-product-utils": "7.0.
|
|
39
|
+
"@cloud-ru/uikit-product-icons": "15.1.4",
|
|
40
|
+
"@cloud-ru/uikit-product-mobile-modal": "0.9.21",
|
|
41
|
+
"@cloud-ru/uikit-product-utils": "7.0.3",
|
|
43
42
|
"@snack-uikit/button": "0.19.15",
|
|
44
43
|
"@snack-uikit/chips": "0.28.4",
|
|
45
44
|
"@snack-uikit/fields": "0.48.7",
|
|
@@ -53,5 +52,5 @@
|
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@sbercloud/figma-tokens-cloud-platform": "17.7.6"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "0f2e155399e1e9031939b4ebdff7c860d194a908"
|
|
57
56
|
}
|
|
@@ -8,21 +8,42 @@ import { onSubmitVariables } from '../../types';
|
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
|
|
10
10
|
export type SiteCsatProps = WithLayoutType<{
|
|
11
|
+
/** Отображение Spinner */
|
|
11
12
|
isLoading?: boolean;
|
|
13
|
+
/** Состояние отображение лайка: лайк, дизлайк или ничего не выбрано */
|
|
12
14
|
like?: boolean;
|
|
15
|
+
/** Обработчик нажатия на лайк или дизлайк */
|
|
13
16
|
onSetLike: (flag: boolean) => void;
|
|
17
|
+
/** Текст рядом с кнопками */
|
|
14
18
|
label: string;
|
|
19
|
+
/** Выбор версии компонента, сделано для a/b тестирования, после тестирования этот prop удалится */
|
|
20
|
+
showNewAppearance?: boolean;
|
|
21
|
+
/** Данные для заполнения формы фидбэка */
|
|
15
22
|
dislikeCommentForm?: {
|
|
23
|
+
/** Открыта или закрыт форма */
|
|
16
24
|
open: boolean;
|
|
25
|
+
/** Доступно ли нажатие на дизлайк */
|
|
17
26
|
dislikeEnabled?: boolean;
|
|
27
|
+
/** Состояние загрузки кнопки отправки */
|
|
18
28
|
loadingButton?: boolean;
|
|
29
|
+
/** Обработчик нажатия на форму */
|
|
19
30
|
onClickForm(): void;
|
|
31
|
+
/** Обработчик onSubmit формы */
|
|
20
32
|
onSubmit({ textComment, selectedChips }: onSubmitVariables): void;
|
|
33
|
+
/** Обработчик нажатия на chips */
|
|
21
34
|
onCheckChips?(titleChip: string): void;
|
|
22
35
|
};
|
|
23
36
|
}>;
|
|
24
37
|
|
|
25
|
-
export function SiteCsat({
|
|
38
|
+
export function SiteCsat({
|
|
39
|
+
isLoading,
|
|
40
|
+
like,
|
|
41
|
+
onSetLike,
|
|
42
|
+
layoutType,
|
|
43
|
+
label,
|
|
44
|
+
dislikeCommentForm,
|
|
45
|
+
showNewAppearance,
|
|
46
|
+
}: SiteCsatProps) {
|
|
26
47
|
return (
|
|
27
48
|
<div className={styles.siteCsatBlock} data-layout-type={layoutType}>
|
|
28
49
|
<div className={styles.csatFormBlock}>
|
|
@@ -35,9 +56,16 @@ export function SiteCsat({ isLoading, like, onSetLike, layoutType, label, dislik
|
|
|
35
56
|
</div>
|
|
36
57
|
)}
|
|
37
58
|
{isLoading ? (
|
|
38
|
-
<
|
|
59
|
+
<div className={styles.spinnerContainer}>
|
|
60
|
+
<Spinner />
|
|
61
|
+
</div>
|
|
39
62
|
) : (
|
|
40
|
-
<LikeDislikeBlock
|
|
63
|
+
<LikeDislikeBlock
|
|
64
|
+
showNewAppearance={showNewAppearance}
|
|
65
|
+
dislikeEnabled={dislikeCommentForm?.dislikeEnabled}
|
|
66
|
+
like={like}
|
|
67
|
+
onSetLike={onSetLike}
|
|
68
|
+
/>
|
|
41
69
|
)}
|
|
42
70
|
{like === false && !isLoading && dislikeCommentForm && dislikeCommentForm.open && (
|
|
43
71
|
<Typography.SansBodyM className={styles.textSupport}>Поделитесь, что именно не так?</Typography.SansBodyM>
|
|
@@ -11,19 +11,34 @@ import { onSubmitVariables } from '../../types';
|
|
|
11
11
|
import styles from './styles.module.scss';
|
|
12
12
|
|
|
13
13
|
export type SiteCsatPopoverProps = WithLayoutType<{
|
|
14
|
+
/** Отображение Spinner */
|
|
14
15
|
loading?: boolean;
|
|
16
|
+
/** Состояние отображение лайка: лайк, дизлайк или ничего не выбрано */
|
|
15
17
|
like?: boolean;
|
|
18
|
+
/** Обработчик нажатия на лайк или дизлайк */
|
|
16
19
|
onSetLike: (flag: boolean) => void;
|
|
20
|
+
/** Текст рядом с кнопками */
|
|
17
21
|
label: string;
|
|
22
|
+
/** Данные поповера */
|
|
18
23
|
negativeFeedbackForm: {
|
|
24
|
+
/** Флаг открытости поповера */
|
|
19
25
|
open: boolean;
|
|
26
|
+
/** Обработчик открытия или закрытия поповера */
|
|
20
27
|
onSetOpen: (flag: boolean) => void;
|
|
21
28
|
};
|
|
29
|
+
/** Выбор версии компонента, сделано для a/b тестирования, после тестирования этот prop удалится */
|
|
30
|
+
showNewAppearance?: boolean;
|
|
31
|
+
/** Данные для заполнения формы фидбэка */
|
|
22
32
|
dislikeCommentForm?: {
|
|
33
|
+
/** Доступно ли нажатие на дизлайк */
|
|
23
34
|
dislikeEnabled: boolean;
|
|
35
|
+
/** Состояние загрузки кнопки отправки */
|
|
24
36
|
loadingButton?: boolean;
|
|
37
|
+
/** Обработчик нажатия на форму */
|
|
25
38
|
onClickForm(): void;
|
|
39
|
+
/** Обработчик нажатия на chips */
|
|
26
40
|
onCheckChips?(titleChip: string): void;
|
|
41
|
+
/** Обработчик onSubmit формы */
|
|
27
42
|
onSubmit({ textComment, selectedChips }: onSubmitVariables): void;
|
|
28
43
|
};
|
|
29
44
|
}>;
|
|
@@ -36,6 +51,7 @@ export function SiteCsatPopover({
|
|
|
36
51
|
negativeFeedbackForm,
|
|
37
52
|
label,
|
|
38
53
|
dislikeCommentForm,
|
|
54
|
+
showNewAppearance = false,
|
|
39
55
|
}: SiteCsatPopoverProps) {
|
|
40
56
|
const isMobile = layoutType === 'mobile';
|
|
41
57
|
|
|
@@ -83,20 +99,30 @@ export function SiteCsatPopover({
|
|
|
83
99
|
</MobileModalCustom>
|
|
84
100
|
);
|
|
85
101
|
|
|
102
|
+
const title =
|
|
103
|
+
like === true || (like !== undefined && !dislikeCommentForm?.dislikeEnabled) ? 'Спасибо за отзыв!' : label;
|
|
104
|
+
|
|
86
105
|
return (
|
|
87
106
|
<>
|
|
88
107
|
<div className={styles.siteCsatPopoverBlock}>
|
|
89
|
-
{!isMobile &&
|
|
108
|
+
{!isMobile &&
|
|
109
|
+
(showNewAppearance ? (
|
|
110
|
+
<Typography.SansTitleM className={styles.labelNewAppearance}>{title}</Typography.SansTitleM>
|
|
111
|
+
) : (
|
|
112
|
+
<Typography.SansBodyM className={styles.label}>{label}</Typography.SansBodyM>
|
|
113
|
+
))}
|
|
90
114
|
{loading ? (
|
|
91
115
|
<Spinner className={styles.spinner} />
|
|
92
116
|
) : (
|
|
93
117
|
<LikeDislikeBlock
|
|
118
|
+
showNewAppearance={showNewAppearance}
|
|
94
119
|
dislikeEnabled={dislikeCommentForm?.dislikeEnabled}
|
|
95
120
|
className={styles.likeDislikeBlock}
|
|
96
121
|
onOpenClosePopover={handleOpenClosePopover}
|
|
97
122
|
triggerRef={triggerRef}
|
|
98
123
|
like={like}
|
|
99
124
|
onSetLike={onSetLike}
|
|
125
|
+
hideTextLabel={isMobile}
|
|
100
126
|
/>
|
|
101
127
|
)}
|
|
102
128
|
</div>
|
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
flex-direction: row;
|
|
7
7
|
align-items: center;
|
|
8
8
|
gap: 12px;
|
|
9
|
+
height: 32px;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
.label {
|
|
12
13
|
color: ste.$sys-neutral-text-support;
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
.labelNewAppearance {
|
|
17
|
+
color: ste.$sys-neutral-text-main;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
.likeDislikeBlock {
|
|
16
21
|
display: flex;
|
|
17
22
|
flex-direction: row;
|
|
@@ -2,7 +2,7 @@ import cn from 'classnames';
|
|
|
2
2
|
import { MutableRefObject } from 'react';
|
|
3
3
|
|
|
4
4
|
import { DislikeFilledSVG, DislikeOutlineSVG, LikeFilledSVG, LikeOutlineSVG } from '@cloud-ru/uikit-product-icons';
|
|
5
|
-
import { ButtonFunction } from '@snack-uikit/button';
|
|
5
|
+
import { ButtonFunction, ButtonTonal } from '@snack-uikit/button';
|
|
6
6
|
|
|
7
7
|
import styles from './styles.module.scss';
|
|
8
8
|
|
|
@@ -13,6 +13,8 @@ type LikeDislikeBlockProps = {
|
|
|
13
13
|
triggerRef?: MutableRefObject<HTMLButtonElement | null>;
|
|
14
14
|
onOpenClosePopover?: () => void;
|
|
15
15
|
onSetLike: (flag: boolean) => void;
|
|
16
|
+
showNewAppearance?: boolean;
|
|
17
|
+
hideTextLabel?: boolean;
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export function LikeDislikeBlock({
|
|
@@ -22,6 +24,8 @@ export function LikeDislikeBlock({
|
|
|
22
24
|
onOpenClosePopover,
|
|
23
25
|
className,
|
|
24
26
|
dislikeEnabled,
|
|
27
|
+
showNewAppearance,
|
|
28
|
+
hideTextLabel,
|
|
25
29
|
}: LikeDislikeBlockProps) {
|
|
26
30
|
const handleLike = () => {
|
|
27
31
|
onSetLike(true);
|
|
@@ -35,20 +39,46 @@ export function LikeDislikeBlock({
|
|
|
35
39
|
<div className={className || styles.likeDislikeBlock}>
|
|
36
40
|
{like === undefined ? (
|
|
37
41
|
<>
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
{showNewAppearance ? (
|
|
43
|
+
<ButtonTonal onClick={handleLike} icon={<LikeOutlineSVG />} {...(hideTextLabel ? {} : { label: 'Да' })} />
|
|
44
|
+
) : (
|
|
45
|
+
<ButtonFunction onClick={handleLike} icon={<LikeOutlineSVG />} />
|
|
46
|
+
)}
|
|
47
|
+
{showNewAppearance ? (
|
|
48
|
+
<ButtonTonal
|
|
49
|
+
onClick={handleDislike}
|
|
50
|
+
icon={<DislikeOutlineSVG />}
|
|
51
|
+
{...(hideTextLabel ? {} : { label: 'Нет' })}
|
|
52
|
+
/>
|
|
53
|
+
) : (
|
|
54
|
+
<ButtonFunction onClick={handleDislike} icon={<DislikeOutlineSVG />} />
|
|
55
|
+
)}
|
|
40
56
|
</>
|
|
41
57
|
) : (
|
|
42
58
|
<>
|
|
43
|
-
{like &&
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
{like &&
|
|
60
|
+
(showNewAppearance ? (
|
|
61
|
+
<ButtonTonal disabled icon={<LikeFilledSVG />} {...(hideTextLabel ? {} : { label: 'Да' })} />
|
|
62
|
+
) : (
|
|
63
|
+
<LikeFilledSVG className={cn(styles.icon, styles.iconDisabled)} />
|
|
64
|
+
))}
|
|
65
|
+
{!like &&
|
|
66
|
+
(showNewAppearance ? (
|
|
67
|
+
<ButtonTonal
|
|
68
|
+
disabled={!dislikeEnabled}
|
|
69
|
+
onClick={onOpenClosePopover}
|
|
70
|
+
ref={triggerRef}
|
|
71
|
+
icon={<DislikeFilledSVG />}
|
|
72
|
+
{...(hideTextLabel ? {} : { label: 'Нет' })}
|
|
73
|
+
/>
|
|
74
|
+
) : (
|
|
75
|
+
<ButtonFunction
|
|
76
|
+
onClick={onOpenClosePopover}
|
|
77
|
+
disabled={!dislikeEnabled}
|
|
78
|
+
ref={triggerRef}
|
|
79
|
+
icon={<DislikeFilledSVG />}
|
|
80
|
+
/>
|
|
81
|
+
))}
|
|
52
82
|
</>
|
|
53
83
|
)}
|
|
54
84
|
</div>
|