UNPKG

@drivy/cobalt

Version:

Opinionated design system for Drivy's projects.

67 lines (66 loc) 2.19 kB
import { jsx } from "react/jsx-runtime"; import classnames from "classnames"; import { forwardRef } from "react"; import ButtonComponent from "../ButtonComponent.js"; import { getButtonCommonClassNames, getButtonContent } from "../helpers.js"; const getComputedClassName = ({ className })=>classnames(className, "cob-Button__inversed"); const _InversedButton = /*#__PURE__*/ 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 /*#__PURE__*/ jsx(ButtonComponent, { ...restButtonProps, className: getComputedClassName({ className: buttonClassNames }), ref: ref, loading: loading, disabled: isDisabled, children: content }); }); _InversedButton.displayName = "InversedButton"; const InversedLink = /*#__PURE__*/ 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 /*#__PURE__*/ jsx(ButtonComponent.Link, { ...restLinkProps, className: getComputedClassName({ className: buttonClassNames }), ref: ref, loading: loading, disabled: isDisabled, children: content }); }); InversedLink.displayName = "InversedLink"; const InversedButton = Object.assign(_InversedButton, { Link: InversedLink }); const Buttons_InversedButton = InversedButton; export default Buttons_InversedButton; //# sourceMappingURL=index.js.map