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:
parent
10bb6f01b5
commit
182ff11d2b
4 changed files with 26 additions and 19 deletions
12
src/utils/srcset.ts
Normal file
12
src/utils/srcset.ts
Normal 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(', ');
|
Loading…
Add table
Add a link
Reference in a new issue