Files
twenty/packages/twenty-front/src/modules/activities/components/CustomResolverFetchMoreLoader.tsx
T
2025-12-12 14:43:21 +01:00

41 lines
932 B
TypeScript

import styled from '@emotion/styled';
import { useInView } from 'react-intersection-observer';
type CustomResolverFetchMoreLoaderProps = {
loading: boolean;
onLastRowVisible: (...args: any[]) => any;
};
const StyledContainer = styled.div`
min-height: 1px;
`;
const StyledText = styled.div`
align-items: center;
box-shadow: none;
color: ${({ theme }) => theme.grayScale.gray9};
display: flex;
height: 32px;
margin-left: ${({ theme }) => theme.spacing(8)};
padding-left: ${({ theme }) => theme.spacing(2)};
`;
export const CustomResolverFetchMoreLoader = ({
loading,
onLastRowVisible,
}: CustomResolverFetchMoreLoaderProps) => {
const { ref: tbodyRef } = useInView({
onChange: (inView) => {
if (inView) {
onLastRowVisible();
}
},
});
return (
<StyledContainer ref={tbodyRef}>
{loading && <StyledText>Loading more...</StyledText>}
</StyledContainer>
);
};