mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
disabled lazy load on flow cell
This commit is contained in:
parent
7ed425efa3
commit
4f0a015593
4 changed files with 36 additions and 4 deletions
|
@ -2,7 +2,6 @@ import React, { FC } from 'react';
|
|||
import styles from './styles.module.scss';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import { CellShade } from '~/components/flow/CellShade';
|
||||
import { FlowCellImage } from '~/components/flow/FlowCellImage';
|
||||
import { FlowDisplay, INode } from '~/redux/types';
|
||||
import { FlowCellText } from '~/components/flow/FlowCellText';
|
||||
import classNames from 'classnames';
|
||||
|
@ -10,6 +9,7 @@ import { FlowCellMenu } from '~/components/flow/FlowCellMenu';
|
|||
import { useFlowCellControls } from '~/utils/hooks/flow/useFlowCellControls';
|
||||
import { useClickOutsideFocus } from '~/utils/hooks/useClickOutsideFocus';
|
||||
import { MenuDots } from '~/components/common/MenuDots';
|
||||
import { FlowCellImage } from '~/components/flow/FlowCellImage';
|
||||
|
||||
interface Props {
|
||||
id: INode['id'];
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
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';
|
||||
|
@ -9,10 +8,10 @@ interface Props extends IMGProps {
|
|||
}
|
||||
|
||||
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="" />
|
||||
{children}
|
||||
</LazyLoad>
|
||||
</div>
|
||||
);
|
||||
|
||||
export { FlowCellImage };
|
||||
|
|
18
src/components/flow/FlowCellImageLazyLoad/index.tsx
Normal file
18
src/components/flow/FlowCellImageLazyLoad/index.tsx
Normal 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 };
|
15
src/components/flow/FlowCellImageLazyLoad/styles.module.scss
Normal file
15
src/components/flow/FlowCellImageLazyLoad/styles.module.scss
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue