wf4/app/utils/image.ts
2025-06-05 07:50:50 +02:00

11 lines
No EOL
434 B
TypeScript
Executable file

type Size = '1x' | '2x' | '3x'
const allSizes : Size[] = ['1x', '2x', '3x']
export const getImage =
(path: string, img: string) => (size: Size, set: boolean) =>
`${path}${img}@${size}.webp${set ? ` ${size}` : ''}`;
export const getImageSet = (path: string, img: string) =>
allSizes.map((size) => getImage(path, img)(size, true))
export const getInitialImage = (path: string, img: string) => getImage(path, img)('1x', false)