@micromag/screen-urbania-horoscope 0.3.103 → 0.3.104

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/es/index.js CHANGED
@@ -4,7 +4,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
5
  import classNames from 'classnames';
6
6
  import PropTypes from 'prop-types';
7
- import React, { useCallback, useState, useEffect } from 'react';
7
+ import React, { useCallback, useState, useMemo, useEffect } from 'react';
8
8
  import { TransitionGroup, CSSTransition } from 'react-transition-group';
9
9
  import { PropTypes as PropTypes$1 } from '@micromag/core';
10
10
  import { ScreenElement, PlaceholderTitle, TransitionsStagger } from '@micromag/core/components';
@@ -619,7 +619,7 @@ var defaultProps = {
619
619
  };
620
620
 
621
621
  var Horoscope = function Horoscope(_ref) {
622
- var _ref2;
622
+ var _ref3;
623
623
 
624
624
  var defaultSigns = _ref.defaultSigns,
625
625
  signsValue = _ref.signs,
@@ -644,9 +644,14 @@ var Horoscope = function Horoscope(_ref) {
644
644
  hasPopup = _useState2[0],
645
645
  setHasPopup = _useState2[1];
646
646
 
647
- var signs = defaultSigns.map(function (sign, index) {
648
- return _objectSpread(_objectSpread({}, sign), signsValue !== null && signsValue[index] ? signsValue[index] || null : null);
649
- });
647
+ var signs = useMemo(function () {
648
+ return defaultSigns.map(function (defaultSign, index) {
649
+ return _objectSpread(_objectSpread({}, signsValue !== null ? signsValue.find(function (_ref2) {
650
+ var signValueId = _ref2.id;
651
+ return signValueId === defaultSign.id;
652
+ }) || signsValue[index] : null), defaultSign);
653
+ });
654
+ }, []);
650
655
 
651
656
  var _useState3 = useState(null),
652
657
  _useState4 = _slicedToArray(_useState3, 2),
@@ -792,7 +797,7 @@ var Horoscope = function Horoscope(_ref) {
792
797
  return el !== null;
793
798
  });
794
799
  return /*#__PURE__*/React.createElement("div", {
795
- className: classNames([styles.container, (_ref2 = {}, _defineProperty(_ref2, className, className !== null), _defineProperty(_ref2, styles.isPlaceholder, isPlaceholder), _ref2)]),
800
+ className: classNames([styles.container, (_ref3 = {}, _defineProperty(_ref3, className, className !== null), _defineProperty(_ref3, styles.isPlaceholder, isPlaceholder), _ref3)]),
796
801
  "data-screen-ready": true
797
802
  }, !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
798
803
  background: background,
package/lib/index.js CHANGED
@@ -653,7 +653,7 @@ var defaultProps = {
653
653
  };
654
654
 
655
655
  var Horoscope = function Horoscope(_ref) {
656
- var _ref2;
656
+ var _ref3;
657
657
 
658
658
  var defaultSigns = _ref.defaultSigns,
659
659
  signsValue = _ref.signs,
@@ -678,9 +678,14 @@ var Horoscope = function Horoscope(_ref) {
678
678
  hasPopup = _useState2[0],
679
679
  setHasPopup = _useState2[1];
680
680
 
681
- var signs = defaultSigns.map(function (sign, index) {
682
- return _objectSpread__default["default"](_objectSpread__default["default"]({}, sign), signsValue !== null && signsValue[index] ? signsValue[index] || null : null);
683
- });
681
+ var signs = React.useMemo(function () {
682
+ return defaultSigns.map(function (defaultSign, index) {
683
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, signsValue !== null ? signsValue.find(function (_ref2) {
684
+ var signValueId = _ref2.id;
685
+ return signValueId === defaultSign.id;
686
+ }) || signsValue[index] : null), defaultSign);
687
+ });
688
+ }, []);
684
689
 
685
690
  var _useState3 = React.useState(null),
686
691
  _useState4 = _slicedToArray__default["default"](_useState3, 2),
@@ -826,7 +831,7 @@ var Horoscope = function Horoscope(_ref) {
826
831
  return el !== null;
827
832
  });
828
833
  return /*#__PURE__*/React__default["default"].createElement("div", {
829
- className: classNames__default["default"]([styles.container, (_ref2 = {}, _defineProperty__default["default"](_ref2, className, className !== null), _defineProperty__default["default"](_ref2, styles.isPlaceholder, isPlaceholder), _ref2)]),
834
+ className: classNames__default["default"]([styles.container, (_ref3 = {}, _defineProperty__default["default"](_ref3, className, className !== null), _defineProperty__default["default"](_ref3, styles.isPlaceholder, isPlaceholder), _ref3)]),
830
835
  "data-screen-ready": true
831
836
  }, !isPlaceholder ? /*#__PURE__*/React__default["default"].createElement(Background__default["default"], {
832
837
  background: background,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-urbania-horoscope",
3
- "version": "0.3.103",
3
+ "version": "0.3.104",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "660b2ada7b03941feb841470abf5cd2cc6e3e68f"
75
+ "gitHead": "e9ac79a1679f44a86f15bc3f4f6a8f3e318f1aed"
76
76
  }