@threekit-tools/treble 0.0.25 → 0.0.29
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.
|
@@ -44,9 +44,7 @@ var Swatch = function (props) {
|
|
|
44
44
|
description: !showDescription ? undefined : el.description,
|
|
45
45
|
}), imageUrl = _a.imageUrl, color = _a.color, name = _a.name, description = _a.description, price = _a.price, optionValue = _a.optionValue;
|
|
46
46
|
var selected = value === optionValue;
|
|
47
|
-
var clsOpt = "".concat(cls, "-option option-").concat(i, " ").concat(optionValue)
|
|
48
|
-
? ' selected'
|
|
49
|
-
: '';
|
|
47
|
+
var clsOpt = "".concat(cls, "-option option-").concat(i, " ").concat(optionValue).concat(selected ? ' selected' : '');
|
|
50
48
|
return (react_1.default.createElement(swatch_styles_1.OptionWrapper, { key: i, onClick: function () { return onClick && onClick(optionValue); }, selected: selected, className: clsOpt, shape: shape },
|
|
51
49
|
react_1.default.createElement("div", null,
|
|
52
50
|
react_1.default.createElement(Thumbnail, { imageUrl: imageUrl, color: color, shape: shape, className: clsOpt })),
|
|
@@ -47,8 +47,6 @@ function TrebleApp(props) {
|
|
|
47
47
|
react_1.Children.forEach(Object.values(productComponents).map(function (el) { return el({}); }), function (jsx, i) {
|
|
48
48
|
if (!jsx)
|
|
49
49
|
return;
|
|
50
|
-
if (jsx.type.name !== 'ProductLayout')
|
|
51
|
-
return;
|
|
52
50
|
if (!jsx.props.products)
|
|
53
51
|
return;
|
|
54
52
|
var products = jsx.props.products;
|
|
@@ -61,11 +59,12 @@ function TrebleApp(props) {
|
|
|
61
59
|
}
|
|
62
60
|
var params = (0, utils_1.getParams)();
|
|
63
61
|
var id = productId;
|
|
64
|
-
if (!id
|
|
65
|
-
|
|
62
|
+
if (!id) {
|
|
63
|
+
if (params[constants_1.TK_PRODUCT_ID_PARAM_KEY])
|
|
64
|
+
id = Object.keys(productToComponentMap).find(function (el) { return params[constants_1.TK_PRODUCT_ID_PARAM_KEY] === el; });
|
|
65
|
+
else
|
|
66
|
+
id = Object.keys(productToComponentMap)[0];
|
|
66
67
|
}
|
|
67
|
-
else
|
|
68
|
-
id = Object.keys(productToComponentMap)[0];
|
|
69
68
|
if (!id)
|
|
70
69
|
return null;
|
|
71
70
|
var Product = productComponents[productToComponentMap[id]];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threekit-tools/treble",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"author": "Amaan Saeed",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"storybook": "start-storybook -p 6006",
|
|
21
21
|
"build-storybook": "build-storybook -o build",
|
|
22
22
|
"lint": "eslint ./src",
|
|
23
|
+
"check-format": "prettier -c ./src",
|
|
23
24
|
"format": "prettier --write ./src"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|