fumadocs-ui
Version:
The Radix UI version of Fumadocs UI
40 lines (39 loc) • 1.33 kB
JavaScript
import { cn } from "../utils/cn.js";
import Link from "fumadocs-core/link";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/components/card.tsx
function Cards(props) {
return /* @__PURE__ */ jsx("div", {
...props,
className: cn("grid grid-cols-2 gap-3 @container", props.className),
children: props.children
});
}
function Card({ icon, title, description, ...props }) {
const E = props.href ? Link : "div";
return /* @__PURE__ */ jsxs(E, {
...props,
"data-card": true,
className: cn("block rounded-xl border bg-fd-card p-4 text-fd-card-foreground transition-colors @max-lg:col-span-full", props.href && "hover:bg-fd-accent/80", props.className),
children: [
icon ? /* @__PURE__ */ jsx("div", {
className: "not-prose mb-2 w-fit shadow-md rounded-lg border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4",
children: icon
}) : null,
/* @__PURE__ */ jsx("h3", {
className: "not-prose mb-1 text-sm font-medium",
children: title
}),
description ? /* @__PURE__ */ jsx("p", {
className: "my-0! text-sm text-fd-muted-foreground",
children: description
}) : null,
/* @__PURE__ */ jsx("div", {
className: "text-sm text-fd-muted-foreground prose-no-margin empty:hidden",
children: props.children
})
]
});
}
//#endregion
export { Card, Cards };