import { cva, type VariantProps } from "class-variance-authority"; import { splitProps, type JSX } from "solid-js"; import { Dynamic } from "solid-js/web"; import { cn } from "../../lib/cn"; type CardElement = "article" | "aside" | "div" | "section"; export const cardVariants = cva("rounded-md border border-line bg-surface", { variants: { padding: { none: "", small: "p-4", medium: "p-5", }, elevation: { flat: "", raised: "shadow-sm", }, }, defaultVariants: { padding: "none", elevation: "flat", }, }); export type CardProps = JSX.HTMLAttributes & VariantProps & { as?: CardElement; }; /** * Generic bordered surface. * * `as` preserves document semantics at the call site; Card only owns visual * framing and must not encode page or domain behavior. */ export function Card(props: CardProps) { const [local, rest] = splitProps(props, ["as", "padding", "elevation", "class", "children"]); return ( {local.children} ); } export type CardHeaderProps = JSX.HTMLAttributes; /** Standard Card heading/action row. */ export function CardHeader(props: CardHeaderProps) { const [local, rest] = splitProps(props, ["class", "children"]); return (
{local.children}
); }