UNPKG

@drivy/cobalt

Version:

Opinionated design system for Drivy's projects.

39 lines (36 loc) 1.83 kB
import React, { forwardRef } from 'react'; import cx from 'classnames'; import { getButtonContent, getButtonCommonClassNames } from '../helpers.js'; import Button from '../ButtonComponent.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 (React.createElement(Button, { ...restButtonProps, className: getComputedClassName({ className: buttonClassNames }), ref: ref, loading: loading, disabled: isDisabled }, 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 (React.createElement(Button.Link, { ...restLinkProps, className: getComputedClassName({ className: buttonClassNames }), ref: ref, loading: loading, disabled: isDisabled }, content)); }); InversedLink.displayName = "InversedLink"; const InversedButton = Object.assign(_InversedButton, { Link: InversedLink }); export { InversedButton as default }; //# sourceMappingURL=index.js.map