modal.js 430 B

12345678910111213141516
  1. const html = require('choo/html');
  2. module.exports = function(state, emit) {
  3. return html`
  4. <div class="fixed pin flex items-center justify-center overflow-hidden z-40 bg-shades" onclick=${close}>
  5. <div class="rounded max-w-md bg-white m-1" onclick=${e =>
  6. e.stopPropagation()}>
  7. ${state.modal(state, emit, close)}
  8. </div>
  9. </div>`;
  10. function close(event) {
  11. state.modal = null;
  12. emit('render');
  13. }
  14. };