1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import type { HTMLTag, Polymorphic } from "corvos/plugins/jsx.ts";
export type Props<Tag extends HTMLTag> = Polymorphic<{
"as"?: Tag;
"list"?: boolean;
"quiet"?: boolean;
"thumbnail"?: boolean;
"border"?: boolean;
"no-shadow"?: boolean;
"horizontal"?: boolean;
"interactive"?: boolean;
"highlight"?: boolean;
"children"?: JSX.Element;
}>;
export const Card = <T extends HTMLTag = "article">({
as: Tag = "article" as T,
list,
quiet,
thumbnail,
border,
"no-shadow": noShadow,
horizontal,
interactive,
highlight,
class: cls,
...props
}: Props<T>) => (
<Tag
class:list={[
"o-card",
{
"l-card-list__card": list,
"o-card--borderless": !border,
"o-card--horizontal": horizontal,
"o-card--interactive": interactive,
"o-card--highlight": highlight,
"o-card--quiet": quiet,
"o-card--collapsible": Tag === "details",
"o-card--shadow": !noShadow,
"o-card--thumbnail": thumbnail,
},
cls,
]}
{...props}
/>
);
|