Dialog.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!-- Fenêtre de dialogue -->
  2. <template>
  3. <v-dialog
  4. :model-value="_show"
  5. :persistent="true"
  6. :max-width="maxWidth"
  7. :content-class="contentClass"
  8. >
  9. <v-card class="d-flex flex-row">
  10. <div
  11. :class="
  12. 'dialog-type flex-column justify-center d-none d-sm-flex theme-' +
  13. theme
  14. "
  15. >
  16. <h3 :class="'d-flex theme-' + theme">
  17. <v-icon icon="fa-solid fa-bullhorn" width="25" htight="25" />
  18. <span class="pt-4"><slot name="dialogType" /></span>
  19. </h3>
  20. </div>
  21. <div class="dialog-container d-flex flex-column flex-grow-1">
  22. <v-card-title class="dialog-title theme-neutral">
  23. <slot name="dialogTitle" />
  24. </v-card-title>
  25. <div class="dialog-text-container">
  26. <slot name="dialogText" />
  27. </div>
  28. <v-spacer />
  29. <v-divider />
  30. <v-card-actions class="justify-center">
  31. <slot name="dialogBtn" />
  32. </v-card-actions>
  33. </div>
  34. </v-card>
  35. </v-dialog>
  36. </template>
  37. <script setup lang="ts">
  38. const props = defineProps({
  39. show: {
  40. type: [Boolean, Object],
  41. required: true,
  42. },
  43. contentClass: {
  44. type: String,
  45. required: false,
  46. default: ''
  47. },
  48. theme: {
  49. type: String,
  50. required: false,
  51. default: 'primary',
  52. },
  53. maxWidth: {
  54. type: [Number, String],
  55. required: false,
  56. default: 800,
  57. },
  58. })
  59. // @ts-expect-error This is just to avoid the error with the prop's type of v-dialog
  60. const _show = computed(() => props.show) as boolean
  61. </script>
  62. <style lang="scss" scoped>
  63. .dialog-title {
  64. padding-left: 16px;
  65. font-weight: normal;
  66. }
  67. .dialog-type {
  68. width: 60px;
  69. min-width: 60px;
  70. max-width: 60px;
  71. min-height: 120px;
  72. padding: 25px 10px;
  73. h3 {
  74. font-weight: normal;
  75. writing-mode: vertical-lr;
  76. transform: rotate(-180deg);
  77. padding-left: 6px;
  78. }
  79. .v-icon {
  80. font-size: 25px;
  81. transform: rotate(90deg);
  82. padding-right: 25px;
  83. }
  84. }
  85. .dialog-container {
  86. overflow-x: scroll;
  87. }
  88. .dialog-text-container {
  89. max-height: 70vh;
  90. overflow: auto;
  91. }
  92. .modal-level-alert {
  93. .dialog-type {
  94. background: rgb(var(--v-theme-danger, #f56954));
  95. }
  96. }
  97. .modal-level-warning {
  98. .dialog-type {
  99. background: rgb(var(--v-theme-warning, #f39c12));
  100. }
  101. }
  102. :deep(.v-card-actions) {
  103. min-height: 62px;
  104. }
  105. </style>