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

refactored boris

This commit is contained in:
Fedor Katurov 2021-09-20 17:49:44 +07:00
parent 35ce593ed8
commit 4c74674ac1
10 changed files with 105 additions and 129 deletions

View file

@ -33,41 +33,10 @@ const Cell: FC<IProps> = ({
const [is_loaded, setIsLoaded] = useState(false);
const [is_visible, setIsVisible] = useState(true);
// const checkIfVisible = useCallback(() => {
// if (!ref.current) return;
//
// const { top, height } = ref.current.getBoundingClientRect();
//
// // const visibility = top + height > -window.innerHeight && top < window.innerHeight * 2;
// const visibility = top + height > -600 && top < window.innerHeight + 600;
// if (visibility !== is_visible) setIsVisible(visibility);
// }, [ref, is_visible, setIsVisible]);
//
// const checkIfVisibleDebounced = useCallback(debounce(Math.random() * 100 + 100, checkIfVisible), [
// checkIfVisible,
// ]);
// useEffect(() => {
// checkIfVisibleDebounced();
// }, []);
// useEffect(() => {
// recalc visibility of other elements
// window.dispatchEvent(new CustomEvent('scroll'));
// }, [flow]);
// useEffect(() => {
// window.addEventListener('scroll', checkIfVisibleDebounced);
//
// return () => window.removeEventListener('scroll', checkIfVisibleDebounced);
// }, [checkIfVisibleDebounced]);
const onImageLoad = useCallback(() => {
setIsLoaded(true);
}, [setIsLoaded]);
// Replaced it with <Link>, maybe, you can remove it completely with NodeSelect action
// const onClick = useCallback(() => onSelect(id, type), [onSelect, id, type]);
const has_description = description && description.length > 32;
const text =
@ -82,12 +51,12 @@ const Cell: FC<IProps> = ({
}, [id, flow, onChangeCellView]);
const setViewSingle = useCallback(() => {
const show_description = (flow && !!flow.show_description) || false;
const show_description = (flow && flow.show_description) || false;
onChangeCellView(id, { show_description, display: 'single' });
}, [id, flow, onChangeCellView]);
const setViewHorizontal = useCallback(() => {
const show_description = (flow && !!flow.show_description) || false;
const show_description = (flow && flow.show_description) || false;
onChangeCellView(id, { show_description, display: 'horizontal' });
}, [id, flow, onChangeCellView]);

View file

@ -30,18 +30,13 @@
.thumbnail {
transform: scale(1.1);
}
.title {
//opacity: 0;
//transform: translate(-3px, 3px);
}
}
@include outer_shadow();
}
.text {
font: $font_18_regular;
line-height: 22px;
line-height: 23px;
background: transparentize($color: $content_bg, $amount: 0.3) url('../../../sprites/stripes.svg');
padding: $gap;
box-sizing: border-box;