io-sanita-theme 2.4.0 → 2.4.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.4.2](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.1...2.4.2) (2025-03-04)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* scroll SideMenu with headersticky ([5a3e9d5](https://github.com/RedTurtle/io-sanita-theme/commit/5a3e9d531350933a2fe672ba6625bc30cb7cc5ba))
|
|
8
|
+
|
|
9
|
+
## [2.4.1](https://github.com/RedTurtle/io-sanita-theme/compare/2.4.0...2.4.1) (2025-03-04)
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* CardPersona admit no reference ([3f1de41](https://github.com/RedTurtle/io-sanita-theme/commit/3f1de41002da3b9399d19547b9734866b60a1496))
|
|
14
|
+
|
|
3
15
|
## [2.4.0](https://github.com/RedTurtle/io-sanita-theme/compare/2.3.4...2.4.0) (2025-03-03)
|
|
4
16
|
|
|
5
17
|
### Features
|
package/package.json
CHANGED
|
@@ -72,14 +72,18 @@ export const CardPersona = ({
|
|
|
72
72
|
<CardBody className="d-flex">
|
|
73
73
|
<div className="card-persona-content flex-grow-1 pe-2 pe-lg-5">
|
|
74
74
|
<CardTitle tag={titleTag} className="mb-0">
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
{item['@id'] ? (
|
|
76
|
+
<UniversalLink
|
|
77
|
+
item={!isEditMode ? item : null}
|
|
78
|
+
href={isEditMode ? '#' : ''}
|
|
79
|
+
className="card-title-link"
|
|
80
|
+
data-element={titleDataElement}
|
|
81
|
+
>
|
|
82
|
+
{item.title}
|
|
83
|
+
</UniversalLink>
|
|
84
|
+
) : (
|
|
85
|
+
item.title
|
|
86
|
+
)}
|
|
83
87
|
</CardTitle>
|
|
84
88
|
|
|
85
89
|
<CardText tag="div">
|
|
@@ -86,8 +86,17 @@ const SideMenu = ({ data, content_uid }) => {
|
|
|
86
86
|
(item) => item.id === activeSection,
|
|
87
87
|
)?.title;
|
|
88
88
|
|
|
89
|
+
const getMainOffset = () => {
|
|
90
|
+
return isClient
|
|
91
|
+
? document.querySelector('.it-header-wrapper.it-header-sticky')
|
|
92
|
+
?.clientHeight + 20
|
|
93
|
+
: 0;
|
|
94
|
+
};
|
|
95
|
+
const mainOffset = getMainOffset();
|
|
96
|
+
|
|
89
97
|
const handleScroll = useCallback(() => {
|
|
90
|
-
const
|
|
98
|
+
const windowHeight = window.innerHeight * 0.1;
|
|
99
|
+
const mainOffset = getMainOffset();
|
|
91
100
|
setScrollY(window.scrollY);
|
|
92
101
|
const headersHeights = headers
|
|
93
102
|
.map((section) => {
|
|
@@ -97,7 +106,8 @@ const SideMenu = ({ data, content_uid }) => {
|
|
|
97
106
|
top: element?.getBoundingClientRect()?.top,
|
|
98
107
|
};
|
|
99
108
|
})
|
|
100
|
-
.filter((section) => section.top <=
|
|
109
|
+
// .filter((section) => section.top - mainOffset + 40 <= windowHeight);
|
|
110
|
+
.filter((section) => section.top <= mainOffset + 20);
|
|
101
111
|
if (headersHeights.length > 0) {
|
|
102
112
|
const section = headersHeights.reduce(
|
|
103
113
|
(prev, curr) => (prev.top > curr.top ? prev : curr),
|
|
@@ -130,6 +140,9 @@ const SideMenu = ({ data, content_uid }) => {
|
|
|
130
140
|
}, [headers]);
|
|
131
141
|
|
|
132
142
|
const throttledHandleScroll = throttle(handleScroll, 100);
|
|
143
|
+
const yCountEnd = isClient
|
|
144
|
+
? document.querySelector('#main-content-section')
|
|
145
|
+
: null;
|
|
133
146
|
|
|
134
147
|
const handleClickAnchor = (id) => (e) => {
|
|
135
148
|
e.preventDefault();
|
|
@@ -143,17 +156,18 @@ const SideMenu = ({ data, content_uid }) => {
|
|
|
143
156
|
// Scroll to section
|
|
144
157
|
// setTimeout hack should wait for rerender after setIsNavOpen
|
|
145
158
|
setTimeout(() => {
|
|
146
|
-
document.getElementById(id)?.scrollIntoView?.({
|
|
159
|
+
// document.getElementById(id)?.scrollIntoView?.({
|
|
160
|
+
// behavior: 'smooth',
|
|
161
|
+
// block: 'start',
|
|
162
|
+
// });
|
|
163
|
+
|
|
164
|
+
window.scrollTo({
|
|
147
165
|
behavior: 'smooth',
|
|
148
|
-
|
|
166
|
+
top: document.querySelector('#' + id).offsetTop - mainOffset,
|
|
149
167
|
});
|
|
150
168
|
}, 0);
|
|
151
169
|
};
|
|
152
170
|
|
|
153
|
-
const yCountEnd = isClient
|
|
154
|
-
? document.querySelector('#main-content-section')
|
|
155
|
-
: null;
|
|
156
|
-
|
|
157
171
|
const progressValue = useMemo(() => {
|
|
158
172
|
if (!isClient) return 0;
|
|
159
173
|
return yCountEnd
|
|
@@ -162,7 +176,10 @@ const SideMenu = ({ data, content_uid }) => {
|
|
|
162
176
|
}, [scrollY, isClient]);
|
|
163
177
|
|
|
164
178
|
return headers?.length > 0 ? (
|
|
165
|
-
<div
|
|
179
|
+
<div
|
|
180
|
+
className="navbar-wrapper page-side-menu affix-top"
|
|
181
|
+
style={{ top: mainOffset - 20 }}
|
|
182
|
+
>
|
|
166
183
|
<nav
|
|
167
184
|
className="navbar it-navscroll-wrapper navbar-expand-lg"
|
|
168
185
|
aria-label={intl.formatMessage(messages.sideMenuNavigation)}
|