diff options
| author | Volpeon <git@volpeon.ink> | 2026-07-22 19:40:59 +0200 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2026-07-22 19:40:59 +0200 |
| commit | c1e28224aa2e1450031669d9a7e359b63e04687d (patch) | |
| tree | 68f3d8905c763a91f68001d868197effa92adafa /src/ui/objects/Thumbnail.tsx | |
| download | corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.gz corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.bz2 corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.zip | |
Init
Diffstat (limited to 'src/ui/objects/Thumbnail.tsx')
| -rw-r--r-- | src/ui/objects/Thumbnail.tsx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ui/objects/Thumbnail.tsx b/src/ui/objects/Thumbnail.tsx new file mode 100644 index 0000000..4ef76d3 --- /dev/null +++ b/src/ui/objects/Thumbnail.tsx | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | import type { Props as ImageProps } from "corvos/plugins/images.ts"; | ||
| 2 | import type { HTMLAttributes } from "corvos/plugins/jsx.ts"; | ||
| 3 | |||
| 4 | import { Image } from "corvos/plugins/images.ts"; | ||
| 5 | |||
| 6 | export type Props = HTMLAttributes<"a"> & | ||
| 7 | ImageProps & { | ||
| 8 | "x-bind:src"?: string; | ||
| 9 | "x-bind:srcset"?: string; | ||
| 10 | "x-bind:alt"?: string; | ||
| 11 | "variant"?: "static-black" | "static-white"; | ||
| 12 | }; | ||
| 13 | |||
| 14 | export const Thumbnail = ({ | ||
| 15 | src, | ||
| 16 | srcset, | ||
| 17 | alt, | ||
| 18 | "x-bind:src": xbindSrc, | ||
| 19 | "x-bind:srcset": xbindSrcset, | ||
| 20 | "x-bind:alt": xbindAlt, | ||
| 21 | variant, | ||
| 22 | class: cls, | ||
| 23 | widths, | ||
| 24 | width, | ||
| 25 | height, | ||
| 26 | densities, | ||
| 27 | "no-transform": noTransform, | ||
| 28 | ...props | ||
| 29 | }: Props) => ( | ||
| 30 | <a class:list={["o-thumbnail", { [`o-thumbnail--${variant}`]: variant }, cls]} {...props}> | ||
| 31 | <Image | ||
| 32 | class="o-thumbnail__image" | ||
| 33 | src={src} | ||
| 34 | srcset={srcset} | ||
| 35 | widths={widths as undefined} | ||
| 36 | width={width} | ||
| 37 | height={height} | ||
| 38 | densities={densities} | ||
| 39 | no-transform={noTransform} | ||
| 40 | alt={alt} | ||
| 41 | x-bind:src={xbindSrc} | ||
| 42 | x-bind:srcset={xbindSrcset} | ||
| 43 | x-bind:alt={xbindAlt} | ||
| 44 | /> | ||
| 45 | </a> | ||
| 46 | ); | ||
