@drivy/cobalt
Version:
Opinionated design system for Drivy's projects.
40 lines (37 loc) • 1.86 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import cx from 'classnames';
import { forwardRef } from 'react';
import Button from '../ButtonComponent.js';
import { getButtonContent, getButtonCommonClassNames } from '../helpers.js';
const getComputedClassName = ({ className }) => cx(className, "cob-Button__inversed");
const _InversedButton = forwardRef((props, ref) => {
const { children, icon, iconPosition, className, loading, disabled, rounded, size, fullWidth, ...restButtonProps } = props;
const content = getButtonContent({ children, icon, iconPosition });
const isDisabled = disabled || loading;
const buttonClassNames = getButtonCommonClassNames({
disabled: isDisabled,
rounded,
size,
fullWidth,
className,
});
return (jsx(Button, { ...restButtonProps, className: getComputedClassName({ className: buttonClassNames }), ref: ref, loading: loading, disabled: isDisabled, children: content }));
});
_InversedButton.displayName = "InversedButton";
const InversedLink = forwardRef((props, ref) => {
const { children, icon, iconPosition, className, loading, disabled, rounded, size, fullWidth, ...restLinkProps } = props;
const content = getButtonContent({ children, icon, iconPosition });
const isDisabled = disabled || loading;
const buttonClassNames = getButtonCommonClassNames({
disabled: isDisabled,
rounded,
size,
fullWidth,
className,
});
return (jsx(Button.Link, { ...restLinkProps, className: getComputedClassName({ className: buttonClassNames }), ref: ref, loading: loading, disabled: isDisabled, children: content }));
});
InversedLink.displayName = "InversedLink";
const InversedButton = Object.assign(_InversedButton, { Link: InversedLink });
export { InversedButton as default };
//# sourceMappingURL=index.js.map