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

disabled lazy load on flow cell

This commit is contained in:
Fedor Katurov 2021-12-16 13:54:15 +07:00
parent 7ed425efa3
commit 4f0a015593
4 changed files with 36 additions and 4 deletions

View file

@ -2,7 +2,6 @@ import React, { FC } from 'react';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { CellShade } from '~/components/flow/CellShade'; import { CellShade } from '~/components/flow/CellShade';
import { FlowCellImage } from '~/components/flow/FlowCellImage';
import { FlowDisplay, INode } from '~/redux/types'; import { FlowDisplay, INode } from '~/redux/types';
import { FlowCellText } from '~/components/flow/FlowCellText'; import { FlowCellText } from '~/components/flow/FlowCellText';
import classNames from 'classnames'; import classNames from 'classnames';
@ -10,6 +9,7 @@ import { FlowCellMenu } from '~/components/flow/FlowCellMenu';
import { useFlowCellControls } from '~/utils/hooks/flow/useFlowCellControls'; import { useFlowCellControls } from '~/utils/hooks/flow/useFlowCellControls';
import { useClickOutsideFocus } from '~/utils/hooks/useClickOutsideFocus'; import { useClickOutsideFocus } from '~/utils/hooks/useClickOutsideFocus';
import { MenuDots } from '~/components/common/MenuDots'; import { MenuDots } from '~/components/common/MenuDots';
import { FlowCellImage } from '~/components/flow/FlowCellImage';
interface Props { interface Props {
id: INode['id']; id: INode['id'];

View file

@ -1,5 +1,4 @@
import React, { FC } from 'react'; import React, { FC } from 'react';
import LazyLoad from 'react-lazyload';
import { IMGProps } from '~/utils/types'; import { IMGProps } from '~/utils/types';
import styles from './styles.module.scss'; import styles from './styles.module.scss';
import classNames from 'classnames'; import classNames from 'classnames';
@ -9,10 +8,10 @@ interface Props extends IMGProps {
} }
const FlowCellImage: FC<Props> = ({ className, children, ...rest }) => ( const FlowCellImage: FC<Props> = ({ className, children, ...rest }) => (
<LazyLoad once offset={600} className={classNames(styles.wrapper, className)}> <div className={classNames(styles.wrapper, className)}>
<img {...rest} src={rest.src} alt="" /> <img {...rest} src={rest.src} alt="" />
{children} {children}
</LazyLoad> </div>
); );
export { FlowCellImage }; export { FlowCellImage };

View file

@ -0,0 +1,18 @@
import React, { FC } from 'react';
import LazyLoad from 'react-lazyload';
import { IMGProps } from '~/utils/types';
import styles from './styles.module.scss';
import classNames from 'classnames';
interface Props extends IMGProps {
height?: number;
}
const FlowCellImageLazyLoad: FC<Props> = ({ className, children, ...rest }) => (
<LazyLoad once offset={600} className={classNames(styles.wrapper, className)}>
<img {...rest} src={rest.src} alt="" />
{children}
</LazyLoad>
);
export { FlowCellImageLazyLoad };

View file

@ -0,0 +1,15 @@
.wrapper {
width: 100%;
height: 100%;
position: relative;
img {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
transform: translate(-50%, -50%);
object-fit: cover;
}
}