@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
63 lines (61 loc) • 1.67 kB
JavaScript
import FlexBasic_default from "../../Flex/FlexBasic.mjs";
import { copyToClipboard } from "../../utils/copyToClipboard.mjs";
import { alphaBg, styles } from "./style.mjs";
import { memo } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
import { Space, message } from "antd";
//#region src/color/ColorScales/ScaleRow.tsx
const ScaleRow = memo(({ name, title, scale }) => {
let style = {};
let isAlpha = false;
switch (title) {
case "lightA":
style = {
background: alphaBg.light,
backgroundColor: "#fff"
};
isAlpha = true;
break;
case "darkA":
style = {
background: alphaBg.dark,
backgroundColor: "#000"
};
isAlpha = true;
break;
default: break;
}
return /* @__PURE__ */ jsxs(Space, {
size: 2,
children: [/* @__PURE__ */ jsx("div", {
className: styles.scaleRowTitle,
children: /* @__PURE__ */ jsx("div", {
className: styles.text,
children: title
})
}, title), scale.map((color, index) => {
if (index === 0 || index === 12) return false;
return /* @__PURE__ */ jsx("div", {
className: styles.scaleBox,
onClick: async () => {
const content = `token.${name}${index}${isAlpha ? "A" : ""} /* ${color} */`;
await copyToClipboard(content);
message.success(content);
},
style,
title: color,
children: /* @__PURE__ */ jsx(FlexBasic_default, {
align: "center",
className: styles.scaleItem,
horizontal: true,
justify: "center",
style: { backgroundColor: color }
})
}, index);
})]
});
});
var ScaleRow_default = ScaleRow;
//#endregion
export { ScaleRow_default as default };
//# sourceMappingURL=ScaleRow.mjs.map