1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

added experimental scroll helper

This commit is contained in:
Fedor Katurov 2022-01-10 16:47:29 +07:00
parent c2154e930c
commit 8d1e6989c2
8 changed files with 105 additions and 4 deletions

View file

@ -0,0 +1,27 @@
import React, { VFC } from 'react';
import styles from './styles.module.scss';
import { useScrollTop } from '~/hooks/dom/useScrollTop';
import { useScrollHeight } from '~/hooks/dom/useScrollHeight';
import classNames from 'classnames';
import { useScrollToBottom } from '~/hooks/dom/useScrollToBottom';
interface ScrollHelperBottomProps {}
const ScrollHelperBottom: VFC<ScrollHelperBottomProps> = () => {
const top = useScrollTop();
const scrollHeight = useScrollHeight();
const scrollToBottom = useScrollToBottom();
const isVisible = scrollHeight > 2000 && top < scrollHeight * 0.25;
return (
<div
className={classNames(styles.helper, { [styles.visible]: isVisible })}
onClick={scrollToBottom}
>
Вниз
</div>
);
};
export { ScrollHelperBottom };