-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed height computation issue in Pane component
- Loading branch information
1 parent
9c08318
commit 2fa6009
Showing
2 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
import { DEFAULT_PANE_HEADER_HEIGHT } from "./constants"; | ||
|
||
export const getHeaderHeight = paneWrapper => { | ||
const header = paneWrapper.current.querySelector(".neeto-ui-pane__header"); | ||
export const getHeader = paneWrapper => | ||
paneWrapper.current.querySelector(".neeto-ui-pane__header"); | ||
|
||
return header ? header.offsetHeight : DEFAULT_PANE_HEADER_HEIGHT; | ||
export const updateHeaderHeight = (paneWrapper, header) => { | ||
const headerHeight = header.offsetHeight; | ||
|
||
if (headerHeight > DEFAULT_PANE_HEADER_HEIGHT) { | ||
paneWrapper.current.style.setProperty( | ||
"--neeto-ui-pane-header-height", | ||
`${headerHeight}px` | ||
); | ||
} else { | ||
paneWrapper.current.style.removeProperty("--neeto-ui-pane-header-height"); | ||
} | ||
}; |