UNPKG

@nodeject/ui-components

Version:

UI library for non-trivial components

17 lines (16 loc) 829 B
import * as React from 'react'; import IntersectionVisible from 'react-intersection-visible'; export var Content = function (props) { var onContentBottomReached = function (entries) { var isContentBottomReached = entries[0].isIntersecting; props.onContentBottomReached(isContentBottomReached); }; var onContentTopReached = function (entries) { var isContentTopReached = entries[0].isIntersecting; props.onContentTopReached(isContentTopReached); }; return (React.createElement(React.Fragment, null, React.createElement(IntersectionVisible, { onIntersect: function (e) { return onContentTopReached(e); } }), props.content, React.createElement(IntersectionVisible, { onIntersect: function (e) { return onContentBottomReached(e); } }))); };