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/CardImage.tsx | |
| download | corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.gz corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.bz2 corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.zip | |
Init
Diffstat (limited to 'src/ui/objects/CardImage.tsx')
| -rw-r--r-- | src/ui/objects/CardImage.tsx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ui/objects/CardImage.tsx b/src/ui/objects/CardImage.tsx new file mode 100644 index 0000000..12b9735 --- /dev/null +++ b/src/ui/objects/CardImage.tsx | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | import type { Props as ImageProps } from "corvos/plugins/images.ts"; | ||
| 2 | import type { CSSProperties } from "https://cdn.jsdelivr.net/gh/oscarotero/ssx@0.1.14/css.ts"; | ||
| 3 | |||
| 4 | import { Image } from "corvos/plugins/images.ts"; | ||
| 5 | |||
| 6 | export type Props = ImageProps & { | ||
| 7 | "list"?: boolean; | ||
| 8 | "img-class"?: unknown; | ||
| 9 | "img-style"?: CSSProperties; | ||
| 10 | "aspect"?: `${number} / ${number}`; | ||
| 11 | "content-class"?: unknown; | ||
| 12 | "children"?: JSX.Element; | ||
| 13 | }; | ||
| 14 | |||
| 15 | export const CardImage = ({ | ||
| 16 | children, | ||
| 17 | list, | ||
| 18 | "img-class": imgClass, | ||
| 19 | aspect, | ||
| 20 | "content-class": contentClass, | ||
| 21 | alt, | ||
| 22 | class: cls, | ||
| 23 | style, | ||
| 24 | "img-style": imgStyle, | ||
| 25 | ...props | ||
| 26 | }: Props) => ( | ||
| 27 | <div class:list={["o-card__image", cls]} style={style}> | ||
| 28 | <Image | ||
| 29 | class:list={["o-card__image-img", { "l-card-list__card-image": list }, imgClass]} | ||
| 30 | style={{ | ||
| 31 | "aspect-ratio": aspect, | ||
| 32 | "block-size": aspect ? "auto" : undefined, | ||
| 33 | ...imgStyle, | ||
| 34 | }} | ||
| 35 | alt={alt} | ||
| 36 | {...props} | ||
| 37 | /> | ||
| 38 | {children && <div class:list={["o-card__image-overlay", contentClass]}>{children}</div>} | ||
| 39 | </div> | ||
| 40 | ); | ||
