Skip to content

Commit

Permalink
update sticky header height
Browse files Browse the repository at this point in the history
  • Loading branch information
mckervinc committed Dec 9, 2024
1 parent c4ab017 commit 03db961
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CHANGELOG

## 0.6.4

_2024-12-09_

### Bugfix

- Force the sticky header to be the size of the rendered header
- Make sure footer width is 0 when not present

## 0.6.3

_2024-12-04_
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-fluid-table",
"version": "0.6.3",
"version": "0.6.4",
"description": "A React table inspired by react-window",
"author": "Mckervin Ceme <[email protected]>",
"license": "MIT",
Expand Down
5 changes: 5 additions & 0 deletions src/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ const Footer = () => {
const ref = useRef<HTMLDivElement>(null);

// constants
const hasFooter = !!FooterComponent || !!columns.find(c => !!c.footer);
const style: React.CSSProperties = {
minWidth: stickyFooter ? undefined : pixelWidths.reduce((pv, c) => pv + c, 0),
...footerStyle
};
if (!hasFooter) {
style.width = 0;
style.minWidth = 0;
}

// functions
const onScroll = useCallback(
Expand Down
1 change: 1 addition & 0 deletions src/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const Header = forwardRef(
(ref as React.MutableRefObject<HTMLDivElement>).current || NO_NODE;
const width = scrollWidth <= clientWidth ? "100%" : undefined;
const stickyStyle: React.CSSProperties = {
height,
zIndex: columns.find(c => c.frozen) ? 2 : undefined
};

Expand Down

0 comments on commit 03db961

Please sign in to comment.