From 5cf36aaa632713e67c67c568dad68707c579b14d Mon Sep 17 00:00:00 2001 From: stanislavh Date: Wed, 24 May 2023 10:29:31 +0200 Subject: [PATCH] [NO-JIRA] Fix scroll sidebar layout --- .../SecurityHotspotsAppRenderer.tsx | 29 +++++++++++++++---- .../components/HotspotStatusFilter.tsx | 2 +- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx index 1e38cab7c16..7dbc385acad 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx @@ -21,6 +21,7 @@ import { withTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { DeferredSpinner, + LAYOUT_FOOTER_HEIGHT, LAYOUT_GLOBAL_NAV_HEIGHT, LAYOUT_PROJECT_NAV_HEIGHT, LargeCenteredLayout, @@ -34,6 +35,7 @@ import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; import Suggestions from '../../components/embed-docs-modal/Suggestions'; import { isBranch } from '../../helpers/branch-like'; import { translate } from '../../helpers/l10n'; +import useFollowScroll from '../../hooks/useFollowScroll'; import { BranchLike } from '../../types/branch-like'; import { ComponentQualifier } from '../../types/component'; import { MetricKey } from '../../types/metrics'; @@ -105,6 +107,11 @@ export default function SecurityHotspotsAppRenderer(props: SecurityHotspotsAppRe const isProject = component.qualifier === ComponentQualifier.Project; + const { top: topScroll } = useFollowScroll(); + const distanceFromBottom = topScroll + window.innerHeight - document.body.clientHeight; + const footerVisibleHeight = + distanceFromBottom > -LAYOUT_FOOTER_HEIGHT ? LAYOUT_FOOTER_HEIGHT + distanceFromBottom : 0; + return ( <> @@ -130,7 +137,22 @@ export default function SecurityHotspotsAppRenderer(props: SecurityHotspotsAppRe /> )} - + ) : ( - + props.onChangeFilters({ status })} -- 2.39.5