heroes-of-chess-components 0.6.23 → 0.6.25
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.
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
import PropTypes from "prop-types";
|
|
2
2
|
import HBox from "../HBox/HBox";
|
|
3
3
|
import HText from "../HText/HText";
|
|
4
|
+
import HModal from "../HModal/HModal";
|
|
4
5
|
import { HocIconTrafficLightComplete, HocIconTrafficLightGreen, HocIconTrafficLightRed, HocIconTrafficLightYellow } from "../../assets/Icons/ui/index";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
* HTrafficLight - Componente de semáforo de cuenta regresiva
|
|
8
|
+
* HTrafficLight - Componente de semáforo de cuenta regresiva con modal
|
|
8
9
|
*
|
|
9
10
|
* @param {Object} props
|
|
11
|
+
* @param {boolean} props.showModal - Si se debe mostrar el modal
|
|
10
12
|
* @param {number} props.timeRemaining - Tiempo restante (3=rojo, 2=amarillo, 1=verde, 0=completo)
|
|
11
13
|
* @param {string} props.title - Título a mostrar (opcional)
|
|
12
14
|
* @param {string} props.width - Ancho del contenedor (default: "320px")
|
|
13
15
|
* @param {number} props.imageSize - Tamaño de la imagen del semáforo (default: 220)
|
|
16
|
+
* @param {function} props.onClose - Función a ejecutar al cerrar el modal (opcional)
|
|
14
17
|
*/
|
|
15
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
19
|
function HTrafficLight(_ref) {
|
|
17
|
-
var _ref$
|
|
20
|
+
var _ref$showModal = _ref.showModal,
|
|
21
|
+
showModal = _ref$showModal === void 0 ? false : _ref$showModal,
|
|
22
|
+
_ref$timeRemaining = _ref.timeRemaining,
|
|
18
23
|
timeRemaining = _ref$timeRemaining === void 0 ? 3 : _ref$timeRemaining,
|
|
19
24
|
_ref$title = _ref.title,
|
|
20
25
|
title = _ref$title === void 0 ? "Preparati per il gioco!" : _ref$title,
|
|
21
26
|
_ref$width = _ref.width,
|
|
22
27
|
width = _ref$width === void 0 ? "320px" : _ref$width,
|
|
23
28
|
_ref$imageSize = _ref.imageSize,
|
|
24
|
-
imageSize = _ref$imageSize === void 0 ? 220 : _ref$imageSize
|
|
29
|
+
imageSize = _ref$imageSize === void 0 ? 220 : _ref$imageSize,
|
|
30
|
+
onClose = _ref.onClose;
|
|
25
31
|
var getTrafficLightIcon = function getTrafficLightIcon() {
|
|
26
32
|
switch (timeRemaining) {
|
|
27
33
|
case 3:
|
|
@@ -34,24 +40,30 @@ function HTrafficLight(_ref) {
|
|
|
34
40
|
return HocIconTrafficLightComplete;
|
|
35
41
|
}
|
|
36
42
|
};
|
|
37
|
-
return /*#__PURE__*/
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
children:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
children: title
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
return /*#__PURE__*/_jsx(HModal, {
|
|
44
|
+
showModal: showModal,
|
|
45
|
+
onClose: onClose,
|
|
46
|
+
children: /*#__PURE__*/_jsxs(HBox, {
|
|
47
|
+
direction: "column",
|
|
48
|
+
width: width,
|
|
49
|
+
children: [title && /*#__PURE__*/_jsx(HText, {
|
|
50
|
+
as: "h2",
|
|
51
|
+
color: "purpleMedium",
|
|
52
|
+
children: title
|
|
53
|
+
}), /*#__PURE__*/_jsx("img", {
|
|
54
|
+
src: getTrafficLightIcon(),
|
|
55
|
+
alt: "Traffic light - ".concat(timeRemaining),
|
|
56
|
+
width: imageSize
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
49
59
|
});
|
|
50
60
|
}
|
|
51
61
|
HTrafficLight.propTypes = {
|
|
62
|
+
showModal: PropTypes.bool,
|
|
52
63
|
timeRemaining: PropTypes.number,
|
|
53
64
|
title: PropTypes.string,
|
|
54
65
|
width: PropTypes.string,
|
|
55
|
-
imageSize: PropTypes.number
|
|
66
|
+
imageSize: PropTypes.number,
|
|
67
|
+
onClose: PropTypes.func
|
|
56
68
|
};
|
|
57
69
|
export default HTrafficLight;
|