react-gldn-kit 0.1.31 → 0.1.33
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/dist/index.js +1 -1
- package/dist/lib/components/Scratch/index.js +8 -7
- package/dist/lib/components/Scratch/types.d.ts +1 -1
- package/dist/lib/components/Scratch/types.js +1 -4
- package/dist/lib/components/ui/Inputs/CheckBox/index.js +4 -2
- package/dist/main.css +5 -10
- package/package.json +1 -1
|
@@ -55,11 +55,12 @@ var types_1 = require("./types");
|
|
|
55
55
|
var styles = __importStar(require("./Scratch.module.css"));
|
|
56
56
|
// TODO: rewrite this code
|
|
57
57
|
var Scratch = function (props) {
|
|
58
|
-
var backgroundPath = props.backgroundPath, backgroundScratchDone = props.backgroundScratchDone, scratchPath = props.scratchPath, slotNamePath = props.slotNamePath, audioFirstPath = props.audioFirstPath, audioSecondPath = props.audioSecondPath, textOne = props.textOne, textTwo = props.textTwo, callback = props.callback;
|
|
59
|
-
var
|
|
60
|
-
var
|
|
58
|
+
var backgroundPath = props.backgroundPath, backgroundScratchDone = props.backgroundScratchDone, scratchPath = props.scratchPath, slotNamePath = props.slotNamePath, audioFirstPath = props.audioFirstPath, audioSecondPath = props.audioSecondPath, textOne = props.textOne, textTwo = props.textTwo, callback = props.callback, _a = props.boxesAmount, boxesAmount = _a === void 0 ? 9 : _a;
|
|
59
|
+
var _b = (0, react_1.useState)([]), scratchedBoxes = _b[0], setScratchedBoxes = _b[1];
|
|
60
|
+
var _c = (0, react_1.useState)({}), scratchedBoxesOpacity = _c[0], setScratchedBoxesOpacity = _c[1];
|
|
61
61
|
var audio1 = new Audio(audioFirstPath);
|
|
62
62
|
var audio2 = new Audio(audioSecondPath);
|
|
63
|
+
var BOXES = new Array(boxesAmount).fill(0).map(function (_, idx) { return idx; });
|
|
63
64
|
var handleScratch = function (idx) { return function () {
|
|
64
65
|
var _a, _b;
|
|
65
66
|
if (scratchedBoxes.includes(idx)) {
|
|
@@ -97,12 +98,12 @@ var Scratch = function (props) {
|
|
|
97
98
|
}
|
|
98
99
|
};
|
|
99
100
|
}, [scratchedBoxes]);
|
|
100
|
-
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: styles.scratch, style: {
|
|
101
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)(styles.scratch, 'KIT_Scratch_scratch'), style: {
|
|
101
102
|
background: backgroundPath,
|
|
102
103
|
backgroundSize: '100% 100%',
|
|
103
104
|
backgroundPosition: 'center',
|
|
104
105
|
backgroundRepeat: 'no-repeat',
|
|
105
|
-
} }, { children: [
|
|
106
|
+
} }, { children: [BOXES.map(function (value) {
|
|
106
107
|
var _a;
|
|
107
108
|
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)(styles.box, (_a = {},
|
|
108
109
|
_a[styles.scratched] = scratchedBoxes.includes(value),
|
|
@@ -113,7 +114,7 @@ var Scratch = function (props) {
|
|
|
113
114
|
backgroundRepeat: 'no-repeat',
|
|
114
115
|
}, onClick: handleScratch(value) }, { children: [(0, jsx_runtime_1.jsx)("img", { className: styles.image, src: scratchedBoxes.includes(value) ? scratchPath[0] : scratchPath[1], style: {
|
|
115
116
|
opacity: scratchedBoxesOpacity[value],
|
|
116
|
-
}, alt: "" }), scratchedBoxes.includes(value) && ((0, jsx_runtime_1.jsx)("div", __assign({ className: styles.scratchText }, { children: scratchedBoxes[0] === value ? ((0, jsx_runtime_1.jsx)(Text_1.Text, { idT: textOne })) : ((0, jsx_runtime_1.jsx)(Text_1.Text, { idT: textTwo })) })))] }), value));
|
|
117
|
-
}), (0, jsx_runtime_1.jsx)("img", { src: slotNamePath, className: styles.slotName })] })));
|
|
117
|
+
}, alt: "" }), scratchedBoxes.includes(value) && ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, classnames_1.default)(styles.scratchText, 'KIT_Scratch_box_scratchText') }, { children: scratchedBoxes[0] === value ? ((0, jsx_runtime_1.jsx)(Text_1.Text, { idT: textOne })) : ((0, jsx_runtime_1.jsx)(Text_1.Text, { idT: textTwo })) })))] }), value));
|
|
118
|
+
}), (0, jsx_runtime_1.jsx)("img", { src: slotNamePath, className: (0, classnames_1.default)(styles.slotName, 'KIT_Scratch_slotName') })] })));
|
|
118
119
|
};
|
|
119
120
|
exports.Scratch = Scratch;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TIMER = exports.OPEN_BOX_COUNT =
|
|
4
|
-
var BOXES_AMOUNT = 9; // TODO remove it
|
|
5
|
-
// Need to pass content with flexible data
|
|
6
|
-
exports.BOXES = new Array(BOXES_AMOUNT).fill(0).map(function (_, idx) { return idx; });
|
|
3
|
+
exports.TIMER = exports.OPEN_BOX_COUNT = void 0;
|
|
7
4
|
exports.OPEN_BOX_COUNT = 2; // TODO: we can open only two boxes
|
|
8
5
|
exports.TIMER = 1000; // REMOVE IT _ BAD CODE FLOW
|
|
@@ -44,9 +44,11 @@ var Text_1 = require("components/Text");
|
|
|
44
44
|
var styles = __importStar(require("./CheckBox.module.css"));
|
|
45
45
|
var CheckBox = function (props) {
|
|
46
46
|
var value = props.value, onChange = props.onChange, text = props.text, classes = props.classes, handleText = props.handleText, classesText = props.classesText;
|
|
47
|
-
var handleToggle = function () {
|
|
47
|
+
var handleToggle = function (e) {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
e.preventDefault();
|
|
48
50
|
onChange(!value);
|
|
49
51
|
};
|
|
50
|
-
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)(styles.checkboxWrapper, classes) }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: styles.checkboxWrapperBig
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1.default)(styles.checkboxWrapper, classes) }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: styles.checkboxWrapperBig }, { children: (0, jsx_runtime_1.jsxs)("label", __assign({ className: styles.switch }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "checkbox", checked: value, onChange: handleToggle }), (0, jsx_runtime_1.jsx)("div", { className: styles.slider })] })) })), text && ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, classnames_1.default)(styles.checkboxText, classesText), onClick: handleText }, { children: (0, jsx_runtime_1.jsx)(Text_1.Text, { idT: text }) })))] })));
|
|
51
53
|
};
|
|
52
54
|
exports.CheckBox = CheckBox;
|
package/dist/main.css
CHANGED
|
@@ -3393,16 +3393,13 @@
|
|
|
3393
3393
|
.KIT__Scratch-module__scratch___n0TBg {
|
|
3394
3394
|
width: 100%;
|
|
3395
3395
|
height: 100%;
|
|
3396
|
-
position: absolute;
|
|
3397
|
-
left: 0;
|
|
3398
|
-
top: 0;
|
|
3399
3396
|
|
|
3400
|
-
display:
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3397
|
+
display: grid;
|
|
3398
|
+
grid-template-columns: repeat(3, 1fr);
|
|
3399
|
+
grid-gap: var(--indent-m);
|
|
3400
|
+
gap: var(--indent-m);
|
|
3404
3401
|
padding: var(--indent-l);
|
|
3405
|
-
|
|
3402
|
+
position: relative;
|
|
3406
3403
|
}
|
|
3407
3404
|
|
|
3408
3405
|
.KIT__Scratch-module__scratchText___jISwD {
|
|
@@ -3424,8 +3421,6 @@
|
|
|
3424
3421
|
}
|
|
3425
3422
|
|
|
3426
3423
|
.KIT__Scratch-module__box___NjFhi {
|
|
3427
|
-
width: 32%;
|
|
3428
|
-
height: 32%;
|
|
3429
3424
|
position: relative;
|
|
3430
3425
|
cursor: pointer;
|
|
3431
3426
|
}
|