mapcomplete/UI/Base/CheckBox.ts

18 lines
771 B
TypeScript
Raw Normal View History

2020-07-20 13:30:58 +02:00
import {UIElement} from "../UIElement";
import {UIEventSource} from "../UIEventSource";
2020-07-20 16:57:46 +02:00
import { FilteredLayer } from "../../Logic/FilteredLayer";
2020-07-20 13:30:58 +02:00
export class CheckBox extends UIElement{
2020-07-20 16:57:46 +02:00
constructor(data: UIEventSource<boolean>, name: String) {
2020-07-20 13:30:58 +02:00
super(data);
2020-07-20 16:57:46 +02:00
this.data = data;
this.name = name
2020-07-20 13:30:58 +02:00
}
protected InnerRender(): string {
2020-07-20 16:57:46 +02:00
return `${this.data.data? `<svg class="checkbox__check" width="28" height="20" viewBox="0 0 28 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 8L11.5 17L25.5 3" stroke="#003B8B" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/></svg><p class="checkbox__label--checked">${this.name}</p>`: `<p class="checkbox__label--unchecked">${this.name}</p>`}`;
2020-07-20 13:30:58 +02:00
}
}