mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Updated date range handling. Fixed share page.
This commit is contained in:
parent
3fc5f5151b
commit
696d9c978c
28 changed files with 166 additions and 280 deletions
32
components/common/StickyHeader.js
Normal file
32
components/common/StickyHeader.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { useMeasure } from 'react-basics';
|
||||
import classNames from 'classnames';
|
||||
import useSticky from 'hooks/useSticky';
|
||||
|
||||
export default function StickyHeader({
|
||||
className,
|
||||
stickyClassName,
|
||||
stickyStyle,
|
||||
enabled = true,
|
||||
scrollElement,
|
||||
children,
|
||||
}) {
|
||||
const { ref: scrollRef, isSticky } = useSticky({ scrollElement });
|
||||
const { ref: measureRef, dimensions } = useMeasure();
|
||||
const active = enabled && isSticky;
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={measureRef}
|
||||
data-sticky={active}
|
||||
style={active ? { height: dimensions.height } : null}
|
||||
>
|
||||
<div
|
||||
ref={scrollRef}
|
||||
className={classNames(className, { [stickyClassName]: active })}
|
||||
style={active ? { ...stickyStyle, width: dimensions.width } : null}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue