"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _novaIcons = require("@coorpacademy/nova-icons");
var _colors = require("../../variables/colors");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const createStyle = (icon, current) => {
  let backgroundColor;
  switch (icon) {
    case 'right':
      backgroundColor = _colors.COLORS.cm_positive_500;
      break;
    case 'wrong':
      backgroundColor = _colors.COLORS.negative;
      break;
    case 'no-answer':
    default:
      backgroundColor = _colors.COLORS.cm_grey_100;
  }
  return _reactNative.StyleSheet.create({
    step: {
      width: current ? 40 : 32,
      height: current ? 40 : 32,
      opacity: current ? 1 : 0.5,
      marginHorizontal: 8,
      backgroundColor,
      alignItems: 'center',
      justifyContent: 'center',
      borderRadius: 50
    },
    stepText: {
      fontWeight: '600',
      fontSize: current ? 16 : 12
    },
    icon: {
      width: current ? 14 : 12,
      height: current ? 14 : 12
    }
  });
};
const Step = ({
  value,
  icon,
  current
}) => {
  const [style, setStyle] = (0, _react.useState)(null);
  (0, _react.useEffect)(() => {
    const _style = createStyle(icon, current);
    setStyle(_style);
  }, [current, icon]);
  if (!style) {
    return null;
  }
  let child;
  switch (icon) {
    case 'right':
      child = /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyCheck, {
        style: style.icon,
        color: "#fff"
      });
      break;
    case 'wrong':
      child = /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidStatusClose, {
        style: style.icon,
        color: "#fff"
      });
      break;
    case 'no-answer':
    default:
      child = /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
        style: style.stepText
      }, value);
  }
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: style.step
  }, child);
};
var _default = exports.default = Step;
//# sourceMappingURL=index.native.js.map