2026-04-10 19:00:59 +00:00
|
|
|
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
2026-04-08 21:03:36 +00:00
|
|
|
import "./splitModal.css";
|
|
|
|
|
|
|
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2026-04-10 19:00:59 +00:00
|
|
|
export function SplitModal<T>(
|
|
|
|
|
coreViewModel: CoreViewModel,
|
2026-04-08 21:03:36 +00:00
|
|
|
leftView: React.State<Element>,
|
|
|
|
|
rightView: React.State<Element>,
|
2026-04-08 21:14:37 +00:00
|
|
|
extendedStyle: boolean = false,
|
2026-04-10 19:00:59 +00:00
|
|
|
navigationState?: React.State<T | undefined>,
|
2026-04-08 21:03:36 +00:00
|
|
|
) {
|
2026-04-10 19:00:59 +00:00
|
|
|
function closePage() {
|
|
|
|
|
navigationState.value = undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const hasPageOpen = new React.State<boolean>(false);
|
|
|
|
|
navigationState?.subscribe(
|
|
|
|
|
(newValue) => (hasPageOpen.value = newValue != undefined),
|
|
|
|
|
);
|
|
|
|
|
|
2026-04-08 21:03:36 +00:00
|
|
|
const view = (
|
2026-04-10 18:17:16 +00:00
|
|
|
<div
|
|
|
|
|
class="split-modal"
|
|
|
|
|
toggle:extended={extendedStyle}
|
2026-04-10 19:00:59 +00:00
|
|
|
toggle:navigation={navigationState != undefined}
|
|
|
|
|
toggle:page-open={hasPageOpen}
|
2026-04-10 18:17:16 +00:00
|
|
|
>
|
2026-04-08 21:03:36 +00:00
|
|
|
<div>
|
|
|
|
|
<div class="scroll-area" children:set={leftView}></div>
|
|
|
|
|
</div>
|
2026-04-10 19:00:59 +00:00
|
|
|
<div class="scroll-area slide-up">
|
|
|
|
|
<div
|
|
|
|
|
class="flex-row width-100 mobile-only"
|
|
|
|
|
toggle:hidden={navigationState == undefined}
|
|
|
|
|
>
|
|
|
|
|
<button
|
|
|
|
|
class="ghost square"
|
|
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.general.backButton
|
|
|
|
|
}
|
|
|
|
|
on:click={closePage}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">arrow_back</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div children:set={rightView}></div>
|
|
|
|
|
</div>
|
2026-04-08 21:03:36 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
|
}
|