mapcomplete/UI/Base/ScrollableFullScreen.ts

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-01-08 01:13:44 +00:00
import {UIElement} from "../UIElement";
import Svg from "../../Svg";
import State from "../../State";
import Combine from "./Combine";
2021-01-08 15:49:42 +00:00
import Ornament from "./Ornament";
2021-01-08 01:13:44 +00:00
/**
* Wraps some contents into a panel that scrolls the content _under_ the title
*/
2021-01-08 23:03:21 +00:00
export default class ScrollableFullScreen extends UIElement {
2021-01-08 01:13:44 +00:00
private _component: Combine;
2021-01-08 23:03:21 +00:00
2021-01-08 01:13:44 +00:00
2021-01-21 23:40:15 +00:00
constructor(title: UIElement, content: UIElement, onClose: (() => void)) {
2021-01-08 01:13:44 +00:00
super();
const returnToTheMap = Svg.back_svg().onClick(() => {
2021-01-21 23:40:15 +00:00
onClose();
}).SetClass("sm:hidden")
2021-01-08 01:13:44 +00:00
.SetClass("featureinfobox-back-to-the-map")
title.SetStyle("width: 100%; display: block;")
2021-01-21 23:40:15 +00:00
const ornament = new Combine([new Ornament().SetStyle("height:5em;")])
.SetClass("block sm:hidden")
2021-01-08 23:03:21 +00:00
2021-01-08 01:13:44 +00:00
this._component = new Combine([
2021-01-21 23:40:15 +00:00
new Combine([returnToTheMap, title])
.SetClass("text-xl break-words"),
new Combine([content, ornament])
2021-01-08 01:13:44 +00:00
])
2021-01-21 23:40:15 +00:00
this.SetClass("fixed h-screen w-screen fixed sm:relative");
2021-01-08 23:03:21 +00:00
2021-01-08 01:13:44 +00:00
}
2021-01-08 23:03:21 +00:00
2021-01-08 01:13:44 +00:00
InnerRender(): string {
return this._component.Render();
}
}