rm ImageSize and couple of functions from image lib

This commit is contained in:
tmshv committed 2021-02-17 19:10:01 +03:00
1 parent bf4377d614
commit eb8d8b37a5
3 files changed
+1 -33

No files matched your search

-24
View File
@@ -1,5 +1,3 @@
import { ImageSize } from 'src/types'
export type ResizeOptions = {
width: number
height: number
@@ -14,25 +12,3 @@ export function getResizedUrl(src: string, options: ResizeOptions): string {
return `http://images.weserv.nl/?url=${src}&w=${options.width}&h=${options.height}&n=${n}`
}
export function imageSrcSet(src: string, sizes: ImageSize[]): string {
const set = sizes
.map(x => ({
value: x,
href: getResizedUrl(src, {
width: x,
height: x,
}),
}))
return set
.map(x => `${x.href} ${x.value}w`)
.join(', ')
}
export function imageSrc(src: string, size: ImageSize): string {
return getResizedUrl(src, {
width: size,
height: size,
})
}