@playbooks/ui
Version:
An interface library for Playbooks.
39 lines (38 loc) • 1.24 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require$$0 = require("react/jsx-runtime");
const React = require("react");
const html = require("./toast-context-kVz4KXNu.cjs");
const Command = ({ name = "CMD", keys = [], tailwind, className, children, ...props }) => {
const { theme } = html.useInterface();
const base = theme.command();
const computed = { ...base, ...props, tailwind, className, name };
const computedKeys = React.useMemo(() => {
const formattedKeys = [];
keys.map((code) => {
switch (code) {
case "command":
case "Command":
return formattedKeys.push("⌘");
case "control":
case "Control":
return formattedKeys.push("^");
case "enter":
case "Enter":
return formattedKeys.push("↵");
case "option":
case "Option":
return formattedKeys.push("⌥");
case "shift":
case "Shift":
return formattedKeys.push("⇧");
}
});
return formattedKeys;
}, [keys]);
return /* @__PURE__ */ require$$0.jsxs(html.Span, { ...computed, children: [
computedKeys.join(""),
children
] });
};
exports.Command = Command;