rm ImageSize and couple of functions from image lib
This commit is contained in:
1 parent
bf4377d614
commit
eb8d8b37a5
3 files changed
+1
-33
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import Image from 'next/image'
|
||||
import { ImageSize, PageCardDto } from 'src/types'
|
||||
import { PageCardDto } from '@/types'
|
||||
import { CardGrid } from '../CardGrid'
|
||||
import { Card, CardLayout } from '../Card'
|
||||
import { Date } from './Date'
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
@@ -84,14 +84,6 @@ export interface ITag {
|
||||
href: string
|
||||
}
|
||||
|
||||
export enum ImageSize {
|
||||
big = 3000,
|
||||
large = 1500,
|
||||
medium = 1000,
|
||||
small = 500,
|
||||
thumbnail = 200,
|
||||
}
|
||||
|
||||
export type ImageDefinition = {
|
||||
width: number
|
||||
height: number
|
||||
|
||||
Reference in new issue
Block a user