adwaita-web
Version:
A GTK inspired toolkit designed to build awesome web apps
48 lines (47 loc) • 1.04 kB
JavaScript
import cx from "clsx";
import React from "react";
import { Spinner } from "./Spinner";
const Button = React.forwardRef(({
children,
className,
size = "medium",
icon: IconElement,
type = "button",
disabled,
loading,
circular,
flat,
link,
active,
hover,
text,
image,
primary,
danger,
...rest
}, ref) => {
const isImageButton = image !== void 0 ? image : Boolean(!children);
return /* @__PURE__ */ React.createElement("button", {
className: cx("Button", size, {
disabled,
circular,
flat,
link,
active,
hover,
"text-button": text,
"image-button": isImageButton,
"suggested-action": primary,
"destructive-action": danger
}) + " " + cx(className),
disabled: disabled || loading,
type,
ref,
...rest
}, loading && /* @__PURE__ */ React.createElement(Spinner, null), IconElement && /* @__PURE__ */ React.createElement(IconElement, {
containerProps: { className: "Button__icon" }
}), children);
});
export {
Button
};