modal.js 623 B

12345678910111213141516171819202122232425
  1. const html = require('choo/html');
  2. module.exports = function(state, emit) {
  3. return html`
  4. <send-modal
  5. class="absolute inset-0 flex items-center justify-center overflow-hidden z-40 bg-white md:rounded-xl md:my-8 dark:bg-grey-90"
  6. >
  7. <div
  8. class="h-full w-full max-h-screen absolute top-0 flex items-center justify-center"
  9. >
  10. <div class="w-full">
  11. ${state.modal(state, emit, close)}
  12. </div>
  13. </div>
  14. </send-modal>
  15. `;
  16. function close(event) {
  17. if (event) {
  18. event.preventDefault();
  19. event.stopPropagation();
  20. }
  21. emit('closeModal');
  22. }
  23. };