@elicecontents/content-ui 1.0.2-alpha.1 → 1.0.2-alpha.2
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.
|
@@ -154,23 +154,29 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
154
154
|
}
|
|
155
155
|
var isScrollActive = context.isScrollActive,
|
|
156
156
|
setIsScrollActive = context.setIsScrollActive;
|
|
157
|
+
var _React$useState3 = React__default.default.useState(false),
|
|
158
|
+
_React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
|
|
159
|
+
hasScroll = _React$useState4[0],
|
|
160
|
+
setHasScroll = _React$useState4[1];
|
|
157
161
|
React__default.default.useEffect(function () {
|
|
158
162
|
var handleScroll = function handleScroll() {
|
|
163
|
+
if (contentRef.current) {
|
|
164
|
+
var scrollTop = contentRef.current.scrollTop;
|
|
165
|
+
setIsScrollActive(scrollTop > 10);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
var checkScroll = function checkScroll() {
|
|
159
169
|
if (contentRef.current) {
|
|
160
170
|
var _contentRef$current = contentRef.current,
|
|
161
|
-
scrollTop = _contentRef$current.scrollTop,
|
|
162
171
|
scrollHeight = _contentRef$current.scrollHeight,
|
|
163
172
|
clientHeight = _contentRef$current.clientHeight;
|
|
164
|
-
|
|
165
|
-
if (scrollHeight <= clientHeight) {
|
|
166
|
-
setIsScrollActive(false);
|
|
167
|
-
}
|
|
173
|
+
setHasScroll(scrollHeight > clientHeight);
|
|
168
174
|
}
|
|
169
175
|
};
|
|
170
176
|
var element = contentRef.current;
|
|
171
177
|
if (element) {
|
|
172
178
|
element.addEventListener("scroll", handleScroll);
|
|
173
|
-
|
|
179
|
+
checkScroll();
|
|
174
180
|
}
|
|
175
181
|
return function () {
|
|
176
182
|
if (element) {
|
|
@@ -181,7 +187,7 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
181
187
|
return jsxRuntime.jsxs(_ContentContainer, {
|
|
182
188
|
ref: contentRef,
|
|
183
189
|
theme: theme,
|
|
184
|
-
children: [children, isScrollActive && jsxRuntime.jsx(ScrollMoreButton, {
|
|
190
|
+
children: [children, hasScroll && !isScrollActive && jsxRuntime.jsx(ScrollMoreButton, {
|
|
185
191
|
children: jsxRuntime.jsx(ScrollMoreIcon.default, {
|
|
186
192
|
size: 32,
|
|
187
193
|
color: "white",
|
|
@@ -217,10 +223,7 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
217
223
|
return jsxRuntime.jsx(_Content, {
|
|
218
224
|
alignment: alignment,
|
|
219
225
|
justifyContent: justifyContent,
|
|
220
|
-
children:
|
|
221
|
-
variant: "body1",
|
|
222
|
-
children: children
|
|
223
|
-
})
|
|
226
|
+
children: children
|
|
224
227
|
});
|
|
225
228
|
},
|
|
226
229
|
FooterContainer: function FooterContainer(_ref19) {
|
|
@@ -2,7 +2,7 @@ import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBab
|
|
|
2
2
|
import _styled from '@emotion/styled/base';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { Stack, Button,
|
|
5
|
+
import { Stack, Button, useTheme } from '@mui/material';
|
|
6
6
|
import useAIDTMediaQuery from '../../hooks/useAIDTMediaQuery.js';
|
|
7
7
|
import ScrollMoreIcon from '../../icons/ScrollMoreIcon.js';
|
|
8
8
|
import LayoutPagination from './layout-pagination/LayoutPagination.js';
|
|
@@ -145,23 +145,29 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
145
145
|
}
|
|
146
146
|
var isScrollActive = context.isScrollActive,
|
|
147
147
|
setIsScrollActive = context.setIsScrollActive;
|
|
148
|
+
var _React$useState3 = React.useState(false),
|
|
149
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
150
|
+
hasScroll = _React$useState4[0],
|
|
151
|
+
setHasScroll = _React$useState4[1];
|
|
148
152
|
React.useEffect(function () {
|
|
149
153
|
var handleScroll = function handleScroll() {
|
|
154
|
+
if (contentRef.current) {
|
|
155
|
+
var scrollTop = contentRef.current.scrollTop;
|
|
156
|
+
setIsScrollActive(scrollTop > 10);
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
var checkScroll = function checkScroll() {
|
|
150
160
|
if (contentRef.current) {
|
|
151
161
|
var _contentRef$current = contentRef.current,
|
|
152
|
-
scrollTop = _contentRef$current.scrollTop,
|
|
153
162
|
scrollHeight = _contentRef$current.scrollHeight,
|
|
154
163
|
clientHeight = _contentRef$current.clientHeight;
|
|
155
|
-
|
|
156
|
-
if (scrollHeight <= clientHeight) {
|
|
157
|
-
setIsScrollActive(false);
|
|
158
|
-
}
|
|
164
|
+
setHasScroll(scrollHeight > clientHeight);
|
|
159
165
|
}
|
|
160
166
|
};
|
|
161
167
|
var element = contentRef.current;
|
|
162
168
|
if (element) {
|
|
163
169
|
element.addEventListener("scroll", handleScroll);
|
|
164
|
-
|
|
170
|
+
checkScroll();
|
|
165
171
|
}
|
|
166
172
|
return function () {
|
|
167
173
|
if (element) {
|
|
@@ -172,7 +178,7 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
172
178
|
return jsxs(_ContentContainer, {
|
|
173
179
|
ref: contentRef,
|
|
174
180
|
theme: theme,
|
|
175
|
-
children: [children, isScrollActive && jsx(ScrollMoreButton, {
|
|
181
|
+
children: [children, hasScroll && !isScrollActive && jsx(ScrollMoreButton, {
|
|
176
182
|
children: jsx(ScrollMoreIcon, {
|
|
177
183
|
size: 32,
|
|
178
184
|
color: "white",
|
|
@@ -208,10 +214,7 @@ var EliceLayout = Object.assign(function (_ref14) {
|
|
|
208
214
|
return jsx(_Content, {
|
|
209
215
|
alignment: alignment,
|
|
210
216
|
justifyContent: justifyContent,
|
|
211
|
-
children:
|
|
212
|
-
variant: "body1",
|
|
213
|
-
children: children
|
|
214
|
-
})
|
|
217
|
+
children: children
|
|
215
218
|
});
|
|
216
219
|
},
|
|
217
220
|
FooterContainer: function FooterContainer(_ref19) {
|
package/package.json
CHANGED