2024-07-23 15:41:03 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
|
|
|
|
import BoardViewModel, {
|
2026-04-01 08:29:39 +00:00
|
|
|
BoardPageType,
|
2024-07-23 15:41:03 +02:00
|
|
|
} from "../../ViewModel/Pages/boardViewModel";
|
|
|
|
|
|
|
|
|
|
import { RibbonButton } from "./ribbonButton";
|
|
|
|
|
|
|
|
|
|
export function BoardViewToggleButton(
|
2026-04-01 08:29:39 +00:00
|
|
|
label: string,
|
|
|
|
|
icon: string,
|
|
|
|
|
page: BoardPageType,
|
|
|
|
|
boardViewModel: BoardViewModel,
|
2024-07-23 15:41:03 +02:00
|
|
|
) {
|
2026-04-01 08:29:39 +00:00
|
|
|
function select() {
|
|
|
|
|
boardViewModel.selectedPage.value = page;
|
|
|
|
|
}
|
2024-07-23 15:41:03 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
const isSelected = React.createProxyState(
|
|
|
|
|
[boardViewModel.selectedPage],
|
|
|
|
|
() => boardViewModel.selectedPage.value == page,
|
|
|
|
|
);
|
2024-07-23 15:41:03 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
return RibbonButton(label, icon, isSelected, select);
|
2024-07-23 15:41:03 +02:00
|
|
|
}
|