@@ -13,24 +13,39 @@ import type { ButtonHeroProps } from './ButtonHero.types';
1313 * @param options0.isLoading - Whether the button is in a loading state
1414 * @returns ButtonBase component with locked light theme styles
1515 */
16- const ButtonHeroInner : React . FC < ButtonHeroProps > = ( {
17- isDisabled,
18- isLoading,
19- ...props
20- } ) => (
21- < ButtonBase
22- twClassName = { ( pressed ) =>
23- `bg-primary-default ${
24- pressed && ! isDisabled && ! isLoading ? 'bg-primary-default-pressed' : ''
25- } `
26- }
27- textClassName = { ( ) => 'text-primary-inverse' }
28- iconClassName = { ( ) => 'text-primary-inverse' }
29- isDisabled = { isDisabled }
30- isLoading = { isLoading }
31- { ...props }
32- />
33- ) ;
16+ const ButtonHeroInner : React . FC < ButtonHeroProps > = ( props ) => {
17+ const {
18+ isDisabled,
19+ isLoading,
20+ // Exclude styling props from spread to avoid consumer overrides
21+ twClassName = '' ,
22+ textClassName : _ignoredTextClassName ,
23+ iconClassName : _ignoredIconClassName ,
24+ ...restProps
25+ } = props ;
26+
27+ const getContainerClassName = ( pressed : boolean ) : string => {
28+ const userClassName =
29+ typeof twClassName === 'function' ? twClassName ( pressed ) : twClassName ;
30+
31+ const baseClassName = `bg-primary-default ${
32+ pressed && ! isDisabled && ! isLoading ? 'bg-primary-default-pressed' : ''
33+ } `;
34+
35+ return `${ baseClassName } ${ userClassName } ` . trim ( ) ;
36+ } ;
37+
38+ return (
39+ < ButtonBase
40+ twClassName = { getContainerClassName }
41+ textClassName = { ( ) => 'text-primary-inverse' }
42+ iconClassName = { ( ) => 'text-primary-inverse' }
43+ isDisabled = { isDisabled }
44+ isLoading = { isLoading }
45+ { ...restProps }
46+ />
47+ ) ;
48+ } ;
3449
3550/**
3651 * ButtonHero component - Hero button with locked light theme
0 commit comments