@cloud-ru/uikit-product-modal-predefined 2.1.3-preview-8999fa4c.0 → 2.1.3
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 +11 -0
- package/dist/cjs/components/DeleteModal/DeleteModal.js +2 -2
- package/dist/cjs/components/MobileDeleteModal/MobileDeleteModal.js +2 -2
- package/dist/cjs/helperComponents/NoteItem/NoteItem.d.ts +1 -3
- package/dist/cjs/helperComponents/NoteItem/NoteItem.js +2 -19
- package/dist/cjs/helperComponents/NoteItem/styles.module.css +0 -34
- package/dist/cjs/helperComponents/NoteItemMobile/NoteItemMobile.d.ts +1 -1
- package/dist/cjs/helperComponents/NoteItemMobile/NoteItemMobile.js +2 -19
- package/dist/cjs/helperComponents/NoteItemMobile/styles.module.css +0 -39
- package/dist/esm/components/DeleteModal/DeleteModal.js +2 -2
- package/dist/esm/components/MobileDeleteModal/MobileDeleteModal.js +2 -2
- package/dist/esm/helperComponents/NoteItem/NoteItem.d.ts +1 -3
- package/dist/esm/helperComponents/NoteItem/NoteItem.js +3 -20
- package/dist/esm/helperComponents/NoteItem/styles.module.css +0 -34
- package/dist/esm/helperComponents/NoteItemMobile/NoteItemMobile.d.ts +1 -1
- package/dist/esm/helperComponents/NoteItemMobile/NoteItemMobile.js +3 -20
- package/dist/esm/helperComponents/NoteItemMobile/styles.module.css +0 -39
- package/package.json +2 -2
- package/src/components/DeleteModal/DeleteModal.tsx +3 -3
- package/src/components/MobileDeleteModal/MobileDeleteModal.tsx +3 -3
- package/src/helperComponents/NoteItem/NoteItem.tsx +2 -51
- package/src/helperComponents/NoteItem/styles.module.scss +0 -34
- package/src/helperComponents/NoteItemMobile/NoteItemMobile.tsx +2 -48
- package/src/helperComponents/NoteItemMobile/styles.module.scss +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## 2.1.3 (2026-03-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **PDS-3586:** reset field stage on close modal ([51565ca](https://github.com/cloud-ru-tech/uikit-product/commit/51565ca3c9f69cd14821769b5157e05968e5bb48))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 2.1.2 (2026-03-17)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.DeleteModal = DeleteModal;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
19
20
|
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
20
21
|
const button_1 = require("@snack-uikit/button");
|
|
21
22
|
const modal_1 = require("@snack-uikit/modal");
|
|
@@ -35,14 +36,13 @@ function DeleteModal(_a) {
|
|
|
35
36
|
}), { reset, handleSubmit } = _b, inputProps = __rest(_b, ["reset", "handleSubmit"]);
|
|
36
37
|
const handleClose = () => {
|
|
37
38
|
onClose();
|
|
38
|
-
reset();
|
|
39
39
|
};
|
|
40
40
|
const handleCancel = () => {
|
|
41
41
|
onClose();
|
|
42
|
-
reset();
|
|
43
42
|
};
|
|
44
43
|
const handleDelete = handleSubmit(() => {
|
|
45
44
|
onDelete(handleClose);
|
|
46
45
|
});
|
|
46
|
+
(0, react_1.useEffect)(() => reset, [reset, open]);
|
|
47
47
|
return ((0, jsx_runtime_1.jsxs)(modal_1.ModalCustom, Object.assign({}, restProps, { open: open, onClose: handleClose, children: [(0, jsx_runtime_1.jsx)(modal_1.ModalCustom.Header, { title: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { text: `${t('title')} ${objectType !== null && objectType !== void 0 ? objectType : ''}`, maxLines: 2 }), subtitle: subtitle, titleTooltip: titleTooltip }), description && (0, jsx_runtime_1.jsx)(modal_1.ModalCustom.Body, { content: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.description, children: description }) }), (0, jsx_runtime_1.jsx)(modal_1.ModalCustom.Footer, { actions: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.footer, children: [withInputConfirmation && ((0, jsx_runtime_1.jsx)(helperComponents_1.InputConfirm, Object.assign({ confirmText: confirmText, hideConfirmCopyButton: hideConfirmCopyButton, labelText: t('fieldLabel'), placeholder: t(`enterText.${confirmTextVariant}`) }, inputProps))), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.footerActions, children: [(0, jsx_runtime_1.jsx)(button_1.ButtonFilled, { label: t('delete'), loading: deleting, "data-test-id": constants_1.TEST_IDS.approveButton, onClick: handleDelete, size: 'm', appearance: 'destructive' }), (0, jsx_runtime_1.jsx)(button_1.ButtonOutline, { label: t('cancel'), onClick: handleCancel, "data-test-id": constants_1.TEST_IDS.closeButton, appearance: 'neutral', size: 'm' })] })] }) })] })));
|
|
48
48
|
}
|
|
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.MobileDeleteModal = MobileDeleteModal;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
19
20
|
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
20
21
|
const uikit_product_mobile_modal_1 = require("@cloud-ru/uikit-product-mobile-modal");
|
|
21
22
|
const button_1 = require("@snack-uikit/button");
|
|
@@ -34,14 +35,13 @@ function MobileDeleteModal(_a) {
|
|
|
34
35
|
}), { reset, handleSubmit } = _b, inputProps = __rest(_b, ["reset", "handleSubmit"]);
|
|
35
36
|
const handleClose = () => {
|
|
36
37
|
onClose();
|
|
37
|
-
reset();
|
|
38
38
|
};
|
|
39
39
|
const handleCancel = () => {
|
|
40
40
|
onClose();
|
|
41
|
-
reset();
|
|
42
41
|
};
|
|
43
42
|
const handleDelete = handleSubmit(() => {
|
|
44
43
|
onDelete(handleClose);
|
|
45
44
|
});
|
|
45
|
+
(0, react_1.useEffect)(() => reset, [reset, open]);
|
|
46
46
|
return ((0, jsx_runtime_1.jsxs)(uikit_product_mobile_modal_1.MobileModalCustom, Object.assign({}, restProps, { open: open, onClose: handleClose, children: [(0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModalCustom.Header, { title: `${t('title')} ${objectType !== null && objectType !== void 0 ? objectType : ''}`, titleTooltip: titleTooltip, subtitle: subtitle }), (0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModalCustom.Body, { content: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.description, children: description }) }), (0, jsx_runtime_1.jsx)(uikit_product_mobile_modal_1.MobileModalCustom.Footer, { actions: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.footer, children: [withInputConfirmation && ((0, jsx_runtime_1.jsx)(helperComponents_1.InputConfirm, Object.assign({ confirmText: confirmText, hideConfirmCopyButton: hideConfirmCopyButton, labelText: t('fieldLabel'), placeholder: t(`enterText.${confirmTextVariant}`) }, inputProps))), (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.footerActions, children: [(0, jsx_runtime_1.jsx)(button_1.ButtonFilled, { size: 'm', fullWidth: true, label: t('delete'), loading: deleting, onClick: handleDelete, appearance: 'destructive', "data-test-id": constants_1.TEST_IDS.approveButton }), (0, jsx_runtime_1.jsx)(button_1.ButtonOutline, { size: 'm', fullWidth: true, appearance: 'neutral', label: t('cancel'), onClick: handleCancel, "data-test-id": constants_1.TEST_IDS.closeButton })] })] }) })] })));
|
|
47
47
|
}
|
|
@@ -8,7 +8,5 @@ export type NoteItemProps = {
|
|
|
8
8
|
src: string;
|
|
9
9
|
alt: string;
|
|
10
10
|
};
|
|
11
|
-
/** URL видео (при наличии показывается вместо статичного изображения) */
|
|
12
|
-
video?: string;
|
|
13
11
|
};
|
|
14
|
-
export declare function NoteItem({ title, description, image
|
|
12
|
+
export declare function NoteItem({ title, description, image }: NoteItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,27 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.NoteItem = NoteItem;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
8
|
const uikit_product_markdown_1 = require("@cloud-ru/uikit-product-markdown");
|
|
10
9
|
const scroll_1 = require("@snack-uikit/scroll");
|
|
11
|
-
const skeleton_1 = require("@snack-uikit/skeleton");
|
|
12
10
|
const typography_1 = require("@snack-uikit/typography");
|
|
13
11
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
const [videoError, setVideoError] = (0, react_1.useState)(false);
|
|
17
|
-
(0, react_1.useEffect)(() => {
|
|
18
|
-
if (!video) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
setVideoReady(false);
|
|
22
|
-
setVideoError(false);
|
|
23
|
-
}, [video]);
|
|
24
|
-
if (!video) {
|
|
25
|
-
return (0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, className: styles_module_scss_1.default.noteItemIllustration });
|
|
26
|
-
}
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noteItemIllustrationSlot, children: videoError ? ((0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, className: styles_module_scss_1.default.noteItemIllustration })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { src: video, className: styles_module_scss_1.default.noteItemVideo, muted: true, loop: true, playsInline: true, autoPlay: true, onLoadedData: () => setVideoReady(true), onError: () => setVideoError(true), "aria-hidden": true }), !videoReady && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noteItemMediaSkeletonOverlay, children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { width: 380, height: 380, borderRadius: 8 }) }))] })) }));
|
|
28
|
-
}
|
|
29
|
-
function NoteItem({ title, description, image, video }) {
|
|
30
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.noteItemWrapper, children: [(0, jsx_runtime_1.jsx)(scroll_1.Scroll, { size: 's', barHideStrategy: 'never', children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.noteItemText, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleL, { children: title }), (0, jsx_runtime_1.jsx)(uikit_product_markdown_1.Markdown, { value: description, className: styles_module_scss_1.default.noteItemMarkdownViewer })] }) }), (0, jsx_runtime_1.jsx)(NoteItemMedia, { image: image, video: video })] }));
|
|
12
|
+
function NoteItem({ title, description, image }) {
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.noteItemWrapper, children: [(0, jsx_runtime_1.jsx)(scroll_1.Scroll, { size: 's', barHideStrategy: 'never', children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.noteItemText, children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleL, { children: title }), (0, jsx_runtime_1.jsx)(uikit_product_markdown_1.Markdown, { value: description, className: styles_module_scss_1.default.noteItemMarkdownViewer })] }) }), (0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, className: styles_module_scss_1.default.noteItemIllustration })] }));
|
|
31
14
|
}
|
|
@@ -12,15 +12,6 @@
|
|
|
12
12
|
gap:var(--dimension-2m, 16px);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.noteItemIllustrationSlot{
|
|
16
|
-
position:relative;
|
|
17
|
-
flex-shrink:0;
|
|
18
|
-
width:380px;
|
|
19
|
-
height:380px;
|
|
20
|
-
border-radius:var(--dimension-1m, 8px);
|
|
21
|
-
overflow:hidden;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
15
|
.noteItemIllustration{
|
|
25
16
|
border-radius:var(--dimension-1m, 8px);
|
|
26
17
|
width:380px;
|
|
@@ -28,31 +19,6 @@
|
|
|
28
19
|
-o-object-fit:cover;
|
|
29
20
|
object-fit:cover;
|
|
30
21
|
pointer-events:none;
|
|
31
|
-
display:block;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.noteItemIllustrationSlot .noteItemIllustration,
|
|
35
|
-
.noteItemVideo{
|
|
36
|
-
width:100%;
|
|
37
|
-
height:100%;
|
|
38
|
-
border-radius:0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.noteItemVideo{
|
|
42
|
-
-o-object-fit:cover;
|
|
43
|
-
object-fit:cover;
|
|
44
|
-
pointer-events:none;
|
|
45
|
-
display:block;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.noteItemMediaSkeletonOverlay{
|
|
49
|
-
position:absolute;
|
|
50
|
-
inset:0;
|
|
51
|
-
display:flex;
|
|
52
|
-
align-items:center;
|
|
53
|
-
justify-content:center;
|
|
54
|
-
border-radius:inherit;
|
|
55
|
-
pointer-events:none;
|
|
56
22
|
}
|
|
57
23
|
|
|
58
24
|
.noteItemMarkdownViewer{
|
|
@@ -5,5 +5,5 @@ type NoteItemMobileProps = NoteItemProps & {
|
|
|
5
5
|
childrenScrollRefs: RefObject<HTMLElement[]>;
|
|
6
6
|
onScrollRefInitialized(): void;
|
|
7
7
|
};
|
|
8
|
-
export declare function NoteItemMobile({ title, description, image,
|
|
8
|
+
export declare function NoteItemMobile({ title, description, image, childrenScrollRefs, index, onScrollRefInitialized, }: NoteItemMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -5,32 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.NoteItemMobile = NoteItemMobile;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
8
|
const uikit_product_markdown_1 = require("@cloud-ru/uikit-product-markdown");
|
|
10
9
|
const scroll_1 = require("@snack-uikit/scroll");
|
|
11
|
-
const skeleton_1 = require("@snack-uikit/skeleton");
|
|
12
10
|
const typography_1 = require("@snack-uikit/typography");
|
|
13
11
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
14
|
-
function
|
|
15
|
-
const [videoReady, setVideoReady] = (0, react_1.useState)(false);
|
|
16
|
-
const [videoError, setVideoError] = (0, react_1.useState)(false);
|
|
17
|
-
(0, react_1.useEffect)(() => {
|
|
18
|
-
if (!video) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
setVideoReady(false);
|
|
22
|
-
setVideoError(false);
|
|
23
|
-
}, [video]);
|
|
24
|
-
if (!video) {
|
|
25
|
-
return (0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, className: styles_module_scss_1.default.noteItemIllustration });
|
|
26
|
-
}
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noteItemIllustrationSlot, children: videoError ? ((0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, className: styles_module_scss_1.default.noteItemIllustration })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { src: video, className: styles_module_scss_1.default.noteItemVideo, muted: true, loop: true, playsInline: true, autoPlay: true, onLoadedData: () => setVideoReady(true), onError: () => setVideoError(true), "aria-hidden": true }), !videoReady && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noteItemMediaSkeletonOverlay, children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { width: '100%', height: '100%', borderRadius: 8 }) }))] })) }));
|
|
28
|
-
}
|
|
29
|
-
function NoteItemMobile({ title, description, image, video, childrenScrollRefs, index, onScrollRefInitialized, }) {
|
|
12
|
+
function NoteItemMobile({ title, description, image, childrenScrollRefs, index, onScrollRefInitialized, }) {
|
|
30
13
|
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.noteItemWrapper, children: (0, jsx_runtime_1.jsx)(scroll_1.Scroll, { size: 'm', barHideStrategy: 'never', ref: el => {
|
|
31
14
|
if (childrenScrollRefs.current && el) {
|
|
32
15
|
childrenScrollRefs.current[index] = el;
|
|
33
16
|
onScrollRefInitialized();
|
|
34
17
|
}
|
|
35
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.noteItemContent, children: [(0, jsx_runtime_1.jsx)(
|
|
18
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.noteItemContent, children: [(0, jsx_runtime_1.jsx)("img", { src: image.src, alt: image.alt, className: styles_module_scss_1.default.noteItemIllustration }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansTitleL, { children: title }), (0, jsx_runtime_1.jsx)(uikit_product_markdown_1.Markdown, { value: description, className: styles_module_scss_1.default.noteItemMarkdownViewer })] }) }) }));
|
|
36
19
|
}
|
|
@@ -10,50 +10,11 @@
|
|
|
10
10
|
padding-right:var(--dimension-2m, 16px);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.noteItemIllustrationSlot{
|
|
14
|
-
position:relative;
|
|
15
|
-
width:100%;
|
|
16
|
-
max-width:380px;
|
|
17
|
-
align-self:center;
|
|
18
|
-
aspect-ratio:1/1;
|
|
19
|
-
border-radius:var(--dimension-1m, 8px);
|
|
20
|
-
overflow:hidden;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
13
|
.noteItemIllustration{
|
|
24
14
|
width:100%;
|
|
25
|
-
height:auto;
|
|
26
15
|
pointer-events:none;
|
|
27
16
|
max-width:380px;
|
|
28
17
|
align-self:center;
|
|
29
|
-
display:block;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.noteItemIllustrationSlot .noteItemIllustration{
|
|
33
|
-
width:100%;
|
|
34
|
-
height:100%;
|
|
35
|
-
max-width:none;
|
|
36
|
-
-o-object-fit:cover;
|
|
37
|
-
object-fit:cover;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.noteItemVideo{
|
|
41
|
-
width:100%;
|
|
42
|
-
height:100%;
|
|
43
|
-
-o-object-fit:cover;
|
|
44
|
-
object-fit:cover;
|
|
45
|
-
pointer-events:none;
|
|
46
|
-
display:block;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.noteItemMediaSkeletonOverlay{
|
|
50
|
-
position:absolute;
|
|
51
|
-
inset:0;
|
|
52
|
-
display:flex;
|
|
53
|
-
align-items:stretch;
|
|
54
|
-
justify-content:stretch;
|
|
55
|
-
border-radius:inherit;
|
|
56
|
-
pointer-events:none;
|
|
57
18
|
}
|
|
58
19
|
|
|
59
20
|
.noteItemSkeletonWrapper{
|
|
@@ -10,6 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useEffect } from 'react';
|
|
13
14
|
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
14
15
|
import { ButtonFilled, ButtonOutline } from '@snack-uikit/button';
|
|
15
16
|
import { ModalCustom } from '@snack-uikit/modal';
|
|
@@ -29,14 +30,13 @@ export function DeleteModal(_a) {
|
|
|
29
30
|
}), { reset, handleSubmit } = _b, inputProps = __rest(_b, ["reset", "handleSubmit"]);
|
|
30
31
|
const handleClose = () => {
|
|
31
32
|
onClose();
|
|
32
|
-
reset();
|
|
33
33
|
};
|
|
34
34
|
const handleCancel = () => {
|
|
35
35
|
onClose();
|
|
36
|
-
reset();
|
|
37
36
|
};
|
|
38
37
|
const handleDelete = handleSubmit(() => {
|
|
39
38
|
onDelete(handleClose);
|
|
40
39
|
});
|
|
40
|
+
useEffect(() => reset, [reset, open]);
|
|
41
41
|
return (_jsxs(ModalCustom, Object.assign({}, restProps, { open: open, onClose: handleClose, children: [_jsx(ModalCustom.Header, { title: _jsx(TruncateString, { text: `${t('title')} ${objectType !== null && objectType !== void 0 ? objectType : ''}`, maxLines: 2 }), subtitle: subtitle, titleTooltip: titleTooltip }), description && _jsx(ModalCustom.Body, { content: _jsx("div", { className: styles.description, children: description }) }), _jsx(ModalCustom.Footer, { actions: _jsxs("div", { className: styles.footer, children: [withInputConfirmation && (_jsx(InputConfirm, Object.assign({ confirmText: confirmText, hideConfirmCopyButton: hideConfirmCopyButton, labelText: t('fieldLabel'), placeholder: t(`enterText.${confirmTextVariant}`) }, inputProps))), _jsxs("div", { className: styles.footerActions, children: [_jsx(ButtonFilled, { label: t('delete'), loading: deleting, "data-test-id": TEST_IDS.approveButton, onClick: handleDelete, size: 'm', appearance: 'destructive' }), _jsx(ButtonOutline, { label: t('cancel'), onClick: handleCancel, "data-test-id": TEST_IDS.closeButton, appearance: 'neutral', size: 'm' })] })] }) })] })));
|
|
42
42
|
}
|
|
@@ -10,6 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useEffect } from 'react';
|
|
13
14
|
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
14
15
|
import { MobileModalCustom } from '@cloud-ru/uikit-product-mobile-modal';
|
|
15
16
|
import { ButtonFilled, ButtonOutline } from '@snack-uikit/button';
|
|
@@ -28,14 +29,13 @@ export function MobileDeleteModal(_a) {
|
|
|
28
29
|
}), { reset, handleSubmit } = _b, inputProps = __rest(_b, ["reset", "handleSubmit"]);
|
|
29
30
|
const handleClose = () => {
|
|
30
31
|
onClose();
|
|
31
|
-
reset();
|
|
32
32
|
};
|
|
33
33
|
const handleCancel = () => {
|
|
34
34
|
onClose();
|
|
35
|
-
reset();
|
|
36
35
|
};
|
|
37
36
|
const handleDelete = handleSubmit(() => {
|
|
38
37
|
onDelete(handleClose);
|
|
39
38
|
});
|
|
39
|
+
useEffect(() => reset, [reset, open]);
|
|
40
40
|
return (_jsxs(MobileModalCustom, Object.assign({}, restProps, { open: open, onClose: handleClose, children: [_jsx(MobileModalCustom.Header, { title: `${t('title')} ${objectType !== null && objectType !== void 0 ? objectType : ''}`, titleTooltip: titleTooltip, subtitle: subtitle }), _jsx(MobileModalCustom.Body, { content: _jsx("div", { className: styles.description, children: description }) }), _jsx(MobileModalCustom.Footer, { actions: _jsxs("div", { className: styles.footer, children: [withInputConfirmation && (_jsx(InputConfirm, Object.assign({ confirmText: confirmText, hideConfirmCopyButton: hideConfirmCopyButton, labelText: t('fieldLabel'), placeholder: t(`enterText.${confirmTextVariant}`) }, inputProps))), _jsxs("div", { className: styles.footerActions, children: [_jsx(ButtonFilled, { size: 'm', fullWidth: true, label: t('delete'), loading: deleting, onClick: handleDelete, appearance: 'destructive', "data-test-id": TEST_IDS.approveButton }), _jsx(ButtonOutline, { size: 'm', fullWidth: true, appearance: 'neutral', label: t('cancel'), onClick: handleCancel, "data-test-id": TEST_IDS.closeButton })] })] }) })] })));
|
|
41
41
|
}
|
|
@@ -8,7 +8,5 @@ export type NoteItemProps = {
|
|
|
8
8
|
src: string;
|
|
9
9
|
alt: string;
|
|
10
10
|
};
|
|
11
|
-
/** URL видео (при наличии показывается вместо статичного изображения) */
|
|
12
|
-
video?: string;
|
|
13
11
|
};
|
|
14
|
-
export declare function NoteItem({ title, description, image
|
|
12
|
+
export declare function NoteItem({ title, description, image }: NoteItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Markdown } from '@cloud-ru/uikit-product-markdown';
|
|
4
3
|
import { Scroll } from '@snack-uikit/scroll';
|
|
5
|
-
import { Skeleton } from '@snack-uikit/skeleton';
|
|
6
4
|
import { Typography } from '@snack-uikit/typography';
|
|
7
5
|
import styles from './styles.module.css';
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
const [videoError, setVideoError] = useState(false);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (!video) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
setVideoReady(false);
|
|
16
|
-
setVideoError(false);
|
|
17
|
-
}, [video]);
|
|
18
|
-
if (!video) {
|
|
19
|
-
return _jsx("img", { src: image.src, alt: image.alt, className: styles.noteItemIllustration });
|
|
20
|
-
}
|
|
21
|
-
return (_jsx("div", { className: styles.noteItemIllustrationSlot, children: videoError ? (_jsx("img", { src: image.src, alt: image.alt, className: styles.noteItemIllustration })) : (_jsxs(_Fragment, { children: [_jsx("video", { src: video, className: styles.noteItemVideo, muted: true, loop: true, playsInline: true, autoPlay: true, onLoadedData: () => setVideoReady(true), onError: () => setVideoError(true), "aria-hidden": true }), !videoReady && (_jsx("div", { className: styles.noteItemMediaSkeletonOverlay, children: _jsx(Skeleton, { width: 380, height: 380, borderRadius: 8 }) }))] })) }));
|
|
22
|
-
}
|
|
23
|
-
export function NoteItem({ title, description, image, video }) {
|
|
24
|
-
return (_jsxs("div", { className: styles.noteItemWrapper, children: [_jsx(Scroll, { size: 's', barHideStrategy: 'never', children: _jsxs("div", { className: styles.noteItemText, children: [_jsx(Typography.SansTitleL, { children: title }), _jsx(Markdown, { value: description, className: styles.noteItemMarkdownViewer })] }) }), _jsx(NoteItemMedia, { image: image, video: video })] }));
|
|
6
|
+
export function NoteItem({ title, description, image }) {
|
|
7
|
+
return (_jsxs("div", { className: styles.noteItemWrapper, children: [_jsx(Scroll, { size: 's', barHideStrategy: 'never', children: _jsxs("div", { className: styles.noteItemText, children: [_jsx(Typography.SansTitleL, { children: title }), _jsx(Markdown, { value: description, className: styles.noteItemMarkdownViewer })] }) }), _jsx("img", { src: image.src, alt: image.alt, className: styles.noteItemIllustration })] }));
|
|
25
8
|
}
|
|
@@ -12,15 +12,6 @@
|
|
|
12
12
|
gap:var(--dimension-2m, 16px);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.noteItemIllustrationSlot{
|
|
16
|
-
position:relative;
|
|
17
|
-
flex-shrink:0;
|
|
18
|
-
width:380px;
|
|
19
|
-
height:380px;
|
|
20
|
-
border-radius:var(--dimension-1m, 8px);
|
|
21
|
-
overflow:hidden;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
15
|
.noteItemIllustration{
|
|
25
16
|
border-radius:var(--dimension-1m, 8px);
|
|
26
17
|
width:380px;
|
|
@@ -28,31 +19,6 @@
|
|
|
28
19
|
-o-object-fit:cover;
|
|
29
20
|
object-fit:cover;
|
|
30
21
|
pointer-events:none;
|
|
31
|
-
display:block;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.noteItemIllustrationSlot .noteItemIllustration,
|
|
35
|
-
.noteItemVideo{
|
|
36
|
-
width:100%;
|
|
37
|
-
height:100%;
|
|
38
|
-
border-radius:0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.noteItemVideo{
|
|
42
|
-
-o-object-fit:cover;
|
|
43
|
-
object-fit:cover;
|
|
44
|
-
pointer-events:none;
|
|
45
|
-
display:block;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.noteItemMediaSkeletonOverlay{
|
|
49
|
-
position:absolute;
|
|
50
|
-
inset:0;
|
|
51
|
-
display:flex;
|
|
52
|
-
align-items:center;
|
|
53
|
-
justify-content:center;
|
|
54
|
-
border-radius:inherit;
|
|
55
|
-
pointer-events:none;
|
|
56
22
|
}
|
|
57
23
|
|
|
58
24
|
.noteItemMarkdownViewer{
|
|
@@ -5,5 +5,5 @@ type NoteItemMobileProps = NoteItemProps & {
|
|
|
5
5
|
childrenScrollRefs: RefObject<HTMLElement[]>;
|
|
6
6
|
onScrollRefInitialized(): void;
|
|
7
7
|
};
|
|
8
|
-
export declare function NoteItemMobile({ title, description, image,
|
|
8
|
+
export declare function NoteItemMobile({ title, description, image, childrenScrollRefs, index, onScrollRefInitialized, }: NoteItemMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Markdown } from '@cloud-ru/uikit-product-markdown';
|
|
4
3
|
import { Scroll } from '@snack-uikit/scroll';
|
|
5
|
-
import { Skeleton } from '@snack-uikit/skeleton';
|
|
6
4
|
import { Typography } from '@snack-uikit/typography';
|
|
7
5
|
import styles from './styles.module.css';
|
|
8
|
-
function
|
|
9
|
-
const [videoReady, setVideoReady] = useState(false);
|
|
10
|
-
const [videoError, setVideoError] = useState(false);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (!video) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
setVideoReady(false);
|
|
16
|
-
setVideoError(false);
|
|
17
|
-
}, [video]);
|
|
18
|
-
if (!video) {
|
|
19
|
-
return _jsx("img", { src: image.src, alt: image.alt, className: styles.noteItemIllustration });
|
|
20
|
-
}
|
|
21
|
-
return (_jsx("div", { className: styles.noteItemIllustrationSlot, children: videoError ? (_jsx("img", { src: image.src, alt: image.alt, className: styles.noteItemIllustration })) : (_jsxs(_Fragment, { children: [_jsx("video", { src: video, className: styles.noteItemVideo, muted: true, loop: true, playsInline: true, autoPlay: true, onLoadedData: () => setVideoReady(true), onError: () => setVideoError(true), "aria-hidden": true }), !videoReady && (_jsx("div", { className: styles.noteItemMediaSkeletonOverlay, children: _jsx(Skeleton, { width: '100%', height: '100%', borderRadius: 8 }) }))] })) }));
|
|
22
|
-
}
|
|
23
|
-
export function NoteItemMobile({ title, description, image, video, childrenScrollRefs, index, onScrollRefInitialized, }) {
|
|
6
|
+
export function NoteItemMobile({ title, description, image, childrenScrollRefs, index, onScrollRefInitialized, }) {
|
|
24
7
|
return (_jsx("div", { className: styles.noteItemWrapper, children: _jsx(Scroll, { size: 'm', barHideStrategy: 'never', ref: el => {
|
|
25
8
|
if (childrenScrollRefs.current && el) {
|
|
26
9
|
childrenScrollRefs.current[index] = el;
|
|
27
10
|
onScrollRefInitialized();
|
|
28
11
|
}
|
|
29
|
-
}, children: _jsxs("div", { className: styles.noteItemContent, children: [_jsx(
|
|
12
|
+
}, children: _jsxs("div", { className: styles.noteItemContent, children: [_jsx("img", { src: image.src, alt: image.alt, className: styles.noteItemIllustration }), _jsx(Typography.SansTitleL, { children: title }), _jsx(Markdown, { value: description, className: styles.noteItemMarkdownViewer })] }) }) }));
|
|
30
13
|
}
|
|
@@ -10,50 +10,11 @@
|
|
|
10
10
|
padding-right:var(--dimension-2m, 16px);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.noteItemIllustrationSlot{
|
|
14
|
-
position:relative;
|
|
15
|
-
width:100%;
|
|
16
|
-
max-width:380px;
|
|
17
|
-
align-self:center;
|
|
18
|
-
aspect-ratio:1/1;
|
|
19
|
-
border-radius:var(--dimension-1m, 8px);
|
|
20
|
-
overflow:hidden;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
13
|
.noteItemIllustration{
|
|
24
14
|
width:100%;
|
|
25
|
-
height:auto;
|
|
26
15
|
pointer-events:none;
|
|
27
16
|
max-width:380px;
|
|
28
17
|
align-self:center;
|
|
29
|
-
display:block;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.noteItemIllustrationSlot .noteItemIllustration{
|
|
33
|
-
width:100%;
|
|
34
|
-
height:100%;
|
|
35
|
-
max-width:none;
|
|
36
|
-
-o-object-fit:cover;
|
|
37
|
-
object-fit:cover;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.noteItemVideo{
|
|
41
|
-
width:100%;
|
|
42
|
-
height:100%;
|
|
43
|
-
-o-object-fit:cover;
|
|
44
|
-
object-fit:cover;
|
|
45
|
-
pointer-events:none;
|
|
46
|
-
display:block;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.noteItemMediaSkeletonOverlay{
|
|
50
|
-
position:absolute;
|
|
51
|
-
inset:0;
|
|
52
|
-
display:flex;
|
|
53
|
-
align-items:stretch;
|
|
54
|
-
justify-content:stretch;
|
|
55
|
-
border-radius:inherit;
|
|
56
|
-
pointer-events:none;
|
|
57
18
|
}
|
|
58
19
|
|
|
59
20
|
.noteItemSkeletonWrapper{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/uikit-product-modal-predefined",
|
|
3
3
|
"title": "Modal Predefined",
|
|
4
|
-
"version": "2.1.3
|
|
4
|
+
"version": "2.1.3",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
7
7
|
"*.woff",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@cloud-ru/uikit-product-locale": "*"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "77ed2ce1843bb25f87d981ac273158c60faa7e35"
|
|
61
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
4
4
|
import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
@@ -61,18 +61,18 @@ export function DeleteModal({
|
|
|
61
61
|
|
|
62
62
|
const handleClose = () => {
|
|
63
63
|
onClose();
|
|
64
|
-
reset();
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
const handleCancel = () => {
|
|
68
67
|
onClose();
|
|
69
|
-
reset();
|
|
70
68
|
};
|
|
71
69
|
|
|
72
70
|
const handleDelete = handleSubmit(() => {
|
|
73
71
|
onDelete(handleClose);
|
|
74
72
|
});
|
|
75
73
|
|
|
74
|
+
useEffect(() => reset, [reset, open]);
|
|
75
|
+
|
|
76
76
|
return (
|
|
77
77
|
<ModalCustom {...restProps} open={open} onClose={handleClose}>
|
|
78
78
|
<ModalCustom.Header
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
4
4
|
import { MobileModalCustom, MobileModalCustomProps } from '@cloud-ru/uikit-product-mobile-modal';
|
|
@@ -60,18 +60,18 @@ export function MobileDeleteModal({
|
|
|
60
60
|
|
|
61
61
|
const handleClose = () => {
|
|
62
62
|
onClose();
|
|
63
|
-
reset();
|
|
64
63
|
};
|
|
65
64
|
|
|
66
65
|
const handleCancel = () => {
|
|
67
66
|
onClose();
|
|
68
|
-
reset();
|
|
69
67
|
};
|
|
70
68
|
|
|
71
69
|
const handleDelete = handleSubmit(() => {
|
|
72
70
|
onDelete(handleClose);
|
|
73
71
|
});
|
|
74
72
|
|
|
73
|
+
useEffect(() => reset, [reset, open]);
|
|
74
|
+
|
|
75
75
|
return (
|
|
76
76
|
<MobileModalCustom {...restProps} open={open} onClose={handleClose}>
|
|
77
77
|
<MobileModalCustom.Header
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
1
|
import { Markdown } from '@cloud-ru/uikit-product-markdown';
|
|
4
2
|
import { Scroll } from '@snack-uikit/scroll';
|
|
5
|
-
import { Skeleton } from '@snack-uikit/skeleton';
|
|
6
3
|
import { Typography } from '@snack-uikit/typography';
|
|
7
4
|
|
|
8
5
|
import styles from './styles.module.scss';
|
|
@@ -14,55 +11,9 @@ export type NoteItemProps = {
|
|
|
14
11
|
description: string;
|
|
15
12
|
/** Иллюстрация (изображение) */
|
|
16
13
|
image: { src: string; alt: string };
|
|
17
|
-
/** URL видео (при наличии показывается вместо статичного изображения) */
|
|
18
|
-
video?: string;
|
|
19
14
|
};
|
|
20
15
|
|
|
21
|
-
function
|
|
22
|
-
const [videoReady, setVideoReady] = useState(false);
|
|
23
|
-
const [videoError, setVideoError] = useState(false);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (!video) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
setVideoReady(false);
|
|
30
|
-
setVideoError(false);
|
|
31
|
-
}, [video]);
|
|
32
|
-
|
|
33
|
-
if (!video) {
|
|
34
|
-
return <img src={image.src} alt={image.alt} className={styles.noteItemIllustration} />;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className={styles.noteItemIllustrationSlot}>
|
|
39
|
-
{videoError ? (
|
|
40
|
-
<img src={image.src} alt={image.alt} className={styles.noteItemIllustration} />
|
|
41
|
-
) : (
|
|
42
|
-
<>
|
|
43
|
-
<video
|
|
44
|
-
src={video}
|
|
45
|
-
className={styles.noteItemVideo}
|
|
46
|
-
muted
|
|
47
|
-
loop
|
|
48
|
-
playsInline
|
|
49
|
-
autoPlay
|
|
50
|
-
onLoadedData={() => setVideoReady(true)}
|
|
51
|
-
onError={() => setVideoError(true)}
|
|
52
|
-
aria-hidden
|
|
53
|
-
/>
|
|
54
|
-
{!videoReady && (
|
|
55
|
-
<div className={styles.noteItemMediaSkeletonOverlay}>
|
|
56
|
-
<Skeleton width={380} height={380} borderRadius={8} />
|
|
57
|
-
</div>
|
|
58
|
-
)}
|
|
59
|
-
</>
|
|
60
|
-
)}
|
|
61
|
-
</div>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function NoteItem({ title, description, image, video }: NoteItemProps) {
|
|
16
|
+
export function NoteItem({ title, description, image }: NoteItemProps) {
|
|
66
17
|
return (
|
|
67
18
|
<div className={styles.noteItemWrapper}>
|
|
68
19
|
<Scroll size='s' barHideStrategy='never'>
|
|
@@ -71,7 +22,7 @@ export function NoteItem({ title, description, image, video }: NoteItemProps) {
|
|
|
71
22
|
<Markdown value={description} className={styles.noteItemMarkdownViewer} />
|
|
72
23
|
</div>
|
|
73
24
|
</Scroll>
|
|
74
|
-
<
|
|
25
|
+
<img src={image.src} alt={image.alt} className={styles.noteItemIllustration} />
|
|
75
26
|
</div>
|
|
76
27
|
);
|
|
77
28
|
}
|
|
@@ -14,46 +14,12 @@
|
|
|
14
14
|
gap: styles-theme-variables.$dimension-2m;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.noteItemIllustrationSlot {
|
|
18
|
-
position: relative;
|
|
19
|
-
flex-shrink: 0;
|
|
20
|
-
width: 380px;
|
|
21
|
-
height: 380px;
|
|
22
|
-
border-radius: styles-theme-variables.$dimension-1m;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
17
|
.noteItemIllustration {
|
|
27
18
|
border-radius: styles-theme-variables.$dimension-1m;
|
|
28
19
|
width: 380px;
|
|
29
20
|
height: 380px;
|
|
30
21
|
object-fit: cover;
|
|
31
22
|
pointer-events: none;
|
|
32
|
-
display: block;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.noteItemIllustrationSlot .noteItemIllustration,
|
|
36
|
-
.noteItemVideo {
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 100%;
|
|
39
|
-
border-radius: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.noteItemVideo {
|
|
43
|
-
object-fit: cover;
|
|
44
|
-
pointer-events: none;
|
|
45
|
-
display: block;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.noteItemMediaSkeletonOverlay {
|
|
49
|
-
position: absolute;
|
|
50
|
-
inset: 0;
|
|
51
|
-
|
|
52
|
-
display: flex;
|
|
53
|
-
align-items: center;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
border-radius: inherit;
|
|
56
|
-
pointer-events: none;
|
|
57
23
|
}
|
|
58
24
|
|
|
59
25
|
.noteItemMarkdownViewer {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { RefObject
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Markdown } from '@cloud-ru/uikit-product-markdown';
|
|
4
4
|
import { Scroll } from '@snack-uikit/scroll';
|
|
5
|
-
import { Skeleton } from '@snack-uikit/skeleton';
|
|
6
5
|
import { Typography } from '@snack-uikit/typography';
|
|
7
6
|
|
|
8
7
|
import { NoteItemProps } from '../NoteItem';
|
|
@@ -14,55 +13,10 @@ type NoteItemMobileProps = NoteItemProps & {
|
|
|
14
13
|
onScrollRefInitialized(): void;
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
function NoteItemMobileMedia({ image, video }: Pick<NoteItemProps, 'image' | 'video'>) {
|
|
18
|
-
const [videoReady, setVideoReady] = useState(false);
|
|
19
|
-
const [videoError, setVideoError] = useState(false);
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (!video) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
setVideoReady(false);
|
|
26
|
-
setVideoError(false);
|
|
27
|
-
}, [video]);
|
|
28
|
-
|
|
29
|
-
if (!video) {
|
|
30
|
-
return <img src={image.src} alt={image.alt} className={styles.noteItemIllustration} />;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<div className={styles.noteItemIllustrationSlot}>
|
|
35
|
-
{videoError ? (
|
|
36
|
-
<img src={image.src} alt={image.alt} className={styles.noteItemIllustration} />
|
|
37
|
-
) : (
|
|
38
|
-
<>
|
|
39
|
-
<video
|
|
40
|
-
src={video}
|
|
41
|
-
className={styles.noteItemVideo}
|
|
42
|
-
muted
|
|
43
|
-
loop
|
|
44
|
-
playsInline
|
|
45
|
-
autoPlay
|
|
46
|
-
onLoadedData={() => setVideoReady(true)}
|
|
47
|
-
onError={() => setVideoError(true)}
|
|
48
|
-
aria-hidden
|
|
49
|
-
/>
|
|
50
|
-
{!videoReady && (
|
|
51
|
-
<div className={styles.noteItemMediaSkeletonOverlay}>
|
|
52
|
-
<Skeleton width='100%' height='100%' borderRadius={8} />
|
|
53
|
-
</div>
|
|
54
|
-
)}
|
|
55
|
-
</>
|
|
56
|
-
)}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
16
|
export function NoteItemMobile({
|
|
62
17
|
title,
|
|
63
18
|
description,
|
|
64
19
|
image,
|
|
65
|
-
video,
|
|
66
20
|
childrenScrollRefs,
|
|
67
21
|
index,
|
|
68
22
|
onScrollRefInitialized,
|
|
@@ -80,7 +34,7 @@ export function NoteItemMobile({
|
|
|
80
34
|
}}
|
|
81
35
|
>
|
|
82
36
|
<div className={styles.noteItemContent}>
|
|
83
|
-
<
|
|
37
|
+
<img src={image.src} alt={image.alt} className={styles.noteItemIllustration} />
|
|
84
38
|
<Typography.SansTitleL>{title}</Typography.SansTitleL>
|
|
85
39
|
<Markdown value={description} className={styles.noteItemMarkdownViewer} />
|
|
86
40
|
</div>
|
|
@@ -13,49 +13,11 @@
|
|
|
13
13
|
padding-right: styles-tokens-drawer.$dimension-2m;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.noteItemIllustrationSlot {
|
|
17
|
-
position: relative;
|
|
18
|
-
width: 100%;
|
|
19
|
-
max-width: 380px;
|
|
20
|
-
align-self: center;
|
|
21
|
-
aspect-ratio: 1 / 1;
|
|
22
|
-
border-radius: styles-theme-variables.$dimension-1m;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
16
|
.noteItemIllustration {
|
|
27
17
|
width: 100%;
|
|
28
|
-
height: auto;
|
|
29
18
|
pointer-events: none;
|
|
30
19
|
max-width: 380px;
|
|
31
20
|
align-self: center;
|
|
32
|
-
display: block;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.noteItemIllustrationSlot .noteItemIllustration {
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 100%;
|
|
38
|
-
max-width: none;
|
|
39
|
-
object-fit: cover;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.noteItemVideo {
|
|
43
|
-
width: 100%;
|
|
44
|
-
height: 100%;
|
|
45
|
-
object-fit: cover;
|
|
46
|
-
pointer-events: none;
|
|
47
|
-
display: block;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.noteItemMediaSkeletonOverlay {
|
|
51
|
-
position: absolute;
|
|
52
|
-
inset: 0;
|
|
53
|
-
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: stretch;
|
|
56
|
-
justify-content: stretch;
|
|
57
|
-
border-radius: inherit;
|
|
58
|
-
pointer-events: none;
|
|
59
21
|
}
|
|
60
22
|
|
|
61
23
|
.noteItemSkeletonWrapper {
|