From 111609bd72cb0f63840ddc3acaa36df4356351cc Mon Sep 17 00:00:00 2001 From: Phillip Lovelace Date: Tue, 28 May 2024 14:46:12 -0700 Subject: [PATCH] fix(button-react): convert icon classes to function --- packages/sage-react/lib/Button/Button.jsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/sage-react/lib/Button/Button.jsx b/packages/sage-react/lib/Button/Button.jsx index 25b28e83fc..59b9b926ca 100644 --- a/packages/sage-react/lib/Button/Button.jsx +++ b/packages/sage-react/lib/Button/Button.jsx @@ -1,10 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; -import { SageClassnames } from '../configs'; import { Link } from '../Link'; import { Loader } from '../Loader'; -import { SageTokens } from '../configs'; +import { SageTokens, SageClassnames } from '../configs'; import { ButtonGroup } from './ButtonGroup'; import { BUTTON_COLORS, @@ -55,6 +54,13 @@ export const Button = React.forwardRef(({ } ); + let setIconClassName = (iconOnly, iconPosition) => { + if (iconOnly) { + return ''; + } + return iconPosition === 'right' ? SageClassnames.SPACERS.XS_LEFT : SageClassnames.SPACERS.XS_RIGHT; + }; + if (loading) { rest['aria-busy'] = true; rest['aria-label'] = rest['aria-label'] || BUTTON_DEFAULT_LOADING_TEXT; @@ -83,17 +89,17 @@ export const Button = React.forwardRef(({ {...rest} > {icon && ( - + )} {children} {disclosure && ( )}