chore(react/collections): use normal buttons for calendar prev/next

This commit is contained in:
Elian Doran 2025-09-06 15:36:37 +03:00
parent 5966b9ff23
commit 05299952a9
No known key found for this signature in database
2 changed files with 12 additions and 15 deletions

View File

@ -340,18 +340,13 @@ function CalendarTouchBar({ calendarRef }: { calendarRef: RefObject<FullCalendar
label={t("calendar.today")}
click={() => calendarRef.current?.today()}
/>
<TouchBarSegmentedControl
mode="buttons"
segments={[
{
icon: "NSImageNameTouchBarGoBackTemplate",
onClick: () => calendarRef.current?.prev()
},
{
icon: "NSImageNameTouchBarGoForwardTemplate",
onClick: () => calendarRef.current?.next()
}
]}
<TouchBarButton
icon="NSImageNameTouchBarGoBackTemplate"
click={() => calendarRef.current?.prev()}
/>
<TouchBarButton
icon="NSImageNameTouchBarGoForwardTemplate"
click={() => calendarRef.current?.next()}
/>
</TouchBar>
);

View File

@ -21,7 +21,8 @@ interface SliderProps {
}
interface ButtonProps {
label: string;
label?: string;
icon?: string;
click: () => void;
enabled?: boolean;
}
@ -122,12 +123,13 @@ export function TouchBarSlider({ label, value, minValue, maxValue, onChange }: S
return <></>;
}
export function TouchBarButton({ label, click, enabled }: ButtonProps) {
export function TouchBarButton({ label, icon, click, enabled }: ButtonProps) {
const api = useContext(TouchBarContext);
if (api) {
const item = new api.TouchBar.TouchBarButton({
label, click, enabled
label, click, enabled,
icon: icon ? buildIcon(api.nativeImage, icon) : undefined
});
api.addItem(item);
}