UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

72 lines (71 loc) • 1.8 kB
"use client"; import { statusColor, styles } from "./style.mjs"; import { memo, useMemo } from "react"; import { jsx, jsxs } from "react/jsx-runtime"; import { cssVar, cx } from "antd-style"; import { Check, Info, TriangleAlert, X } from "lucide-react"; //#region src/base-ui/Result/Result.tsx const statusIcon = { error: /* @__PURE__ */ jsx(X, { size: 36, strokeWidth: 2.5 }), info: /* @__PURE__ */ jsx(Info, { size: 36, strokeWidth: 2 }), success: /* @__PURE__ */ jsx(Check, { size: 36, strokeWidth: 2.5 }), warning: /* @__PURE__ */ jsx(TriangleAlert, { size: 36, strokeWidth: 2 }) }; const Result = memo(({ children, className, extra, icon, ref, status = "info", style, subTitle, title, ...rest }) => { const iconStyle = useMemo(() => { if (status === "info") return { background: cssVar.colorFillTertiary, color: cssVar.colorTextSecondary }; const color = statusColor[status]; return { background: `color-mix(in srgb, ${color} 12%, transparent)`, color }; }, [status]); return /* @__PURE__ */ jsxs("section", { className: cx(styles.root, className), ref, style, ...rest, children: [ icon ? /* @__PURE__ */ jsx("div", { className: styles.customIcon, children: icon }) : /* @__PURE__ */ jsx("div", { className: styles.icon, style: iconStyle, children: statusIcon[status] }), title && /* @__PURE__ */ jsx("h3", { className: styles.title, children: title }), subTitle && /* @__PURE__ */ jsx("p", { className: styles.subTitle, children: subTitle }), extra && /* @__PURE__ */ jsx("div", { className: styles.extra, children: extra }), children ] }); }); Result.displayName = "Result"; //#endregion export { Result as default }; //# sourceMappingURL=Result.mjs.map