Skip to content

Commit 38fdb28

Browse files
authored
Merge pull request #329 from dli7319/glasses_action_icon
Glasses UI: Fix action button icon sizing.
2 parents 04dfe88 + 1e72e94 commit 38fdb28

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/addons/glasses/ui/ActionButton.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ import {
55
RenderContext,
66
WithSignal,
77
} from '@pmndrs/uikit';
8-
import {TextWithEmoji} from '../../uiblocks/src/core/primitives/TextWithEmoji';
98
import {computed} from '@preact/signals-core';
109

1110
import {HighlightMaterial} from './HighlightMaterial';
1211
import {MaterialSymbolsIcon} from './MaterialSymbolsIcon';
12+
import {TextWithEmoji} from '../../uiblocks/src/core/primitives/TextWithEmoji';
1313

14+
/** Properties for the ActionButton component. */
1415
export 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. */
2123
export 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

Comments
 (0)