send/app/ui/modal.js

20 lines
503 B
JavaScript
Raw Normal View History

2018-10-25 02:07:10 +00:00
const html = require('choo/html');
module.exports = function(state, emit) {
return html`
2018-10-29 16:52:24 +00:00
<div class="absolute pin flex items-center justify-center overflow-hidden z-40 bg-shades" onclick=${close}>
<div class="border-modal bg-white" onclick=${e => e.stopPropagation()}>
2018-10-25 02:07:10 +00:00
${state.modal(state, emit, close)}
</div>
</div>`;
function close(event) {
2018-10-29 16:52:24 +00:00
if (event) {
event.preventDefault();
event.stopPropagation();
}
2018-10-25 02:07:10 +00:00
state.modal = null;
emit('render');
}
};