@@ -5,19 +5,21 @@ import {
55 RenderContext ,
66 WithSignal ,
77} from '@pmndrs/uikit' ;
8- import { TextWithEmoji } from '../../uiblocks/src/core/primitives/TextWithEmoji' ;
98import { computed } from '@preact/signals-core' ;
109
1110import { HighlightMaterial } from './HighlightMaterial' ;
1211import { MaterialSymbolsIcon } from './MaterialSymbolsIcon' ;
12+ import { TextWithEmoji } from '../../uiblocks/src/core/primitives/TextWithEmoji' ;
1313
14+ /** Properties for the ActionButton component. */
1415export type ActionButtonOutProperties = {
1516 text : string ;
1617 icon ?: string ;
1718 iconStyle ?: string ;
1819 iconWeight ?: number ;
1920} & BaseOutProperties ;
2021
22+ /** A reusable action button component with icon and text support. */
2123export class ActionButton <
2224 OutProperties extends ActionButtonOutProperties = ActionButtonOutProperties ,
2325> extends Container < OutProperties > {
@@ -54,24 +56,28 @@ export class ActionButton<
5456 ...config ,
5557 } ) ;
5658
59+ const iconContainer = new Container ( { } ) ;
60+ this . add ( iconContainer ) ;
5761 const icon = new MaterialSymbolsIcon ( {
5862 icon : this . properties . signal . icon ,
5963 iconStyle : this . properties . signal . iconStyle ,
6064 iconWeight : this . properties . signal . iconWeight ,
61- width : 40 ,
65+ height : 40 ,
6266 color : 0xa8c7fa ,
6367 display : computed ( ( ) =>
6468 this . properties . signal . icon ? 'initial' : 'none'
6569 ) ,
70+ alignSelf : 'center' ,
6671 } ) ;
67- this . add ( icon ) ;
72+ iconContainer . add ( icon ) ;
6873
6974 const text = new TextWithEmoji ( {
7075 text : this . properties . signal . text ,
7176 fontSize : 24 ,
7277 color : 'white' ,
7378 fontWeight : 600 ,
7479 letterSpacing : 1.26 ,
80+ wordBreak : 'keep-all' ,
7581 } ) ;
7682 this . add ( text ) ;
7783 }
0 commit comments