@sima-land/moleculas 11.0.1 → 12.2.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/desktop/components/product-card/index.d.ts +27 -0
- package/desktop/components/product-card/index.js +73 -0
- package/desktop/components/product-card/product-card.module.scss +53 -0
- package/desktop/components/product-carousel/hover-card.d.ts +3 -13
- package/desktop/components/product-carousel/hover-card.js +6 -32
- package/desktop/components/product-carousel/hover-card.module.scss +0 -34
- package/desktop/components/product-carousel/index.js +2 -2
- package/desktop/components/promotion-card/index.d.ts +4 -1
- package/desktop/components/promotion-card/index.js +2 -0
- package/desktop/components/promotion-card/index.module.scss +2 -1
- package/desktop/components/promotion-card/placeholder.d.ts +7 -0
- package/desktop/components/promotion-card/placeholder.js +19 -0
- package/desktop/components/promotion-card/placeholder.module.scss +18 -0
- package/desktop/components/promotion-card/variables.scss +2 -0
- package/mobile/components/{product-card → product-row}/index.d.ts +5 -6
- package/mobile/components/{product-card → product-row}/index.js +7 -7
- package/mobile/components/{product-card/product-card.module.scss → product-row/product-row.module.scss} +0 -0
- package/package.json +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ProductInfoProps } from '../../../common/components/product-info';
|
|
3
|
+
export interface ProductCardProps extends ProductInfoProps, React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
onMouseLeave?: () => void;
|
|
5
|
+
onQuickViewClick?: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Компонент-слот для вывода контрола товара в корзине.
|
|
9
|
+
* @param props Свойства.
|
|
10
|
+
* @return Элемент.
|
|
11
|
+
*/
|
|
12
|
+
declare const CartControlSlot: ({ children, stepText, markupText, loading, }: {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
stepText?: string | undefined;
|
|
15
|
+
markupText?: string | undefined;
|
|
16
|
+
loading?: boolean | undefined;
|
|
17
|
+
}) => JSX.Element;
|
|
18
|
+
export interface ProductCardComponent extends React.ForwardRefExoticComponent<React.PropsWithoutRef<ProductCardProps> & React.RefAttributes<HTMLDivElement>> {
|
|
19
|
+
CartControl: typeof CartControlSlot;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Карточка товара, появляющаяся над элементом карусели.
|
|
23
|
+
* @param props Свойства компонента.
|
|
24
|
+
* @return Элемент.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ProductCard: ProductCardComponent;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
+
t[p] = s[p];
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
+
t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
};
|
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ProductCard = void 0;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const product_info_1 = require("../../../common/components/product-info");
|
|
39
|
+
const with_hint_1 = require("@sima-land/ui-nucleons/with-hint");
|
|
40
|
+
const quick_view_button_1 = require("../../../common/components/quick-view-button");
|
|
41
|
+
const shapes_1 = require("@sima-land/ui-nucleons/styling/shapes");
|
|
42
|
+
const shadows_1 = require("@sima-land/ui-nucleons/styling/shadows");
|
|
43
|
+
const define_slots_1 = require("@sima-land/ui-nucleons/helpers/define-slots");
|
|
44
|
+
const with_prevent_1 = __importDefault(require("@sima-land/ui-nucleons/helpers/with-prevent"));
|
|
45
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
46
|
+
const product_card_module_scss_1 = __importDefault(require("./product-card.module.scss"));
|
|
47
|
+
const cx = bind_1.default.bind(product_card_module_scss_1.default);
|
|
48
|
+
/**
|
|
49
|
+
* Компонент-слот для вывода контрола товара в корзине.
|
|
50
|
+
* @param props Свойства.
|
|
51
|
+
* @return Элемент.
|
|
52
|
+
*/
|
|
53
|
+
const CartControlSlot = ({ children, stepText, markupText, loading, }) => (react_1.default.createElement("div", { className: cx('control-wrapper', { loading }) },
|
|
54
|
+
react_1.default.createElement("div", { className: cx('control') }, !loading && children),
|
|
55
|
+
(loading || stepText) && (react_1.default.createElement("div", { className: cx('unit-text') }, !loading && stepText)),
|
|
56
|
+
!loading && markupText && (react_1.default.createElement("div", { className: cx('bottom-text') }, markupText))));
|
|
57
|
+
/**
|
|
58
|
+
* Карточка товара, появляющаяся над элементом карусели.
|
|
59
|
+
* @param props Свойства компонента.
|
|
60
|
+
* @return Элемент.
|
|
61
|
+
*/
|
|
62
|
+
exports.ProductCard = react_1.forwardRef((_a, rootRef) => {
|
|
63
|
+
var { data, onLinkClick, onQuickViewClick, children,
|
|
64
|
+
// div props
|
|
65
|
+
className } = _a, rootProps = __rest(_a, ["data", "onLinkClick", "onQuickViewClick", "children", "className"]);
|
|
66
|
+
const { cartControl } = define_slots_1.defineSlots(children, { cartControl: CartControlSlot });
|
|
67
|
+
return (react_1.default.createElement("div", Object.assign({ ref: rootRef, className: cx('root', shapes_1.SmallRounds.all, shadows_1.BoxShadow.z4, className) }, rootProps),
|
|
68
|
+
react_1.default.createElement(product_info_1.ProductInfo, { data: data, onLinkClick: onLinkClick },
|
|
69
|
+
react_1.default.createElement(product_info_1.ProductInfo.OnImage, null,
|
|
70
|
+
react_1.default.createElement(with_hint_1.WithHint, { hint: '\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440', direction: 'left' }, (ref, toggle) => (react_1.default.createElement(quick_view_button_1.QuickViewButton, { ref: ref, onMouseEnter: () => toggle(true), onMouseLeave: () => toggle(false), className: cx('quick-view-button'), onClick: with_prevent_1.default(onQuickViewClick) }))))),
|
|
71
|
+
cartControl));
|
|
72
|
+
});
|
|
73
|
+
exports.ProductCard.CartControl = CartControlSlot;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
padding: 16px 16px 24px;
|
|
5
|
+
background: #fff;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.quick-view-button {
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 8px;
|
|
11
|
+
right: 8px;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.control-wrapper {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
margin-top: 16px;
|
|
19
|
+
&.loading {
|
|
20
|
+
.control {
|
|
21
|
+
background: colors.$gray4;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
}
|
|
24
|
+
.unit-text::before {
|
|
25
|
+
content: '';
|
|
26
|
+
display: block;
|
|
27
|
+
background: colors.$gray4;
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
width: 48px;
|
|
30
|
+
height: 16px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.control {
|
|
36
|
+
width: 122px;
|
|
37
|
+
height: 40px;
|
|
38
|
+
margin-right: 16px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.unit-text {
|
|
42
|
+
padding-top: 12px; // чтобы при переносе на следующую строку правильно отступил от кнопки
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
line-height: 16px;
|
|
45
|
+
color: colors.$gray38;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.bottom-text {
|
|
49
|
+
margin-top: 12px;
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
line-height: 16px;
|
|
52
|
+
color: colors.$gray38;
|
|
53
|
+
}
|
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProductInfoProps } from '../../../common/components/product-info';
|
|
3
|
+
import { ProductCard } from '../product-card';
|
|
3
4
|
export interface HoverCardProps extends ProductInfoProps {
|
|
4
5
|
targetRef: React.RefObject<HTMLElement | null>;
|
|
5
6
|
onMouseLeave?: () => void;
|
|
6
7
|
onQuickViewClick?: () => void;
|
|
7
|
-
renderCartControl?: (Slot: typeof
|
|
8
|
+
renderCartControl?: (Slot: typeof ProductCard.CartControl) => React.ReactNode;
|
|
8
9
|
}
|
|
9
|
-
/**
|
|
10
|
-
* Компонент-слот для вывода контрола товара в корзине.
|
|
11
|
-
* @param props Свойства.
|
|
12
|
-
* @return Элемент.
|
|
13
|
-
*/
|
|
14
|
-
declare const CartControlSlot: ({ children, stepText, markupText, }: {
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
stepText?: string | undefined;
|
|
17
|
-
markupText?: string | undefined;
|
|
18
|
-
}) => JSX.Element;
|
|
19
10
|
/**
|
|
20
11
|
* Карточка товара, появляющаяся над элементом карусели.
|
|
21
12
|
* @param props Свойства компонента.
|
|
22
13
|
* @return Элемент.
|
|
23
14
|
*/
|
|
24
|
-
export declare const HoverCard: ({ data, targetRef, onMouseLeave, onQuickViewClick, renderCartControl,
|
|
25
|
-
export {};
|
|
15
|
+
export declare const HoverCard: ({ data, targetRef, onMouseLeave, onQuickViewClick, onLinkClick, renderCartControl, }: HoverCardProps) => JSX.Element;
|
|
@@ -18,17 +18,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
-
var t = {};
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
-
t[p] = s[p];
|
|
25
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
-
t[p[i]] = s[p[i]];
|
|
29
|
-
}
|
|
30
|
-
return t;
|
|
31
|
-
};
|
|
32
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
23
|
};
|
|
@@ -36,31 +25,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
25
|
exports.HoverCard = void 0;
|
|
37
26
|
const react_1 = __importStar(require("react"));
|
|
38
27
|
const utils_1 = require("@sima-land/ui-nucleons/with-tooltip/utils");
|
|
39
|
-
const product_info_1 = require("../../../common/components/product-info");
|
|
40
28
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
41
29
|
const hover_card_module_scss_1 = __importDefault(require("./hover-card.module.scss"));
|
|
42
|
-
const with_hint_1 = require("@sima-land/ui-nucleons/with-hint");
|
|
43
|
-
const quick_view_button_1 = require("../../../common/components/quick-view-button");
|
|
44
|
-
const with_prevent_1 = __importDefault(require("@sima-land/ui-nucleons/helpers/with-prevent"));
|
|
45
30
|
const shapes_1 = require("@sima-land/ui-nucleons/styling/shapes");
|
|
46
31
|
const shadows_1 = require("@sima-land/ui-nucleons/styling/shadows");
|
|
32
|
+
const product_card_1 = require("../product-card");
|
|
47
33
|
const cx = bind_1.default.bind(hover_card_module_scss_1.default);
|
|
48
|
-
/**
|
|
49
|
-
* Компонент-слот для вывода контрола товара в корзине.
|
|
50
|
-
* @param props Свойства.
|
|
51
|
-
* @return Элемент.
|
|
52
|
-
*/
|
|
53
|
-
const CartControlSlot = ({ children, stepText, markupText, }) => (react_1.default.createElement("div", { className: cx('control-wrapper') },
|
|
54
|
-
react_1.default.createElement("div", { className: cx('control') }, children),
|
|
55
|
-
stepText && (react_1.default.createElement("div", { className: cx('unit-text') }, stepText)),
|
|
56
|
-
markupText && (react_1.default.createElement("div", { className: cx('bottom-text') }, markupText))));
|
|
57
34
|
/**
|
|
58
35
|
* Карточка товара, появляющаяся над элементом карусели.
|
|
59
36
|
* @param props Свойства компонента.
|
|
60
37
|
* @return Элемент.
|
|
61
38
|
*/
|
|
62
|
-
const HoverCard = (
|
|
63
|
-
var { data, targetRef, onMouseLeave, onQuickViewClick, renderCartControl } = _a, restProps = __rest(_a, ["data", "targetRef", "onMouseLeave", "onQuickViewClick", "renderCartControl"]);
|
|
39
|
+
const HoverCard = ({ data, targetRef, onMouseLeave, onQuickViewClick, onLinkClick, renderCartControl, }) => {
|
|
64
40
|
const rootRef = react_1.useRef(null);
|
|
65
41
|
const [ready, setReady] = react_1.useState(false);
|
|
66
42
|
react_1.useLayoutEffect(() => {
|
|
@@ -74,13 +50,11 @@ const HoverCard = (_a) => {
|
|
|
74
50
|
setReady(true);
|
|
75
51
|
}
|
|
76
52
|
}, [data]);
|
|
77
|
-
return (react_1.default.createElement(
|
|
53
|
+
return (react_1.default.createElement(product_card_1.ProductCard, { data: data, onLinkClick: onLinkClick, onQuickViewClick: onQuickViewClick,
|
|
54
|
+
// div props
|
|
55
|
+
ref: rootRef, "data-testid": 'product-carousel:hover-card', className: cx('root', !ready && 'hidden', shapes_1.SmallRounds.all, shadows_1.BoxShadow.z4), onMouseLeave: () => {
|
|
78
56
|
setReady(false);
|
|
79
57
|
onMouseLeave && onMouseLeave();
|
|
80
|
-
} },
|
|
81
|
-
react_1.default.createElement(product_info_1.ProductInfo, Object.assign({}, restProps, { data: data }),
|
|
82
|
-
react_1.default.createElement(product_info_1.ProductInfo.OnImage, null,
|
|
83
|
-
react_1.default.createElement(with_hint_1.WithHint, { hint: '\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440', direction: 'left' }, (ref, toggle) => (react_1.default.createElement(quick_view_button_1.QuickViewButton, { ref: ref, onMouseEnter: () => toggle(true), onMouseLeave: () => toggle(false), className: cx('quick-view-button'), onClick: with_prevent_1.default(onQuickViewClick) }))))), renderCartControl === null || renderCartControl === void 0 ? void 0 :
|
|
84
|
-
renderCartControl(CartControlSlot)));
|
|
58
|
+
} }, renderCartControl === null || renderCartControl === void 0 ? void 0 : renderCartControl(product_card_1.ProductCard.CartControl)));
|
|
85
59
|
};
|
|
86
60
|
exports.HoverCard = HoverCard;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
2
|
|
|
3
3
|
.root {
|
|
4
|
-
padding: 16px 16px 24px;
|
|
5
|
-
background: #fff;
|
|
6
4
|
position: absolute;
|
|
7
5
|
top: -1000px;
|
|
8
6
|
left: -1000px;
|
|
@@ -14,35 +12,3 @@
|
|
|
14
12
|
pointer-events: none;
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
.quick-view-button {
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 8px;
|
|
21
|
-
right: 8px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.control-wrapper {
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-wrap: wrap;
|
|
27
|
-
margin-top: 16px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.control {
|
|
31
|
-
width: 122px;
|
|
32
|
-
height: 40px;
|
|
33
|
-
margin-right: 16px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.unit-text {
|
|
37
|
-
padding-top: 12px; // чтобы при переносе на следующую строку правильно отступил от кнопки
|
|
38
|
-
font-size: 12px;
|
|
39
|
-
line-height: 16px;
|
|
40
|
-
color: colors.$gray38;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.bottom-text {
|
|
44
|
-
margin-top: 12px;
|
|
45
|
-
font-size: 12px;
|
|
46
|
-
line-height: 16px;
|
|
47
|
-
color: colors.$gray38;
|
|
48
|
-
}
|
|
@@ -92,9 +92,9 @@ const ProductCarousel = ({ className, itemSize, onInViewport, onNeedRequest, wit
|
|
|
92
92
|
// длительность прокрутки в Carousel - 320, делаем слегка с запасом
|
|
93
93
|
// @todo после восстановления проверить позицию курсора чтобы показать карточку (если будет критично)
|
|
94
94
|
onChangeTargetIndex: () => cardShow.disallowFor(360) })),
|
|
95
|
-
withHoverCard && activeItemIndex !== null && (react_1.default.createElement(hover_card_1.HoverCard, { targetRef: targetItemRef, onMouseLeave: () => setActiveItemIndex(null),
|
|
95
|
+
withHoverCard && activeItemIndex !== null && [items[activeItemIndex]].map(item => (react_1.default.createElement(hover_card_1.HoverCard, { key: activeItemIndex, targetRef: targetItemRef, onMouseLeave: () => setActiveItemIndex(null),
|
|
96
96
|
// данные элемента карусели
|
|
97
|
-
data:
|
|
97
|
+
data: item.data, onLinkClick: item.onLinkClick, onQuickViewClick: item.onQuickViewClick, renderCartControl: item.renderCartControl }))))) : (react_1.default.createElement("div", { ref: stubRef }));
|
|
98
98
|
};
|
|
99
99
|
exports.ProductCarousel = ProductCarousel;
|
|
100
100
|
exports.ProductCarousel.Item = Item;
|
|
@@ -15,4 +15,7 @@ export interface PromotionCardProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
15
15
|
* @param props Свойства.
|
|
16
16
|
* @return Элемент.
|
|
17
17
|
*/
|
|
18
|
-
export declare const PromotionCard:
|
|
18
|
+
export declare const PromotionCard: {
|
|
19
|
+
({ promotionType, href, imageSrc, title, subtitle, dueDate, volumeDiscount, postfix, className, ...restProps }: PromotionCardProps): JSX.Element;
|
|
20
|
+
Placeholder: (props: React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
21
|
+
};
|
|
@@ -40,6 +40,7 @@ const estimate_1 = require("./estimate");
|
|
|
40
40
|
const watch_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/watch"));
|
|
41
41
|
const classnames_1 = __importDefault(require("classnames"));
|
|
42
42
|
const index_module_scss_1 = __importDefault(require("./index.module.scss"));
|
|
43
|
+
const placeholder_1 = require("./placeholder");
|
|
43
44
|
const PromotionName = {
|
|
44
45
|
gift: 'Подарок',
|
|
45
46
|
special: 'Спецпредложение',
|
|
@@ -77,3 +78,4 @@ const PromotionCard = (_a) => {
|
|
|
77
78
|
postfix && (react_1.default.createElement("div", { className: index_module_scss_1.default.postfix }, postfix)))))));
|
|
78
79
|
};
|
|
79
80
|
exports.PromotionCard = PromotionCard;
|
|
81
|
+
exports.PromotionCard.Placeholder = placeholder_1.PromotionCardPlaceholder;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
2
|
@use 'node_modules/@sima-land/ui-nucleons/breakpoints';
|
|
3
|
+
@use './variables';
|
|
3
4
|
@import 'node_modules/@sima-land/ui-nucleons/styling/shadows.module';
|
|
4
5
|
|
|
5
6
|
.root {
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
.banner {
|
|
25
26
|
position: relative;
|
|
26
27
|
width: 100%;
|
|
27
|
-
padding-top:
|
|
28
|
+
padding-top: variables.$banner-height;
|
|
28
29
|
background: colors.$gray8;
|
|
29
30
|
border-radius: 8px 8px 0 0;
|
|
30
31
|
overflow: hidden;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PromotionCardPlaceholder = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const placeholder_module_scss_1 = __importDefault(require("./placeholder.module.scss"));
|
|
9
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
/**
|
|
11
|
+
* Компонент отображения состояния загрузки карточки акции.
|
|
12
|
+
* @param props Свойства div.
|
|
13
|
+
* @return Элемент.
|
|
14
|
+
*/
|
|
15
|
+
const PromotionCardPlaceholder = (props) => (react_1.default.createElement("div", Object.assign({}, props),
|
|
16
|
+
react_1.default.createElement("div", { className: classnames_1.default(placeholder_module_scss_1.default.part, placeholder_module_scss_1.default.banner) }),
|
|
17
|
+
react_1.default.createElement("div", { className: classnames_1.default(placeholder_module_scss_1.default.part, placeholder_module_scss_1.default.text) }),
|
|
18
|
+
react_1.default.createElement("div", { className: classnames_1.default(placeholder_module_scss_1.default.part, placeholder_module_scss_1.default.text) })));
|
|
19
|
+
exports.PromotionCardPlaceholder = PromotionCardPlaceholder;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
|
+
@use './variables';
|
|
3
|
+
|
|
4
|
+
.part {
|
|
5
|
+
background: colors.$gray4;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
& + & {
|
|
8
|
+
margin-top: 12px;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.banner {
|
|
13
|
+
padding-top: variables.$banner-height;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.text {
|
|
17
|
+
height: 48px;
|
|
18
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ProductRowProps {
|
|
3
3
|
sid: number;
|
|
4
4
|
itemUrl: string;
|
|
5
5
|
imageUrl: string;
|
|
@@ -16,9 +16,9 @@ export declare type Props = {
|
|
|
16
16
|
initialCount?: number;
|
|
17
17
|
movedOrderId?: number;
|
|
18
18
|
notInStock?: boolean;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
/**
|
|
21
|
-
* Компонент карточки
|
|
21
|
+
* Компонент вертикальной карточки товара для списков товаров.
|
|
22
22
|
* @param props Свойства компонента.
|
|
23
23
|
* @param props.itemUrl Ссылка на страницу товара.
|
|
24
24
|
* @param props.imageUrl Ссылка на картинку товара.
|
|
@@ -38,5 +38,4 @@ export declare type Props = {
|
|
|
38
38
|
* @param props.isFetchingWishItems Признак загрузки добавления товара в список избранного.
|
|
39
39
|
* @return Компонент карточки товара.
|
|
40
40
|
*/
|
|
41
|
-
declare const
|
|
42
|
-
export default ProductCard;
|
|
41
|
+
export declare const ProductRow: ({ itemUrl, imageUrl, name, sid, isWished, count, unit, initialCount, movedOrderId, notInStock, currencyGrapheme, commonPrice, itemPrice, onWishButtonClick, onActionsClick, isFetchingWishItems, }: ProductRowProps) => JSX.Element;
|
|
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProductRow = void 0;
|
|
6
7
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const
|
|
8
|
+
const product_row_module_scss_1 = __importDefault(require("./product-row.module.scss"));
|
|
8
9
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
9
10
|
const more_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Filled/more"));
|
|
10
11
|
const link_1 = require("@sima-land/ui-nucleons/link");
|
|
@@ -12,10 +13,9 @@ const price_1 = require("@sima-land/ui-nucleons/price");
|
|
|
12
13
|
const box_1 = require("@sima-land/ui-nucleons/box");
|
|
13
14
|
const text_1 = require("@sima-land/ui-nucleons/text");
|
|
14
15
|
const wish_button_1 = require("../../../common/components/wish-button");
|
|
15
|
-
const
|
|
16
|
-
const cx = bind_1.default.bind(product_card_module_scss_1.default);
|
|
16
|
+
const cx = bind_1.default.bind(product_row_module_scss_1.default);
|
|
17
17
|
/**
|
|
18
|
-
* Компонент карточки
|
|
18
|
+
* Компонент вертикальной карточки товара для списков товаров.
|
|
19
19
|
* @param props Свойства компонента.
|
|
20
20
|
* @param props.itemUrl Ссылка на страницу товара.
|
|
21
21
|
* @param props.imageUrl Ссылка на картинку товара.
|
|
@@ -35,11 +35,11 @@ const cx = bind_1.default.bind(product_card_module_scss_1.default);
|
|
|
35
35
|
* @param props.isFetchingWishItems Признак загрузки добавления товара в список избранного.
|
|
36
36
|
* @return Компонент карточки товара.
|
|
37
37
|
*/
|
|
38
|
-
const
|
|
38
|
+
const ProductRow = ({ itemUrl, imageUrl, name, sid, isWished, count, unit, initialCount, movedOrderId, notInStock, currencyGrapheme, commonPrice, itemPrice, onWishButtonClick, onActionsClick, isFetchingWishItems, }) => (react_1.default.createElement("div", { className: cx('wrapper') },
|
|
39
39
|
react_1.default.createElement("div", { className: cx('image-wrapper') },
|
|
40
40
|
react_1.default.createElement(link_1.Link, { href: itemUrl },
|
|
41
41
|
react_1.default.createElement("img", { src: imageUrl, className: cx('image') })),
|
|
42
|
-
|
|
42
|
+
onWishButtonClick && (react_1.default.createElement(wish_button_1.WishButton, { onClick: onWishButtonClick, className: cx('wish-button', { 'is-wished': isWished }), width: 20, height: 20, checked: isWished, disabled: isFetchingWishItems }))),
|
|
43
43
|
react_1.default.createElement("div", { className: cx('info-column') },
|
|
44
44
|
react_1.default.createElement(link_1.Link, { href: itemUrl, className: cx('link'), color: 'gray87' },
|
|
45
45
|
react_1.default.createElement(text_1.Text, { weight: 600 }, name)),
|
|
@@ -72,4 +72,4 @@ const ProductCard = ({ itemUrl, imageUrl, name, sid, isWished, count, unit, init
|
|
|
72
72
|
react_1.default.createElement(text_1.Text, { element: 'div', color: 'gray38' }, "\u041D\u0435\u0442 \u043D\u0430 \u0441\u043A\u043B\u0430\u0434\u0435")))),
|
|
73
73
|
react_1.default.createElement("div", { className: cx('action-button') },
|
|
74
74
|
react_1.default.createElement(more_1.default, { onClick: onActionsClick }))));
|
|
75
|
-
exports.
|
|
75
|
+
exports.ProductRow = ProductRow;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sima-land/moleculas",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.2.1",
|
|
4
4
|
"repository": "ssh://git@github.com:sima-land/moleculas.git",
|
|
5
5
|
"author": "www.sima-land.ru team",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"storybook:build": "build-storybook --no-dll --quiet --loglevel error -o build-storybook"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@sima-land/ui-nucleons": "^
|
|
26
|
+
"@sima-land/ui-nucleons": "^40.0.0",
|
|
27
27
|
"@sima-land/ui-quarks": "^2.0.1",
|
|
28
28
|
"classnames": "^2.3.1",
|
|
29
29
|
"lodash": "^4.17.21",
|