ADD: Components

Teaser, Card
This commit is contained in:
webfussel 2025-05-29 13:11:15 +02:00
parent 8943512328
commit c8e4bf4a14
8 changed files with 127 additions and 48 deletions

View file

@ -1,3 +1,11 @@
type Size = '1x' | '2x' | '3x'
const allSizes : Size[] = ['1x', '2x', '3x']
export const getImage =
(path: string, img: string) => (size: "1x" | "2x" | "3x", set: boolean) =>
`${path}${img}@${size}.webp${set ? ` ${size}` : ""}`;
(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)