@stokr/components-library 2.0.0-beta.7 → 2.0.0-beta.8
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.
|
@@ -96,13 +96,20 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
96
96
|
isLogin = _this$props.isLogin,
|
|
97
97
|
isSignUp = _this$props.isSignUp,
|
|
98
98
|
isResetPassword = _this$props.isResetPassword;
|
|
99
|
-
console.log('🚀 ~ file: HeaderHo.jsx:102 ~ this.props:', _this.props);
|
|
100
99
|
var user = _this.context.user;
|
|
101
100
|
var isModalOpen = _this.state.isModalOpen;
|
|
102
101
|
var login = isModalOpen.login,
|
|
103
102
|
signUp = isModalOpen.signUp,
|
|
104
103
|
resetPassword = isModalOpen.resetPassword;
|
|
105
104
|
|
|
105
|
+
//checks if any modal is open
|
|
106
|
+
//if true we won't open any modal from below
|
|
107
|
+
var isAnyModalOpen = Object.values(isModalOpen).some(function (value) {
|
|
108
|
+
return value === true;
|
|
109
|
+
});
|
|
110
|
+
if (isAnyModalOpen) return;
|
|
111
|
+
console.log('🚀 ~ file: HeaderHo.jsx:102 ~ this.props:', _this.props);
|
|
112
|
+
|
|
106
113
|
//dont open if modal is already open or user is logged in
|
|
107
114
|
if (isLogin && !user && !login) {
|
|
108
115
|
_this.setState(function (prevState) {
|
|
@@ -158,7 +165,7 @@ var HeaderHoClass = /*#__PURE__*/function (_Component) {
|
|
|
158
165
|
var isModalOpen = _this.state.isModalOpen;
|
|
159
166
|
|
|
160
167
|
//if you previously were on /signup or any other route and you want to swtich to login modal
|
|
161
|
-
//we need to change the url accordingly
|
|
168
|
+
//we need to change the url accordingly so if you refresh the page, the modal will open
|
|
162
169
|
if (nextModalId === 'login' || nextModalId === 'signUp') {
|
|
163
170
|
window.history.pushState('', '', nextModalId === 'login' ? '/login' : nextModalId === 'signUp' ? '/signup' : '/');
|
|
164
171
|
}
|