@jetbrains/kotlin-web-site-ui 4.4.0-alpha.3 → 4.4.0-alpha.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.
|
@@ -31,11 +31,8 @@ const VerticalMenu = ({
|
|
|
31
31
|
const activeItem = _items[_activeIndex];
|
|
32
32
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
33
33
|
const [portalRoot, setPortalRoot] = useState(null);
|
|
34
|
-
const [isTopMenuSticky, setIsTopMenuSticky] = useState(false);
|
|
35
34
|
const handleOpen = useCallback(() => {
|
|
36
35
|
setIsExpanded(true);
|
|
37
|
-
const topMenuTopOffset = topMenuRef?.current?.getBoundingClientRect().top;
|
|
38
|
-
setIsTopMenuSticky(topMenuTopOffset === 0);
|
|
39
36
|
}, []);
|
|
40
37
|
const handleClose = useCallback(() => {
|
|
41
38
|
setIsExpanded(false);
|
|
@@ -65,8 +62,7 @@ const VerticalMenu = ({
|
|
|
65
62
|
items: _items,
|
|
66
63
|
onClose: handleClose,
|
|
67
64
|
linkHandler: linkHandler,
|
|
68
|
-
topMenuRef: topMenuRef
|
|
69
|
-
isSticky: isTopMenuSticky
|
|
65
|
+
topMenuRef: topMenuRef
|
|
70
66
|
}), portalRoot)));
|
|
71
67
|
};
|
|
72
68
|
|
|
@@ -76,14 +72,20 @@ const VerticalMenuDropDown = ({
|
|
|
76
72
|
items,
|
|
77
73
|
linkHandler,
|
|
78
74
|
activeIndex,
|
|
79
|
-
topMenuRef
|
|
80
|
-
isSticky
|
|
75
|
+
topMenuRef
|
|
81
76
|
}) => {
|
|
82
77
|
const textCn = useTextStyles();
|
|
83
78
|
const theme = useTheme();
|
|
84
79
|
const navRef = useRef(null);
|
|
85
80
|
const [navStyle, setNavStyle] = useState({});
|
|
81
|
+
const [topMenuSticky, setTopMenuSticky] = useState(false);
|
|
86
82
|
useEffect(() => {
|
|
83
|
+
const topMenuTopOffset = topMenuRef?.current?.getBoundingClientRect().top;
|
|
84
|
+
|
|
85
|
+
if (topMenuTopOffset !== undefined) {
|
|
86
|
+
setTopMenuSticky(topMenuTopOffset === 0);
|
|
87
|
+
}
|
|
88
|
+
|
|
87
89
|
if (navRef.current) {
|
|
88
90
|
disableBodyScroll(navRef.current);
|
|
89
91
|
}
|
|
@@ -105,7 +107,7 @@ const VerticalMenuDropDown = ({
|
|
|
105
107
|
})
|
|
106
108
|
}, React__default.createElement("div", {
|
|
107
109
|
className: classNames(styles.dropdownHeader, {
|
|
108
|
-
[styles.stickyHeader]:
|
|
110
|
+
[styles.stickyHeader]: topMenuSticky
|
|
109
111
|
})
|
|
110
112
|
}, React__default.createElement("div", {
|
|
111
113
|
className: textCn('rs-text-2')
|