mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
12 lines
336 B
TypeScript
12 lines
336 B
TypeScript
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(', ');
|