@drivy/cobalt
Version:
Opinionated design system for Drivy's projects.
23 lines (20 loc) • 1.14 kB
JavaScript
import '../Icon/index.js';
import React, { forwardRef } from 'react';
import LoadingIcon from '../Icon/__generated__/LoadingIcon.js';
const _Button = forwardRef((props, ref) => {
const { disabled, loading, children, ...restProps } = props;
return (React.createElement("button", { ref: ref, "aria-disabled": disabled, "aria-busy": loading, disabled: disabled, ...restProps },
loading && React.createElement(LoadingIcon, { className: "cob-Button__loading-icon" }),
children));
});
_Button.displayName = "button";
const Link = forwardRef((props, ref) => {
const { disabled, target, rel, loading, children, ...restProps } = props;
return (React.createElement("a", { "aria-disabled": disabled, "data-disabled": disabled, "aria-busy": loading, target: target, rel: target && !rel ? "noopener noreferrer" : rel, ref: ref, ...restProps },
loading && React.createElement(LoadingIcon, { className: "cob-Button__loading-icon" }),
children));
});
Link.displayName = "link";
const Button = Object.assign(_Button, { Link });
export { Button as default };
//# sourceMappingURL=ButtonComponent.js.map