index.pug 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. transition(name='modal-fade')
  2. .fixed.inset-0.overflow-y-auto.z-50(
  3. role='dialog'
  4. :aria-labelledby='titleId'
  5. aria-modal='true'
  6. )
  7. .flex.items-end.justify-center.min-h-screen.pt-4.px-4.pb-20.text-center(class='sm:block sm:p-0')
  8. //- Оверлей :cite[8]
  9. .fixed.inset-0.bg-gray-600.bg-opacity-75.transition-opacity(
  10. @click='closeModal'
  11. :class='{ "cursor-pointer": closeOnOverlay }'
  12. aria-hidden='true'
  13. )
  14. //- Вертикальное выравнивание
  15. span.hidden(class='sm:inline-block sm:align-middle sm:h-screen' aria-hidden='true') ​
  16. //- Контент модального окна
  17. .inline-block.align-bottom.bg-white.rounded-lg.text-left.overflow-hidden.shadow-xl.transform.transition-all(
  18. class='dark:bg-gray-800 sm:my-8 sm:align-middle sm:max-w-lg sm:w-full'
  19. :class='contentClass'
  20. role='document'
  21. )
  22. .modal-content
  23. //- Заголовок
  24. .modal-header.bg-primary.p-6(class='sm:px-6')
  25. .flex.items-center.justify-between
  26. h3.text-lg.leading-6.font-medium.text-white(:id='titleId')
  27. slot(name='title') {{ title }}
  28. button.modal-close.p-2.rounded-full.transition-colors(
  29. @click='closeModal'
  30. class='hover:bg-white hover:bg-opacity-10 focus:outline-none focus:ring-2 focus:ring-white'
  31. aria-label='Закрыть окно'
  32. )
  33. svg.w-5.h-5.text-white(fill='none' stroke='currentColor' viewBox='0 0 24 24')
  34. path(stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 18L18 6M6 6l12 12')
  35. //- Тело модального окна
  36. .modal-body.p-6(class='sm:px-6')
  37. slot(name='body')
  38. .prose.max-w-none(v-if='content' v-html='content' class="class-dark:prose-invert")
  39. //- Футер (опционально)
  40. .modal-footer.bg-gray-50.p-6.flex.justify-end.space-x-3(
  41. class='dark:bg-gray-700 sm:px-6'
  42. v-if='showFooter'
  43. )
  44. slot(name='footer')
  45. button.secondary-btn.px-4.py-2.text-sm.font-medium.rounded-lg.transition-colors(
  46. @click='closeModal'
  47. class='bg-gray-300 text-gray-700 hover:bg-gray-400 dark:bg-gray-600 dark:text-gray-200 dark:hover:bg-gray-500'
  48. ) Отмена
  49. button.primary-btn.px-4.py-2.text-sm.font-medium.rounded-lg.transition-colors(
  50. @click='handleConfirm'
  51. class='bg-accent text-white hover:bg-yellow-600'
  52. ) Подтвердить