chore(react/touchbar): add slider

This commit is contained in:
Elian Doran
2025-09-06 14:18:32 +03:00
parent 785f72ecd6
commit 3e7f0ad0a8
2 changed files with 34 additions and 7 deletions

View File

@@ -73,3 +73,26 @@ export function TouchBarLabel({ label }: { label: string }) {
return <></>;
}
interface SliderProps {
label: string;
value: number;
minValue: number;
maxValue: number;
onChange: (newValue: number) => void;
}
export function TouchBarSlider({ label, value, minValue, maxValue, onChange }: SliderProps) {
const api = useContext(TouchBarContext);
if (api) {
const item = new api.TouchBar.TouchBarSlider({
label,
value, minValue, maxValue,
change: onChange
});
api.addItem(item);
}
return <></>;
}