@@ -7,7 +7,7 @@ import PlatformaticIcon from './PlatformaticIcon'
77import { SIZES , COLORS_BUTTON , BOX_SHADOW , UNDERLINE , HOVER_EFFECTS_BUTTONS , BACKGROUND_COLOR_OPAQUE , MAIN_DARK_BLUE , LARGE } from './constants'
88
99function Button ( {
10- icon ,
10+ classes ,
1111 label,
1212 color,
1313 backgroundColor,
@@ -21,30 +21,31 @@ function Button ({
2121 selected,
2222 ...rest
2323} ) {
24- let className = `${ styles . button } ${ commonStyles [ 'background-color-' + backgroundColor ] } ${ styles [ 'color-' + color ] } ${ styles [ 'button-' + size ] } `
25- if ( ! bordered ) className += ` ${ styles [ 'no-border' ] } `
24+ let buttonClassName = classes
25+ buttonClassName += ` ${ styles . button } ${ commonStyles [ 'background-color-' + backgroundColor ] } ${ styles [ 'color-' + color ] } ${ styles [ 'button-' + size ] } `
26+ if ( ! bordered ) buttonClassName += ` ${ styles [ 'no-border' ] } `
2627 if ( disabled ) {
27- className += ` ${ styles . disabled } `
28+ buttonClassName += ` ${ styles . disabled } `
2829 } else {
2930 switch ( hoverEffect ) {
3031 case BACKGROUND_COLOR_OPAQUE :
31- className += ' ' + commonStyles [ `hover-${ BACKGROUND_COLOR_OPAQUE } -${ color } ` ]
32+ buttonClassName += ' ' + commonStyles [ `hover-${ BACKGROUND_COLOR_OPAQUE } -${ color } ` ]
3233 break
3334 case BOX_SHADOW :
34- className += ' ' + styles [ `hover-${ BOX_SHADOW } -${ backgroundColor } ` ]
35+ buttonClassName += ' ' + styles [ `hover-${ BOX_SHADOW } -${ backgroundColor } ` ]
3536 break
3637 case UNDERLINE :
37- className += ` ${ styles [ 'underline-effect' ] } `
38+ buttonClassName += ` ${ styles [ 'underline-effect' ] } `
3839 break
3940 default :
4041 break
4142 }
4243 }
43- if ( bold ) className += ` ${ styles . fontBold } `
44- if ( fullWidth ) className += ` ${ styles . fullWidth } `
45- if ( selected ) className += ' ' + commonStyles [ `selected-background-color-${ color } ` ]
44+ if ( bold ) buttonClassName += ` ${ styles . fontBold } `
45+ if ( fullWidth ) buttonClassName += ` ${ styles . fullWidth } `
46+ if ( selected ) buttonClassName += ' ' + commonStyles [ `selected-background-color-${ color } ` ]
4647 return (
47- < button className = { className } disabled = { disabled } alt = { label } { ...rest } >
48+ < button className = { buttonClassName } disabled = { disabled } alt = { label } { ...rest } >
4849 { platformaticIcon ? < PlatformaticIcon iconName = { platformaticIcon . iconName } color = { platformaticIcon . color } data-testid = 'button-icon' onClick = { null } /> : null }
4950 < span className = { styles . label } > { label } </ span >
5051 </ button >
@@ -53,9 +54,9 @@ function Button ({
5354
5455Button . propTypes = {
5556 /**
56- * Icon
57+ * classes
5758 */
58- icon : PropTypes . object ,
59+ classes : PropTypes . string ,
5960 /**
6061 * label
6162 */
@@ -106,6 +107,7 @@ Button.propTypes = {
106107}
107108
108109Button . defaultProps = {
110+ classes : '' ,
109111 label : '' ,
110112 color : MAIN_DARK_BLUE ,
111113 backgroundColor : 'transparent' ,
0 commit comments