mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
images: fixed lazy loading of SVG's
This commit is contained in:
parent
6230a769e0
commit
02dd66a6af
3 changed files with 56 additions and 10 deletions
|
@ -18,9 +18,9 @@ import { imagePresets } from '~/constants/urls';
|
|||
import { useModal } from '~/hooks/modal/useModal';
|
||||
import { useImageModal } from '~/hooks/navigation/useImageModal';
|
||||
import { useNodeImages } from '~/hooks/node/useNodeImages';
|
||||
import { normalizeBrightColor } from '~/utils/color';
|
||||
import { getURL } from '~/utils/dom';
|
||||
import { getFileSrcSet } from '~/utils/srcset';
|
||||
|
||||
import { NodeImageLazy } from '../NodeImageLazy';
|
||||
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
|
@ -134,18 +134,13 @@ const NodeImageSwiperBlock: FC<IProps> = observer(({ node }) => {
|
|||
color={file.metadata?.dominant_color}
|
||||
>
|
||||
{({ loading, onLoad }) => (
|
||||
<img
|
||||
data-srcset={getFileSrcSet(file)}
|
||||
width={file.metadata?.width}
|
||||
height={file.metadata?.height}
|
||||
<NodeImageLazy
|
||||
file={file}
|
||||
onLoad={onLoad}
|
||||
onClick={() => onOpenPhotoSwipe(index)}
|
||||
className={classNames(styles.image, 'swiper-lazy', {
|
||||
[styles.loading]: loading,
|
||||
})}
|
||||
color={normalizeBrightColor(file?.metadata?.dominant_color)}
|
||||
alt=""
|
||||
sizes="(max-width: 560px) 100vw, 50vh"
|
||||
/>
|
||||
)}
|
||||
</ImageLoadingWrapper>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue