UNPKG

@drivy/cobalt

Version:

Opinionated design system for Drivy's projects.

20 lines (17 loc) 1.1 kB
import { jsxs, jsx } from 'react/jsx-runtime'; import { forwardRef } from 'react'; import '../Icon/index.js'; import LoadingIcon from '../Icon/__generated__/LoadingIcon.js'; const _Button = forwardRef((props, ref) => { const { disabled, loading, children, ...restProps } = props; return (jsxs("button", { ref: ref, "aria-disabled": disabled, "aria-busy": loading, disabled: disabled, ...restProps, children: [loading && jsx(LoadingIcon, { className: "cob-Button__loading-icon" }), children] })); }); _Button.displayName = "button"; const Link = forwardRef((props, ref) => { const { disabled, target, rel, loading, children, ...restProps } = props; return (jsxs("a", { "aria-disabled": disabled, "data-disabled": disabled, "aria-busy": loading, target: target, rel: target && !rel ? "noopener noreferrer" : rel, ref: ref, ...restProps, children: [loading && jsx(LoadingIcon, { className: "cob-Button__loading-icon" }), children] })); }); Link.displayName = "link"; const Button = Object.assign(_Button, { Link }); export { Button as default }; //# sourceMappingURL=ButtonComponent.js.map