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

added lazy loading to lab

This commit is contained in:
Fedor Katurov 2022-12-07 13:17:47 +06:00
parent 10bb6f01b5
commit 182ff11d2b
4 changed files with 26 additions and 19 deletions

12
src/utils/srcset.ts Normal file
View file

@ -0,0 +1,12 @@
import { IFile } from '~/types';
import { getURL } from '~/utils/dom';
import { imageSrcSets, ImagePreset } from '../constants/urls';
export const getFileSrcSet = (file: IFile) =>
Object.keys(imageSrcSets)
.map(
(preset) =>
`${getURL(file, preset as ImagePreset)} ${imageSrcSets[preset]}w`,
)
.join(', ');