UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

16 lines (15 loc) 1.2 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { joinPath } from "../../util/path.js"; import { Card } from "../block/Card.js"; import { Paragraph } from "../block/Paragraph.js"; import { Preformatted } from "../block/Preformatted.js"; import { Subheading } from "../block/Subheading.js"; import { Code } from "../inline/Code.js"; import { Flex } from "../style/Flex.js"; import { DocumentationKind, getDocumentationKindColor } from "./DocumentationKind.js"; /** Card renderer for a `tree-documentation` element — a summary card showing the heading, signatures, and description. */ export function DocumentationCard({ path, title, name, kind, description, signatures }) { const href = joinPath(path, name); const color = kind ? getDocumentationKindColor(kind) : undefined; return (_jsxs(Card, { href: href, ...(color ? { [color]: true } : {}), children: [_jsx(Subheading, { children: _jsxs(Flex, { left: true, wrap: true, children: [_jsx(Code, { children: title ?? name }), kind && _jsx(DocumentationKind, { kind: kind })] }) }), signatures?.map(sig => (_jsx(Preformatted, { children: sig }, sig))), description && _jsx(Paragraph, { children: description })] })); }