@ant-design/x
Version:
Craft AI-driven interfaces effortlessly
36 lines • 731 B
JavaScript
import { clsx } from 'clsx';
import * as React from 'react';
import useCreation from "./hooks/useCreation";
const Creation = ({
className,
icon,
label,
align,
style,
disabled,
onClick,
prefixCls,
shortcutKeyInfo
}) => {
const [iconNode, labelNode, mergeAlign] = useCreation({
prefixCls,
label,
icon,
align,
shortcutKeyInfo
});
return /*#__PURE__*/React.createElement("button", {
type: "button",
onClick: e => {
if (disabled) {
return;
}
onClick?.(e);
},
style: style,
className: clsx(prefixCls, className, `${prefixCls}-${mergeAlign}`, {
[`${prefixCls}-disabled`]: disabled
})
}, iconNode, labelNode);
};
export default Creation;