UNPKG

@blocklet/ui-react

Version:

Some useful front-end web components that can be used in Blocklets.

44 lines (43 loc) 1.17 kB
import { jsx as t } from "react/jsx-runtime"; import { memo as n } from "react"; import { Chip as i } from "@mui/material"; import { Icon as a } from "@iconify/react"; import p from "@iconify-icons/material-symbols/swap-horiz-rounded"; import { useCreation as c } from "ahooks"; function m({ user: o, switchPassport: r }) { const l = c( // FIXME: @zhanghan 感觉应该把 name 的判断去掉? () => (o?.passports || [])?.find((e) => e.name === o.role || e.role === o.role), [o?.passports, o?.role] ); return /* @__PURE__ */ t( i, { label: l?.title || o?.role || "Guest", size: "small", variant: "outlined", sx: { flexShrink: 0, fontWeight: "bold", fontSize: "12px", color: "text.primary", borderColor: "grey.100", backgroundColor: "transparent", textTransform: "capitalize", pr: 1, pl: 0.5, "&:active": { boxShadow: "none" } }, clickable: !0, deleteIcon: /* @__PURE__ */ t(a, { icon: p, color: "inherit" }), onDelete: r, onClick: r } ); } const S = n(m); export { S as default };