ctucx.git: oeffi-web

[nimlang] oeffisearch fork that works without javascript

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 
'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 id="modal">
			<div id="modal-box">
				<div id="modal-text">${text}</div>
				<div id="dismiss" @click=${() => hideDiv('overlay')}>OK</div>
			</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 id="loading">
			<div id="spinner"></div>
		</div>
	`, document.getElementById('overlay'));
};

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