Skip to content

Commit

Permalink
Merge pull request #2740 from SUI-Components/hotfix-button-demo
Browse files Browse the repository at this point in the history
fix(components/atom/button): compatibility with node20
  • Loading branch information
andresin87 committed May 22, 2024
2 parents 1082b3c + c923754 commit 0e10cc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/atom/button/src/ButtonIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {CLASS, ICON_POSITIONS, isAtomIcon, prepareAtomIcon, SIZES} from './confi

const ButtonIcon = ({children, position, size}) => {
if (!children) return null
// if the icon is an AtomIcon we've to be sure correct props are used
// if the icon is an AtomIcon, we've to be sure the correct props are used
const iconToRender = isAtomIcon(children) ? prepareAtomIcon(children, {size}) : children

return <span className={`${CLASS}-${position}Icon`}>{iconToRender}</span>
Expand Down
8 changes: 4 additions & 4 deletions components/atom/button/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ export const ICON_POSITIONS = {
}

/**
* Props for the button in order to filter the rest of attributes
* Props for the button to filter the rest of attributes
*/
export const OWN_PROPS = [
...TYPES,
...SIZES,
...Object.values(SIZES),
'alignment',
'children',
'className',
Expand All @@ -113,7 +113,7 @@ export const OWN_PROPS = [
]

/**
* Display Name for Atom Icon component
* Display Name for the AtomIcon component
*/
export const ATOM_ICON_DISPLAY_NAME = 'AtomIcon'

Expand Down Expand Up @@ -225,7 +225,7 @@ export const getPropsWithDefaultValues = ({type, design, color, alignment, link,
})

/**
* Detect if element is an AtomIcon to force correct size
* Detect if an element is an AtomIcon to force correct size
* @param {React.ReactElement} icon
*/
export const isAtomIcon = icon => icon?.type?.displayName === ATOM_ICON_DISPLAY_NAME
Expand Down

0 comments on commit 0e10cc6

Please sign in to comment.