@mjhls/mjh-framework 1.0.735 → 1.0.736
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/README.md +1 -1
- package/dist/cjs/View.js +75 -3
- package/dist/esm/View.js +75 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# mjh-framework v. 1.0.
|
|
1
|
+
# mjh-framework v. 1.0.736
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/mjh-framework) [](https://standardjs.com)
|
|
4
4
|
|
package/dist/cjs/View.js
CHANGED
|
@@ -206,7 +206,13 @@ var ISI = function ISI(props) {
|
|
|
206
206
|
active = _useState2[0],
|
|
207
207
|
setActive = _useState2[1];
|
|
208
208
|
|
|
209
|
+
var _useState3 = React.useState(false),
|
|
210
|
+
_useState4 = slicedToArray._slicedToArray(_useState3, 2),
|
|
211
|
+
bottomOfArticle = _useState4[0],
|
|
212
|
+
setbottomOfArticle = _useState4[1];
|
|
213
|
+
|
|
209
214
|
var isi = React.useRef();
|
|
215
|
+
|
|
210
216
|
React.useEffect(function () {
|
|
211
217
|
if (active) {
|
|
212
218
|
var offset = '5rem';
|
|
@@ -221,6 +227,72 @@ var ISI = function ISI(props) {
|
|
|
221
227
|
isi.current.style.overflowY = '';
|
|
222
228
|
}
|
|
223
229
|
}, [active]);
|
|
230
|
+
React.useEffect(function () {
|
|
231
|
+
var detectBottomOfArticle = function detectBottomOfArticle() {
|
|
232
|
+
var article_body = document.getElementById('article__block');
|
|
233
|
+
var isi = document.getElementById('isi');
|
|
234
|
+
var articleBottomPosition = article_body.getBoundingClientRect().bottom - window.innerHeight;
|
|
235
|
+
console.log(articleBottomPosition, bottomOfArticle);
|
|
236
|
+
if (articleBottomPosition < 30 && !isi.classList.contains('in-view')) {
|
|
237
|
+
setbottomOfArticle(true);
|
|
238
|
+
}
|
|
239
|
+
if (articleBottomPosition > 60 && isi.classList.contains('in-view')) {
|
|
240
|
+
setbottomOfArticle(false);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
window.addEventListener('scroll', detectBottomOfArticle);
|
|
244
|
+
return function () {
|
|
245
|
+
return window.removeEventListener('scroll', detectBottomOfArticle);
|
|
246
|
+
};
|
|
247
|
+
}, []);
|
|
248
|
+
|
|
249
|
+
React.useEffect(function () {
|
|
250
|
+
var isi = document.getElementById('isi');
|
|
251
|
+
if (bottomOfArticle) {
|
|
252
|
+
toggleSticky(true);
|
|
253
|
+
isi.classList.add('in-view');
|
|
254
|
+
if (active) {
|
|
255
|
+
setActive(false);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (!bottomOfArticle) {
|
|
259
|
+
toggleSticky(false);
|
|
260
|
+
isi.classList.remove('in-view');
|
|
261
|
+
}
|
|
262
|
+
}, [bottomOfArticle]);
|
|
263
|
+
|
|
264
|
+
var toggleSticky = function toggleSticky(sticky) {
|
|
265
|
+
var isiToggle = document.getElementById('isiToggle');
|
|
266
|
+
var isiContent = document.getElementById('isiContent');
|
|
267
|
+
var isi = document.getElementById('isi');
|
|
268
|
+
if (sticky) {
|
|
269
|
+
isi.style.bottom = '-200px';
|
|
270
|
+
setTimeout(function () {
|
|
271
|
+
isi.style.maxHeight = 'unset';
|
|
272
|
+
isi.style.position = 'relative';
|
|
273
|
+
isi.style.boxShadow = 'none';
|
|
274
|
+
isi.style.zIndex = '1';
|
|
275
|
+
isi.style.marginTop = '-25rem';
|
|
276
|
+
isi.style.marginBottom = '15rem';
|
|
277
|
+
isiToggle.style.display = 'none';
|
|
278
|
+
isiContent.style.padding = '0';
|
|
279
|
+
}, 300);
|
|
280
|
+
} else if (!sticky) {
|
|
281
|
+
|
|
282
|
+
isi.style.marginBottom = '0';
|
|
283
|
+
isi.style.maxHeight = '12rem';
|
|
284
|
+
isi.style.position = 'fixed';
|
|
285
|
+
isi.style.boxShadow = '0 0 1rem 0 rgba(0, 0, 0, 0.5)';
|
|
286
|
+
isi.style.zIndex = '99999';
|
|
287
|
+
|
|
288
|
+
isiToggle.style.display = 'block';
|
|
289
|
+
isiContent.style.padding = '1rem';
|
|
290
|
+
setTimeout(function () {
|
|
291
|
+
isi.style.bottom = '0';
|
|
292
|
+
isi.style.marginTop = '0';
|
|
293
|
+
}, 300);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
224
296
|
return React__default['default'].createElement(
|
|
225
297
|
React__default['default'].Fragment,
|
|
226
298
|
null,
|
|
@@ -255,7 +327,7 @@ var ISI = function ISI(props) {
|
|
|
255
327
|
React__default['default'].createElement(
|
|
256
328
|
'style',
|
|
257
329
|
{ jsx: true },
|
|
258
|
-
'\n #isi {\n position: fixed;\n z-index:
|
|
330
|
+
'\n #isi {\n position: fixed;\n z-index: 9999999;\n bottom: 0;\n left: 0;\n max-height: 12rem;\n background-color: #ffffff;\n overflow-x: hidden;\n overflow-y: hidden;\n width: 100%;\n box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.5);\n transition: bottom .5s ease , margin-top .3s, max-height .2s;\n }\n #isiContent {\n width: 100%;\n max-width: 1000px;\n margin-left: auto;\n margin-right: auto;\n position: relative;\n padding: 1rem;\n font-size: 1rem;\n }\n #isi::-webkit-scrollbar {\n display: none;\n }\n #isiToggle {\n position: absolute;\n top: 0;\n right: 0;\n padding: 1rem;\n font-weight: bold;\n cursor: pointer;\n font-size: 1rem;\n }\n #isiToggle p {\n margin: 0;\n }\n '
|
|
259
331
|
)
|
|
260
332
|
);
|
|
261
333
|
};
|
|
@@ -822,7 +894,7 @@ var Article = function Article(props) {
|
|
|
822
894
|
} },
|
|
823
895
|
React__default['default'].createElement(
|
|
824
896
|
'div',
|
|
825
|
-
|
|
897
|
+
{ id: 'article__block' },
|
|
826
898
|
React__default['default'].createElement(
|
|
827
899
|
'div',
|
|
828
900
|
{ className: 'video-detail', style: { marginBottom: isCutomPage(props.article) || showIsi && Array.isArray(isi) && isi.length > 0 ? '15rem' : 0 } },
|
|
@@ -1041,7 +1113,7 @@ var Article = function Article(props) {
|
|
|
1041
1113
|
)
|
|
1042
1114
|
)
|
|
1043
1115
|
),
|
|
1044
|
-
React__default['default'].createElement('hr', { className: 'article-seperater mb-5 mt-3' })
|
|
1116
|
+
props.infiniteScroll && React__default['default'].createElement('hr', { className: 'article-seperater mb-5 mt-3' })
|
|
1045
1117
|
);
|
|
1046
1118
|
};
|
|
1047
1119
|
|
package/dist/esm/View.js
CHANGED
|
@@ -196,7 +196,13 @@ var ISI = function ISI(props) {
|
|
|
196
196
|
active = _useState2[0],
|
|
197
197
|
setActive = _useState2[1];
|
|
198
198
|
|
|
199
|
+
var _useState3 = useState(false),
|
|
200
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
201
|
+
bottomOfArticle = _useState4[0],
|
|
202
|
+
setbottomOfArticle = _useState4[1];
|
|
203
|
+
|
|
199
204
|
var isi = useRef();
|
|
205
|
+
|
|
200
206
|
useEffect(function () {
|
|
201
207
|
if (active) {
|
|
202
208
|
var offset = '5rem';
|
|
@@ -211,6 +217,72 @@ var ISI = function ISI(props) {
|
|
|
211
217
|
isi.current.style.overflowY = '';
|
|
212
218
|
}
|
|
213
219
|
}, [active]);
|
|
220
|
+
useEffect(function () {
|
|
221
|
+
var detectBottomOfArticle = function detectBottomOfArticle() {
|
|
222
|
+
var article_body = document.getElementById('article__block');
|
|
223
|
+
var isi = document.getElementById('isi');
|
|
224
|
+
var articleBottomPosition = article_body.getBoundingClientRect().bottom - window.innerHeight;
|
|
225
|
+
console.log(articleBottomPosition, bottomOfArticle);
|
|
226
|
+
if (articleBottomPosition < 30 && !isi.classList.contains('in-view')) {
|
|
227
|
+
setbottomOfArticle(true);
|
|
228
|
+
}
|
|
229
|
+
if (articleBottomPosition > 60 && isi.classList.contains('in-view')) {
|
|
230
|
+
setbottomOfArticle(false);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
window.addEventListener('scroll', detectBottomOfArticle);
|
|
234
|
+
return function () {
|
|
235
|
+
return window.removeEventListener('scroll', detectBottomOfArticle);
|
|
236
|
+
};
|
|
237
|
+
}, []);
|
|
238
|
+
|
|
239
|
+
useEffect(function () {
|
|
240
|
+
var isi = document.getElementById('isi');
|
|
241
|
+
if (bottomOfArticle) {
|
|
242
|
+
toggleSticky(true);
|
|
243
|
+
isi.classList.add('in-view');
|
|
244
|
+
if (active) {
|
|
245
|
+
setActive(false);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (!bottomOfArticle) {
|
|
249
|
+
toggleSticky(false);
|
|
250
|
+
isi.classList.remove('in-view');
|
|
251
|
+
}
|
|
252
|
+
}, [bottomOfArticle]);
|
|
253
|
+
|
|
254
|
+
var toggleSticky = function toggleSticky(sticky) {
|
|
255
|
+
var isiToggle = document.getElementById('isiToggle');
|
|
256
|
+
var isiContent = document.getElementById('isiContent');
|
|
257
|
+
var isi = document.getElementById('isi');
|
|
258
|
+
if (sticky) {
|
|
259
|
+
isi.style.bottom = '-200px';
|
|
260
|
+
setTimeout(function () {
|
|
261
|
+
isi.style.maxHeight = 'unset';
|
|
262
|
+
isi.style.position = 'relative';
|
|
263
|
+
isi.style.boxShadow = 'none';
|
|
264
|
+
isi.style.zIndex = '1';
|
|
265
|
+
isi.style.marginTop = '-25rem';
|
|
266
|
+
isi.style.marginBottom = '15rem';
|
|
267
|
+
isiToggle.style.display = 'none';
|
|
268
|
+
isiContent.style.padding = '0';
|
|
269
|
+
}, 300);
|
|
270
|
+
} else if (!sticky) {
|
|
271
|
+
|
|
272
|
+
isi.style.marginBottom = '0';
|
|
273
|
+
isi.style.maxHeight = '12rem';
|
|
274
|
+
isi.style.position = 'fixed';
|
|
275
|
+
isi.style.boxShadow = '0 0 1rem 0 rgba(0, 0, 0, 0.5)';
|
|
276
|
+
isi.style.zIndex = '99999';
|
|
277
|
+
|
|
278
|
+
isiToggle.style.display = 'block';
|
|
279
|
+
isiContent.style.padding = '1rem';
|
|
280
|
+
setTimeout(function () {
|
|
281
|
+
isi.style.bottom = '0';
|
|
282
|
+
isi.style.marginTop = '0';
|
|
283
|
+
}, 300);
|
|
284
|
+
}
|
|
285
|
+
};
|
|
214
286
|
return React.createElement(
|
|
215
287
|
React.Fragment,
|
|
216
288
|
null,
|
|
@@ -245,7 +317,7 @@ var ISI = function ISI(props) {
|
|
|
245
317
|
React.createElement(
|
|
246
318
|
'style',
|
|
247
319
|
{ jsx: true },
|
|
248
|
-
'\n #isi {\n position: fixed;\n z-index:
|
|
320
|
+
'\n #isi {\n position: fixed;\n z-index: 9999999;\n bottom: 0;\n left: 0;\n max-height: 12rem;\n background-color: #ffffff;\n overflow-x: hidden;\n overflow-y: hidden;\n width: 100%;\n box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.5);\n transition: bottom .5s ease , margin-top .3s, max-height .2s;\n }\n #isiContent {\n width: 100%;\n max-width: 1000px;\n margin-left: auto;\n margin-right: auto;\n position: relative;\n padding: 1rem;\n font-size: 1rem;\n }\n #isi::-webkit-scrollbar {\n display: none;\n }\n #isiToggle {\n position: absolute;\n top: 0;\n right: 0;\n padding: 1rem;\n font-weight: bold;\n cursor: pointer;\n font-size: 1rem;\n }\n #isiToggle p {\n margin: 0;\n }\n '
|
|
249
321
|
)
|
|
250
322
|
);
|
|
251
323
|
};
|
|
@@ -812,7 +884,7 @@ var Article = function Article(props) {
|
|
|
812
884
|
} },
|
|
813
885
|
React.createElement(
|
|
814
886
|
'div',
|
|
815
|
-
|
|
887
|
+
{ id: 'article__block' },
|
|
816
888
|
React.createElement(
|
|
817
889
|
'div',
|
|
818
890
|
{ className: 'video-detail', style: { marginBottom: isCutomPage(props.article) || showIsi && Array.isArray(isi) && isi.length > 0 ? '15rem' : 0 } },
|
|
@@ -1031,7 +1103,7 @@ var Article = function Article(props) {
|
|
|
1031
1103
|
)
|
|
1032
1104
|
)
|
|
1033
1105
|
),
|
|
1034
|
-
React.createElement('hr', { className: 'article-seperater mb-5 mt-3' })
|
|
1106
|
+
props.infiniteScroll && React.createElement('hr', { className: 'article-seperater mb-5 mt-3' })
|
|
1035
1107
|
);
|
|
1036
1108
|
};
|
|
1037
1109
|
|