2021-01-08 02:13:44 +01:00
|
|
|
import {UIElement} from "../UIElement";
|
|
|
|
import Svg from "../../Svg";
|
|
|
|
import State from "../../State";
|
|
|
|
import Combine from "./Combine";
|
2021-01-08 16:49:42 +01:00
|
|
|
import Ornament from "./Ornament";
|
2021-01-08 02:13:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Wraps some contents into a panel that scrolls the content _under_ the title
|
|
|
|
*/
|
2021-01-09 00:03:21 +01:00
|
|
|
export default class ScrollableFullScreen extends UIElement {
|
2021-01-08 02:13:44 +01:00
|
|
|
private _component: Combine;
|
2021-01-09 00:03:21 +01:00
|
|
|
|
2021-01-08 02:13:44 +01:00
|
|
|
|
|
|
|
constructor(title: UIElement, content: UIElement) {
|
|
|
|
super();
|
|
|
|
const returnToTheMap = Svg.back_svg().onClick(() => {
|
|
|
|
State.state.fullScreenMessage.setData(undefined);
|
|
|
|
State.state.selectedElement.setData(undefined);
|
2021-01-21 05:05:10 +01:00
|
|
|
}).SetClass("featureinfobox-back-to-the-map only-on-mobile mb-2")
|
2021-01-20 23:00:11 +01:00
|
|
|
title.SetClass("block w-full")
|
2021-01-09 00:03:21 +01:00
|
|
|
const ornament = new Combine([new Ornament().SetStyle("height:5em;")]).SetClass("only-on-mobile")
|
|
|
|
|
2021-01-08 02:13:44 +01:00
|
|
|
this._component = new Combine([
|
2021-01-21 05:05:10 +01:00
|
|
|
new Combine([returnToTheMap, title]).SetClass("border-b-2 border-black shadow sm:shadow-none fixed sm:relative top-0 left-0 right-0 z-50 bg-white p-2 pb-0 sm:p-0 flex overflow-hidden"),
|
|
|
|
new Combine(["<span>", content, "</span>", ornament])
|
|
|
|
.SetClass("block relative pt-16 sm:pt-4 w-full max-h-screen sm:max-h-65vh landscape:max-h-screen overflow-y-auto overflow-x-hidden"),
|
2021-01-08 16:49:42 +01:00
|
|
|
// We add an ornament which takes around 5em. This is in order to make sure the Web UI doesn't hide
|
2021-01-08 02:13:44 +01:00
|
|
|
])
|
2021-01-21 05:05:10 +01:00
|
|
|
this.SetClass("block flex flex-col");
|
2021-01-09 00:03:21 +01:00
|
|
|
|
2021-01-08 02:13:44 +01:00
|
|
|
}
|
2021-01-09 00:03:21 +01:00
|
|
|
|
2021-01-08 02:13:44 +01:00
|
|
|
InnerRender(): string {
|
|
|
|
return this._component.Render();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|