Modal.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div class="modal is-active">
  3. <div class="modal-background" @click="closeCurrentModal()" />
  4. <div class="modal-card">
  5. <header class="modal-card-head">
  6. <h2 class="modal-card-title is-marginless">
  7. {{ title }}
  8. </h2>
  9. <button class="delete" @click="closeCurrentModal()" />
  10. </header>
  11. <section class="modal-card-body">
  12. <slot name="body" />
  13. </section>
  14. <footer class="modal-card-foot" v-if="$slots['footer'] != null">
  15. <slot name="footer" />
  16. </footer>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import { mapActions } from "vuex";
  22. export default {
  23. props: {
  24. title: { type: String, default: "Modal" }
  25. },
  26. mounted() {
  27. this.type = this.toCamelCase(this.title);
  28. },
  29. methods: {
  30. toCamelCase: str => {
  31. return str
  32. .toLowerCase()
  33. .replace(/[-_]+/g, " ")
  34. .replace(/[^\w\s]/g, "")
  35. .replace(/ (.)/g, $1 => $1.toUpperCase())
  36. .replace(/ /g, "");
  37. },
  38. ...mapActions("modalVisibility", ["closeCurrentModal"])
  39. }
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. @import "../styles/global.scss";
  44. .night-mode {
  45. .modal-card-head,
  46. .modal-card-foot {
  47. background-color: $night-mode-bg-secondary;
  48. border-color: #333;
  49. }
  50. .modal-card-body {
  51. background-color: #111 !important;
  52. }
  53. .modal-card-title {
  54. color: #fff;
  55. }
  56. p,
  57. label,
  58. td {
  59. color: $night-mode-text !important;
  60. }
  61. h1,
  62. h2,
  63. h3,
  64. h4,
  65. h5,
  66. h6 {
  67. color: #fff !important;
  68. }
  69. }
  70. .modal-card {
  71. width: 800px;
  72. font-size: 16px;
  73. }
  74. p {
  75. font-size: 17px;
  76. }
  77. .modal-card-title {
  78. font-size: 27px;
  79. }
  80. </style>