chore(react/collections): add spacer for calendar touch bar

This commit is contained in:
Elian Doran
2025-09-06 15:40:47 +03:00
parent 05299952a9
commit 8dcef5ea9f
2 changed files with 23 additions and 2 deletions

View File

@@ -27,6 +27,10 @@ interface ButtonProps {
enabled?: boolean;
}
interface SpacerProps {
size: "flexible" | "large" | "small";
}
interface SegmentedControlProps {
mode: "single" | "buttons";
segments: {
@@ -169,6 +173,19 @@ export function TouchBarSegmentedControl({ mode, segments, selectedIndex, onChan
return <></>;
}
export function TouchBarSpacer({ size }: SpacerProps) {
const api = useContext(TouchBarContext);
if (api) {
const item = new api.TouchBar.TouchBarSpacer({
size
});
api.addItem(item);
}
return <></>;
}
function buildIcon(nativeImage: typeof Electron.nativeImage, name: string) {
const sourceImage = nativeImage.createFromNamedImage(name, [-1, 0, 1]);
const { width, height } = sourceImage.getSize();