index.pug 2.6 KB

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