io-sanita-theme 2.20.4 → 2.20.5

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,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.20.5](https://github.com/RedTurtle/io-sanita-theme/compare/2.20.4...2.20.5) (2025-09-16)
4
+
5
+ ### Bug Fixes
6
+
7
+ * fixed sticky header and horizontal page scroll ([#107](https://github.com/RedTurtle/io-sanita-theme/issues/107)) ([0a2356a](https://github.com/RedTurtle/io-sanita-theme/commit/0a2356a2ab9fdcf9731e2460cb63ebdebc3f64d1))
8
+
9
+ ### Documentation
10
+
11
+ * updated release.md ([77a26ad](https://github.com/RedTurtle/io-sanita-theme/commit/77a26adb0ea93625a3839b53a9dd573bbe063bbc))
12
+
3
13
  ## [2.20.4](https://github.com/RedTurtle/io-sanita-theme/compare/2.20.3...2.20.4) (2025-09-12)
4
14
 
5
15
  ### Bug Fixes
package/RELEASE.md CHANGED
@@ -40,6 +40,14 @@
40
40
 
41
41
  - ...
42
42
  -->
43
+ ## Versione 2.20.5 (16/09/2025)
44
+
45
+ ### Fix
46
+
47
+ - Sistemato header sticky durante lo scroll della pagina ora è più fluido.
48
+ - Rimossa barra di scorrimento orizzontale che compariva saltuariamente nel sito durante la navigazione.
49
+
50
+
43
51
  ## Versione 2.16.4 (12/06/2025)
44
52
 
45
53
  ### Migliorie
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io-sanita-theme",
3
- "version": "2.20.4",
3
+ "version": "2.20.5",
4
4
  "description": "io-sanita-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -3,7 +3,7 @@
3
3
  * @module components/theme/Header/Header
4
4
  */
5
5
 
6
- import React, { useEffect, useState } from 'react';
6
+ import React, { useRef, useEffect, useState } from 'react';
7
7
  import { useLocation } from 'react-router-dom';
8
8
  import PropTypes from 'prop-types';
9
9
  import cx from 'classnames';
@@ -24,39 +24,57 @@ import { Headers } from 'design-react-kit';
24
24
 
25
25
  const Header = ({ pathname }) => {
26
26
  const location = useLocation();
27
+ const headerWrapperRef = useRef(null);
28
+ const [headerHeight, setHeaderHeight] = useState(0);
27
29
  const [mini, setMini] = useState(false);
28
- const isEditMode = useSelector(
29
- (state) =>
30
- Object.keys(state.form.global ?? {})?.length > 0 ||
31
- location.pathname.indexOf('/controlpanel') === 0,
30
+
31
+ const isEditMode = useSelector((state) =>
32
+ Object.keys(state.form.global ?? {})?.length > 0 ||
33
+ location.pathname.indexOf('/controlpanel') === 0
32
34
  );
33
35
 
34
- const handleScroll = () => {
35
- setMini(window.pageYOffset > 120);
36
- };
36
+ useEffect(() => {
37
+ const node = headerWrapperRef.current;
38
+ if (node) {
39
+ const height = node.offsetHeight;
40
+ if (height > 0) {
41
+ setHeaderHeight(height);
42
+ }
43
+ }
44
+ }, []);
37
45
 
46
+ // Scroll solo per mini
38
47
  useEffect(() => {
48
+ const handleScroll = () => {
49
+ setMini(window.pageYOffset > 120);
50
+ };
51
+
39
52
  window.addEventListener('scroll', handleScroll);
40
- return () => window.removeEventListener('scroll', handleScroll);
53
+ return () => {
54
+ window.removeEventListener('scroll', handleScroll);
55
+ };
41
56
  }, []);
42
57
 
43
58
  return (
44
59
  <div className="public-ui">
45
60
  {/* <Headers sticky={true} className={mini ? 'is-sticky' : undefined}> */}
46
- <Headers
47
- className={cx({
48
- 'is-sticky': mini && !isEditMode,
49
- 'it-header-sticky': !isEditMode,
50
- })}
51
- >
52
- <HeaderSlim />
61
+ <div ref={headerWrapperRef}>
62
+ <Headers
63
+ className={cx({
64
+ 'is-sticky': mini && !isEditMode,
65
+ 'it-header-sticky': !isEditMode,
66
+ })}
67
+ >
68
+ <HeaderSlim />
53
69
 
54
- <div className="it-nav-wrapper">
55
- <HeaderCenter />
56
- <Navigation pathname={pathname} isEditMode={isEditMode} />
57
- </div>
58
- <HeaderContacts />
59
- </Headers>
70
+ <div className="it-nav-wrapper">
71
+ <HeaderCenter />
72
+ <Navigation pathname={pathname} isEditMode={isEditMode} />
73
+ </div>
74
+ <HeaderContacts />
75
+ </Headers>
76
+ </div>
77
+ <div id="headerSpacer" style={{ height: mini ? headerHeight : 0 }} />
60
78
  <SubsiteHeader />
61
79
  </div>
62
80
  );
@@ -1,3 +1,7 @@
1
+ body {
2
+ overflow-x: hidden;
3
+ }
4
+
1
5
  h1.documentFirstHeading {
2
6
  border: none;
3
7
  &:before {