From f21e8f3f5ecf2c63f7f9e279bdb8f20a15ecf0c5 Mon Sep 17 00:00:00 2001 From: Evan Date: Tue, 24 Sep 2024 16:10:25 -0400 Subject: [PATCH] chore(jumplinks): fix overflow in jumplinks demo --- .../examples/JumpLinks/JumpLinksWithDrawer.js | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/packages/react-core/src/demos/examples/JumpLinks/JumpLinksWithDrawer.js b/packages/react-core/src/demos/examples/JumpLinks/JumpLinksWithDrawer.js index c7a3b2a16ec..10619b6aae4 100644 --- a/packages/react-core/src/demos/examples/JumpLinks/JumpLinksWithDrawer.js +++ b/packages/react-core/src/demos/examples/JumpLinks/JumpLinksWithDrawer.js @@ -16,14 +16,11 @@ import { Sidebar, SidebarContent, SidebarPanel, - getResizeObserver, DrawerContext } from '@patternfly/react-core'; import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper'; -import mastheadStyles from '@patternfly/react-styles/css/components/Masthead/masthead'; -import breadcrumbStyles from '@patternfly/react-styles/css/components/Breadcrumb/breadcrumb'; -const JumpLinksWrapper = ({ offsetHeight, headings }) => { +const JumpLinksWrapper = ({ headings }) => { const { drawerContentRef } = React.useContext(DrawerContext); return ( @@ -31,7 +28,6 @@ const JumpLinksWrapper = ({ offsetHeight, headings }) => { isVertical={true} label="Jump to section" scrollableRef={drawerContentRef} - offset={offsetHeight} expandable={{ default: 'expandable', md: 'nonExpandable' }} > {headings.map((heading) => ( @@ -47,25 +43,9 @@ const JumpLinksWrapper = ({ offsetHeight, headings }) => { export const JumpLinksWithDrawer = () => { const headings = ['First', 'Second', 'Third', 'Fourth', 'Fifth']; - const [offsetHeight, setOffsetHeight] = React.useState(0); const [isExpanded, setIsExpanded] = React.useState(false); const drawerRef = React.useRef(); - React.useEffect(() => { - const masthead = document.getElementsByClassName(mastheadStyles.masthead)[0]; - const breadcrumb = document.getElementsByClassName(breadcrumbStyles.breadcrumb)[0]; - const drawerToggleSection = document.getElementById('drawer-toggle'); - setOffsetHeight(masthead.offsetHeight + breadcrumb.offsetHeight + drawerToggleSection.offsetHeight); - - getResizeObserver( - masthead, - () => { - setOffsetHeight(masthead.offsetHeight + breadcrumb.offsetHeight + drawerToggleSection.offsetHeight); - }, - true - ); - }, []); - const onCloseClick = () => { setIsExpanded(false); }; @@ -95,14 +75,14 @@ export const JumpLinksWithDrawer = () => { - + - + {headings.map((heading) => (