mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 20:06:08 +01:00
chore(react/collections): reintroduce geomap touch bar buttons
This commit is contained in:
@@ -8,6 +8,24 @@ interface TouchBarProps {
|
||||
children: ComponentChildren;
|
||||
}
|
||||
|
||||
interface LabelProps {
|
||||
label: string;
|
||||
}
|
||||
|
||||
interface SliderProps {
|
||||
label: string;
|
||||
value: number;
|
||||
minValue: number;
|
||||
maxValue: number;
|
||||
onChange: (newValue: number) => void;
|
||||
}
|
||||
|
||||
interface ButtonProps {
|
||||
label: string;
|
||||
click: () => void;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
interface TouchBarContextApi {
|
||||
addItem(item: TouchBarItem): void;
|
||||
TouchBar: typeof Electron.TouchBar;
|
||||
@@ -61,7 +79,7 @@ export default function TouchBar({ children }: TouchBarProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export function TouchBarLabel({ label }: { label: string }) {
|
||||
export function TouchBarLabel({ label }: LabelProps) {
|
||||
const api = useContext(TouchBarContext);
|
||||
|
||||
if (api) {
|
||||
@@ -74,14 +92,6 @@ 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);
|
||||
|
||||
@@ -96,3 +106,16 @@ export function TouchBarSlider({ label, value, minValue, maxValue, onChange }: S
|
||||
|
||||
return <></>;
|
||||
}
|
||||
|
||||
export function TouchBarButton({ label, click, enabled }: ButtonProps) {
|
||||
const api = useContext(TouchBarContext);
|
||||
|
||||
if (api) {
|
||||
const item = new api.TouchBar.TouchBarButton({
|
||||
label, click, enabled
|
||||
});
|
||||
api.addItem(item);
|
||||
}
|
||||
|
||||
return <></>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user