2018-02-13 20:32:59 +01:00
|
|
|
const html = require('choo/html');
|
|
|
|
|
|
|
|
module.exports = function(msg, confirmText, cancelText, confirmCallback) {
|
|
|
|
return html`
|
|
|
|
<div class="popup" onblur=${hide} tabindex="-1">
|
|
|
|
<div class="popup__message">${msg}</div>
|
|
|
|
<div class="popup__action">
|
2018-07-31 20:09:18 +02:00
|
|
|
<div>
|
|
|
|
<span class="popup__no" onclick=${hide}>${cancelText}</span>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span class="popup__yes" onclick=${confirmCallback}>${confirmText}</span>
|
|
|
|
</div>
|
2018-02-13 20:32:59 +01:00
|
|
|
</div>
|
2018-07-31 20:09:18 +02:00
|
|
|
</div>`;
|
2018-02-16 21:56:53 +01:00
|
|
|
|
|
|
|
function hide(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
const popup = document.querySelector('.popup.popup--show');
|
|
|
|
if (popup) {
|
|
|
|
popup.classList.remove('popup--show');
|
|
|
|
}
|
|
|
|
}
|
2018-02-13 20:32:59 +01:00
|
|
|
};
|