ctucx.git: oeffisearch

[nimlang] fast and simple tripplanner

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
'use strict';

import { showDiv, hideDiv, ElementById } from './helpers.js';
import { html, render } from './lit-html.js';

export const showAlertModal = (text) => {
	showDiv('overlay');
	render(html`
		<div class="modal">
			<div class="box alert">
				${text}
				<div class="dismiss" @click=${hideOverlay}>OK</div>
			</div>
		</div>
	`, ElementById('overlay'));
};

export const showSelectModal = (content) => {
	showDiv('overlay');
	render(html`
		<div class="modal">
			<div class="box select">
				${content}
				<a @click=${hideOverlay}>Close</a>
			</div>
		</div>
	`, ElementById('overlay'));
};

export const showModal = (title, content) => {
	showDiv('overlay');
	render(html`
		<div class="modal-dialog">
			<div id="modal-content" class="modal-content">
				<div class="modal-header">
					<div class="modal-close" @click=${() => hideDiv('overlay')}></div>
					<h4 class="modal-title">${title}</h4>
				</div>
				<div class="modal-body">${content}</div>
			</div>
		</div>
	`, ElementById('overlay'));
};

export const showLoader = () => {
	showDiv('overlay');
	render(html`
		<div class="loading">
			<div class="spinner"></div>
		</div>
	`, document.getElementById('overlay'));
};

export const hideOverlay = () => hideDiv('overlay');