UNPKG

fumadocs-openapi

Version:

Generate MDX docs for your OpenAPI spec

42 lines (40 loc) 1.16 kB
import { cn } from "../../utils/cn.js"; import { jsx } from "react/jsx-runtime"; import { cva } from "class-variance-authority"; //#region src/ui/components/method-label.tsx const badgeVariants = cva("font-mono font-medium", { variants: { color: { green: "text-green-600 dark:text-green-400", yellow: "text-yellow-600 dark:text-yellow-400", red: "text-red-600 dark:text-red-400", blue: "text-blue-600 dark:text-blue-400", orange: "text-orange-600 dark:text-orange-400" } } }); function getMethodColor(method) { switch (method.toUpperCase()) { case "PUT": return "yellow"; case "PATCH": return "orange"; case "POST": return "blue"; case "DELETE": return "red"; default: return "green"; } } function Badge({ className, color, ...props }) { return /* @__PURE__ */ jsx("span", { className: cn(badgeVariants({ color, className })), ...props, children: props.children }); } function MethodLabel({ children, ...props }) { return /* @__PURE__ */ jsx(Badge, { ...props, color: getMethodColor(children), children: children.toUpperCase() }); } //#endregion export { Badge, MethodLabel }; //# sourceMappingURL=method-label.js.map