@intility/bifrost-react
Version:
React library for Intility's design system, Bifrost.
25 lines (24 loc) • 866 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import classNames from "classnames";
/**
* Sticky is a box that will follow scroll position until it reaches top, then stick there.
*/ const Sticky = /*#__PURE__*/ forwardRef(({ top, unstyled = false, className, children, style, ...props }, ref)=>{
return /*#__PURE__*/ _jsx("div", {
...props,
ref: ref,
style: {
"--bf-sticky-top": typeof top === "number" ? top + "px" : top,
...style
},
className: classNames(className, "bf-sticky bf-scrollbar-small", {
"bf-padding": !unstyled,
"bfc-base-3-bg": !unstyled,
"bf-radius-xs": !unstyled,
"bf-shadow": !unstyled
}),
children: children
});
});
Sticky.displayName = "Sticky";
export default Sticky;